From 15963a15c6731982f9dd10935931c3051d0da836 Mon Sep 17 00:00:00 2001 From: Yamagishi Kazutoshi Date: Sat, 2 Sep 2017 21:01:44 +0900 Subject: [PATCH] Disable embed modal when private status (#4773) * Disable embed modal when private status * Remove `reblogDisabled` --- .../mastodon/components/status_action_bar.js | 15 ++++++++++----- .../features/status/components/action_bar.js | 8 ++++++-- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/app/javascript/mastodon/components/status_action_bar.js b/app/javascript/mastodon/components/status_action_bar.js index cf0f853ab..850f3f8c4 100644 --- a/app/javascript/mastodon/components/status_action_bar.js +++ b/app/javascript/mastodon/components/status_action_bar.js @@ -116,9 +116,10 @@ export default class StatusActionBar extends ImmutablePureComponent { render () { const { status, me, intl, withDismiss } = this.props; - const reblogDisabled = status.get('visibility') === 'private' || status.get('visibility') === 'direct'; + const mutingConversation = status.get('muted'); - const anonymousAccess = !me; + const anonymousAccess = !me; + const publicStatus = ['public', 'unlisted'].includes(status.get('visibility')); let menu = []; let reblogIcon = 'retweet'; @@ -126,7 +127,11 @@ export default class StatusActionBar extends ImmutablePureComponent { let replyTitle; menu.push({ text: intl.formatMessage(messages.open), action: this.handleOpen }); - menu.push({ text: intl.formatMessage(messages.embed), action: this.handleEmbed }); + + if (publicStatus) { + menu.push({ text: intl.formatMessage(messages.embed), action: this.handleEmbed }); + } + menu.push(null); if (withDismiss) { @@ -135,7 +140,7 @@ export default class StatusActionBar extends ImmutablePureComponent { } if (status.getIn(['account', 'id']) === me) { - if (['public', 'unlisted'].indexOf(status.get('visibility')) !== -1) { + if (publicStatus) { menu.push({ text: intl.formatMessage(status.get('pinned') ? messages.unpin : messages.pin), action: this.handlePinClick }); } @@ -169,7 +174,7 @@ export default class StatusActionBar extends ImmutablePureComponent { return (
- + {shareButton} diff --git a/app/javascript/mastodon/features/status/components/action_bar.js b/app/javascript/mastodon/features/status/components/action_bar.js index 9431b11c1..c303caf10 100644 --- a/app/javascript/mastodon/features/status/components/action_bar.js +++ b/app/javascript/mastodon/features/status/components/action_bar.js @@ -82,12 +82,16 @@ export default class ActionBar extends React.PureComponent { render () { const { status, me, intl } = this.props; + const publicStatus = ['public', 'unlisted'].includes(status.get('visibility')); + let menu = []; - menu.push({ text: intl.formatMessage(messages.embed), action: this.handleEmbed }); + if (publicStatus) { + menu.push({ text: intl.formatMessage(messages.embed), action: this.handleEmbed }); + } if (me === status.getIn(['account', 'id'])) { - if (['public', 'unlisted'].indexOf(status.get('visibility')) !== -1) { + if (publicStatus) { menu.push({ text: intl.formatMessage(status.get('pinned') ? messages.unpin : messages.pin), action: this.handlePinClick }); }