pass in contentName to repost modal

This commit is contained in:
Bradley 2022-03-03 10:21:36 -06:00 committed by infinite-persistence
parent d7506850b3
commit 233a2b27ba
No known key found for this signature in database
GPG key ID: B9C3252EDC3D0AA0
2 changed files with 6 additions and 4 deletions

View file

@ -6,20 +6,22 @@ import RepostCreate from 'component/repostCreate';
import useThrottle from 'effects/use-throttle'; import useThrottle from 'effects/use-throttle';
type Props = { type Props = {
uri: string, uri?: string,
contentName?: string,
// --- redux ---
closeModal: () => void, closeModal: () => void,
resolveUri: (string) => void, resolveUri: (string) => void,
}; };
function ModalRepost(props: Props) { function ModalRepost(props: Props) {
const { uri, closeModal, resolveUri } = props; const { uri, contentName, closeModal, resolveUri } = props;
const { const {
location: { search }, location: { search },
} = useHistory(); } = useHistory();
const urlParams = new URLSearchParams(search); const urlParams = new URLSearchParams(search);
const param = urlParams.get('name') || urlParams.get('q'); const param = urlParams.get('name') || urlParams.get('q') || contentName;
const repostTo = param && param[0] === '@' ? param.slice(1) : param; const repostTo = param && param[0] === '@' ? param.slice(1) : param;
const [contentUri, setContentUri] = React.useState(''); const [contentUri, setContentUri] = React.useState('');

View file

@ -192,7 +192,7 @@ export default function ShowPage(props: Props) {
<Button <Button
button="secondary" button="secondary"
label={__('Repost Something')} label={__('Repost Something')}
onClick={() => doOpenModal(MODALS.REPOST, {})} onClick={() => doOpenModal(MODALS.REPOST, { contentName })}
/> />
</div> </div>
) )