0
0
Fork 0

Embed modal (#4748)

* Embed modal

* Proxy OEmbed requests from web UI
This commit is contained in:
Eugen Rochko 2017-08-31 03:38:35 +02:00 committed by GitHub
parent 2db9ccaf3e
commit d1a78eba15
10 changed files with 186 additions and 2 deletions

View file

@ -16,6 +16,7 @@ const messages = defineMessages({
share: { id: 'status.share', defaultMessage: 'Share' },
pin: { id: 'status.pin', defaultMessage: 'Pin on profile' },
unpin: { id: 'status.unpin', defaultMessage: 'Unpin from profile' },
embed: { id: 'status.embed', defaultMessage: 'Embed' },
});
@injectIntl
@ -34,6 +35,7 @@ export default class ActionBar extends React.PureComponent {
onMention: PropTypes.func.isRequired,
onReport: PropTypes.func,
onPin: PropTypes.func,
onEmbed: PropTypes.func,
me: PropTypes.number.isRequired,
intl: PropTypes.object.isRequired,
};
@ -73,11 +75,17 @@ export default class ActionBar extends React.PureComponent {
});
}
handleEmbed = () => {
this.props.onEmbed(this.props.status);
}
render () {
const { status, me, intl } = this.props;
let menu = [];
menu.push({ text: intl.formatMessage(messages.embed), action: this.handleEmbed });
if (me === status.getIn(['account', 'id'])) {
if (['public', 'unlisted'].indexOf(status.get('visibility')) !== -1) {
menu.push({ text: intl.formatMessage(status.get('pinned') ? messages.unpin : messages.pin), action: this.handlePinClick });

View file

@ -147,6 +147,10 @@ export default class Status extends ImmutablePureComponent {
this.props.dispatch(initReport(status.get('account'), status));
}
handleEmbed = (status) => {
this.props.dispatch(openModal('EMBED', { url: status.get('url') }));
}
renderChildren (list) {
return list.map(id => <StatusContainer key={id} id={id} />);
}
@ -198,6 +202,7 @@ export default class Status extends ImmutablePureComponent {
onMention={this.handleMentionClick}
onReport={this.handleReport}
onPin={this.handlePin}
onEmbed={this.handleEmbed}
/>
{descendants}