1
0

[Glitch] Fix embed dropdown menu item for unauthenticated users

Port 41f65edb21 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
Claire 2023-07-13 15:53:03 +02:00
parent d9adda1a99
commit a98b5c2246
4 changed files with 6 additions and 6 deletions

View File

@ -177,7 +177,7 @@ const mapDispatchToProps = (dispatch, { intl, contextType }) => ({
dispatch(openModal({ dispatch(openModal({
modalType: 'EMBED', modalType: 'EMBED',
modalProps: { modalProps: {
url: status.get('url'), id: status.get('id'),
onError: error => dispatch(showAlertForError(error)), onError: error => dispatch(showAlertForError(error)),
}, },
})); }));

View File

@ -108,7 +108,7 @@ const mapDispatchToProps = (dispatch, { intl }) => ({
dispatch(openModal({ dispatch(openModal({
modalType: 'EMBED', modalType: 'EMBED',
modalProps: { modalProps: {
url: status.get('url'), id: status.get('id'),
onError: error => dispatch(showAlertForError(error)), onError: error => dispatch(showAlertForError(error)),
}, },
})); }));

View File

@ -500,7 +500,7 @@ class Status extends ImmutablePureComponent {
handleEmbed = (status) => { handleEmbed = (status) => {
this.props.dispatch(openModal({ this.props.dispatch(openModal({
modalType: 'EMBED', modalType: 'EMBED',
modalProps: { url: status.get('url') }, modalProps: { id: status.get('id') },
})); }));
}; };

View File

@ -14,7 +14,7 @@ const messages = defineMessages({
class EmbedModal extends ImmutablePureComponent { class EmbedModal extends ImmutablePureComponent {
static propTypes = { static propTypes = {
url: PropTypes.string.isRequired, id: PropTypes.string.isRequired,
onClose: PropTypes.func.isRequired, onClose: PropTypes.func.isRequired,
onError: PropTypes.func.isRequired, onError: PropTypes.func.isRequired,
intl: PropTypes.object.isRequired, intl: PropTypes.object.isRequired,
@ -26,11 +26,11 @@ class EmbedModal extends ImmutablePureComponent {
}; };
componentDidMount () { componentDidMount () {
const { url } = this.props; const { id } = this.props;
this.setState({ loading: true }); this.setState({ loading: true });
api().post('/api/web/embed', { url }).then(res => { api().get(`/api/web/embeds/${id}`).then(res => {
this.setState({ loading: false, oembed: res.data }); this.setState({ loading: false, oembed: res.data });
const iframeDocument = this.iframe.contentWindow.document; const iframeDocument = this.iframe.contentWindow.document;