pass in contentName to repost modal
This commit is contained in:
parent
d7506850b3
commit
233a2b27ba
2 changed files with 6 additions and 4 deletions
|
@ -6,20 +6,22 @@ import RepostCreate from 'component/repostCreate';
|
|||
import useThrottle from 'effects/use-throttle';
|
||||
|
||||
type Props = {
|
||||
uri: string,
|
||||
uri?: string,
|
||||
contentName?: string,
|
||||
// --- redux ---
|
||||
closeModal: () => void,
|
||||
resolveUri: (string) => void,
|
||||
};
|
||||
|
||||
function ModalRepost(props: Props) {
|
||||
const { uri, closeModal, resolveUri } = props;
|
||||
const { uri, contentName, closeModal, resolveUri } = props;
|
||||
|
||||
const {
|
||||
location: { search },
|
||||
} = useHistory();
|
||||
|
||||
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 [contentUri, setContentUri] = React.useState('');
|
||||
|
|
|
@ -192,7 +192,7 @@ export default function ShowPage(props: Props) {
|
|||
<Button
|
||||
button="secondary"
|
||||
label={__('Repost Something')}
|
||||
onClick={() => doOpenModal(MODALS.REPOST, {})}
|
||||
onClick={() => doOpenModal(MODALS.REPOST, { contentName })}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue