diff options
author | beatrix <beatrix.bitrot@gmail.com> | 2017-12-26 17:03:00 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-12-26 17:03:00 -0500 |
commit | e6ab869d956eb088eff6ce8b8b6114fb0d6d63fd (patch) | |
tree | 0ddfc8cb254dbc17fe9628166c2d57e793c83e8d /app/javascript/flavours/glitch/features/status/index.js | |
parent | 6b85dba8daf7ddb59063cadfe4e2a6dc071931d5 (diff) | |
parent | cc6a2ffd0a23432dd64f9b0188dea12b79889c79 (diff) |
Merge pull request #285 from chriswmartin/detailed-status-actions
Add mute, block, conversation mute actions to detailed status dropdown
Diffstat (limited to 'app/javascript/flavours/glitch/features/status/index.js')
-rw-r--r-- | app/javascript/flavours/glitch/features/status/index.js | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/app/javascript/flavours/glitch/features/status/index.js b/app/javascript/flavours/glitch/features/status/index.js index 40ae380ab..682c3625f 100644 --- a/app/javascript/flavours/glitch/features/status/index.js +++ b/app/javascript/flavours/glitch/features/status/index.js @@ -20,14 +20,16 @@ import { replyCompose, mentionCompose, } from 'flavours/glitch/actions/compose'; -import { deleteStatus } from 'flavours/glitch/actions/statuses'; +import { blockAccount } from 'flavours/glitch/actions/accounts'; +import { muteStatus, unmuteStatus, deleteStatus } from 'flavours/glitch/actions/statuses'; +import { initMuteModal } from 'flavours/glitch/actions/mutes'; import { initReport } from 'flavours/glitch/actions/reports'; import { makeGetStatus } from 'flavours/glitch/selectors'; import { ScrollContainer } from 'react-router-scroll-4'; import ColumnBackButton from 'flavours/glitch/components/column_back_button'; import StatusContainer from 'flavours/glitch/containers/status_container'; import { openModal } from 'flavours/glitch/actions/modal'; -import { defineMessages, injectIntl } from 'react-intl'; +import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import ImmutablePureComponent from 'react-immutable-pure-component'; import { HotKeys } from 'react-hotkeys'; import { boostModal, favouriteModal, deleteModal } from 'flavours/glitch/util/initial_state'; @@ -36,6 +38,7 @@ import { attachFullscreenListener, detachFullscreenListener, isFullscreen } from const messages = defineMessages({ deleteConfirm: { id: 'confirmations.delete.confirm', defaultMessage: 'Delete' }, deleteMessage: { id: 'confirmations.delete.message', defaultMessage: 'Are you sure you want to delete this status?' }, + blockConfirm: { id: 'confirmations.block.confirm', defaultMessage: 'Block' }, }); const makeMapStateToProps = () => { @@ -165,6 +168,28 @@ export default class Status extends ImmutablePureComponent { this.props.dispatch(openModal('VIDEO', { media, time })); } + handleMuteClick = (account) => { + this.props.dispatch(initMuteModal(account)); + } + + handleConversationMuteClick = (status) => { + if (status.get('muted')) { + this.props.dispatch(unmuteStatus(status.get('id'))); + } else { + this.props.dispatch(muteStatus(status.get('id'))); + } + } + + handleBlockClick = (account) => { + const { dispatch, intl } = this.props; + + dispatch(openModal('CONFIRM', { + message: <FormattedMessage id='confirmations.block.message' defaultMessage='Are you sure you want to block {name}?' values={{ name: <strong>@{account.get('acct')}</strong> }} />, + confirm: intl.formatMessage(messages.blockConfirm), + onConfirm: () => dispatch(blockAccount(account.get('id'))), + })); + } + handleReport = (status) => { this.props.dispatch(initReport(status.get('account'), status)); } @@ -349,6 +374,9 @@ export default class Status extends ImmutablePureComponent { onReblog={this.handleReblogClick} onDelete={this.handleDeleteClick} onMention={this.handleMentionClick} + onMute={this.handleMuteClick} + onMuteConversation={this.handleConversationMuteClick} + onBlock={this.handleBlockClick} onReport={this.handleReport} onPin={this.handlePin} onEmbed={this.handleEmbed} |