onFavourite: PropTypes.func,
onReblog: PropTypes.func,
onDelete: PropTypes.func,
+ onDirect: PropTypes.func,
+ onMention: PropTypes.func,
onPin: PropTypes.func,
onOpenMedia: PropTypes.func,
onOpenVideo: PropTypes.func,
const messages = defineMessages({
delete: { id: 'status.delete', defaultMessage: 'Delete' },
+ direct: { id: 'status.direct', defaultMessage: 'Direct message @{name}' },
mention: { id: 'status.mention', defaultMessage: 'Mention @{name}' },
mute: { id: 'account.mute', defaultMessage: 'Mute @{name}' },
block: { id: 'account.block', defaultMessage: 'Block @{name}' },
onFavourite: PropTypes.func,
onReblog: PropTypes.func,
onDelete: PropTypes.func,
+ onDirect: PropTypes.func,
onMention: PropTypes.func,
onMute: PropTypes.func,
onBlock: PropTypes.func,
this.props.onMention(this.props.status.get('account'), this.context.router.history);
}
+ handleDirectClick = () => {
+ this.props.onDirect(this.props.status.get('account'), this.context.router.history);
+ }
+
handleMuteClick = () => {
this.props.onMute(this.props.status.get('account'));
}
menu.push({ text: intl.formatMessage(messages.delete), action: this.handleDeleteClick });
} else {
menu.push({ text: intl.formatMessage(messages.mention, { name: status.getIn(['account', 'username']) }), action: this.handleMentionClick });
+ menu.push({ text: intl.formatMessage(messages.direct, { name: status.getIn(['account', 'username']) }), action: this.handleDirectClick });
menu.push(null);
menu.push({ text: intl.formatMessage(messages.mute, { name: status.getIn(['account', 'username']) }), action: this.handleMuteClick });
menu.push({ text: intl.formatMessage(messages.block, { name: status.getIn(['account', 'username']) }), action: this.handleBlockClick });
import {
replyCompose,
mentionCompose,
+ directCompose,
} from '../actions/compose';
import {
reblog,
}
},
+ onDirect (account, router) {
+ dispatch(directCompose(account, router));
+ },
+
onMention (account, router) {
dispatch(mentionCompose(account, router));
},
const messages = defineMessages({
delete: { id: 'status.delete', defaultMessage: 'Delete' },
+ direct: { id: 'status.direct', defaultMessage: 'Direct message @{name}' },
mention: { id: 'status.mention', defaultMessage: 'Mention @{name}' },
reply: { id: 'status.reply', defaultMessage: 'Reply' },
reblog: { id: 'status.reblog', defaultMessage: 'Boost' },
onReblog: PropTypes.func.isRequired,
onFavourite: PropTypes.func.isRequired,
onDelete: PropTypes.func.isRequired,
+ onDirect: PropTypes.func.isRequired,
onMention: PropTypes.func.isRequired,
onMute: PropTypes.func,
onMuteConversation: PropTypes.func,
this.props.onDelete(this.props.status);
}
+ handleDirectClick = () => {
+ this.props.onDirect(this.props.status.get('account'), this.context.router.history);
+ }
+
handleMentionClick = () => {
this.props.onMention(this.props.status.get('account'), this.context.router.history);
}
if (publicStatus) {
menu.push({ text: intl.formatMessage(messages.embed), action: this.handleEmbed });
+ menu.push(null);
}
if (me === status.getIn(['account', 'id'])) {
menu.push({ text: intl.formatMessage(messages.delete), action: this.handleDeleteClick });
} else {
menu.push({ text: intl.formatMessage(messages.mention, { name: status.getIn(['account', 'username']) }), action: this.handleMentionClick });
+ menu.push({ text: intl.formatMessage(messages.direct, { name: status.getIn(['account', 'username']) }), action: this.handleDirectClick });
menu.push(null);
menu.push({ text: intl.formatMessage(messages.mute, { name: status.getIn(['account', 'username']) }), action: this.handleMuteClick });
menu.push({ text: intl.formatMessage(messages.block, { name: status.getIn(['account', 'username']) }), action: this.handleBlockClick });
import {
replyCompose,
mentionCompose,
+ directCompose,
} from '../../actions/compose';
import { blockAccount } from '../../actions/accounts';
import {
}
}
+ handleDirectClick = (account, router) => {
+ this.props.dispatch(directCompose(account, router));
+ }
+
handleMentionClick = (account, router) => {
this.props.dispatch(mentionCompose(account, router));
}
onFavourite={this.handleFavouriteClick}
onReblog={this.handleReblogClick}
onDelete={this.handleDeleteClick}
+ onDirect={this.handleDirectClick}
onMention={this.handleMentionClick}
onMute={this.handleMuteClick}
onMuteConversation={this.handleConversationMuteClick}
"defaultMessage": "Delete",
"id": "status.delete"
},
+ {
+ "defaultMessage": "Direct message @{name}",
+ "id": "status.direct"
+ },
{
"defaultMessage": "Mention @{name}",
"id": "status.mention"
"defaultMessage": "Delete",
"id": "status.delete"
},
+ {
+ "defaultMessage": "Direct message @{name}",
+ "id": "status.direct"
+ },
{
"defaultMessage": "Mention @{name}",
"id": "status.mention"
"status.block": "Block @{name}",
"status.cannot_reblog": "This post cannot be boosted",
"status.delete": "Delete",
+ "status.direct": "Direct message @{name}",
"status.embed": "Embed",
"status.favourite": "Favourite",
"status.load_more": "Load more",
case COMPOSE_UPLOAD_PROGRESS:
return state.set('progress', Math.round((action.loaded / action.total) * 100));
case COMPOSE_MENTION:
- return state
- .update('text', text => `${text}@${action.account.get('acct')} `)
- .set('focusDate', new Date())
- .set('idempotencyKey', uuid());
+ return state.withMutations(map => {
+ map.update('text', text => [text.trim(), `@${action.account.get('acct')} `].filter((str) => str.length !== 0).join(' '));
+ map.set('focusDate', new Date());
+ map.set('idempotencyKey', uuid());
+ });
case COMPOSE_DIRECT:
- return state
- .update('text', text => `@${action.account.get('acct')} `)
- .set('privacy', 'direct')
- .set('focusDate', new Date())
- .set('idempotencyKey', uuid());
+ return state.withMutations(map => {
+ map.update('text', text => [text.trim(), `@${action.account.get('acct')} `].filter((str) => str.length !== 0).join(' '));
+ map.set('privacy', 'direct');
+ map.set('focusDate', new Date());
+ map.set('idempotencyKey', uuid());
+ });
case COMPOSE_SUGGESTIONS_CLEAR:
return state.update('suggestions', ImmutableList(), list => list.clear()).set('suggestion_token', null);
case COMPOSE_SUGGESTIONS_READY: