Skip to content

Commit d23cd8d

Browse files
committed
add quote option to detailed statuses
1 parent 67a7b60 commit d23cd8d

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

app/javascript/flavours/glitch/features/status/components/action_bar.js

+7
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ const messages = defineMessages({
1818
reply: { id: 'status.reply', defaultMessage: 'Reply' },
1919
reblog: { id: 'status.reblog', defaultMessage: 'Boost' },
2020
reblog_private: { id: 'status.reblog_private', defaultMessage: 'Boost with original visibility' },
21+
quote: { id: 'status.quote', defaultMessage: 'Quote' },
2122
cancel_reblog_private: { id: 'status.cancel_reblog_private', defaultMessage: 'Unboost' },
2223
cannot_reblog: { id: 'status.cannot_reblog', defaultMessage: 'This post cannot be boosted' },
2324
favourite: { id: 'status.favourite', defaultMessage: 'Favourite' },
@@ -52,6 +53,7 @@ class ActionBar extends React.PureComponent {
5253
onReblog: PropTypes.func.isRequired,
5354
onFavourite: PropTypes.func.isRequired,
5455
onBookmark: PropTypes.func.isRequired,
56+
onQuote: PropTypes.func.isRequired,
5557
onMute: PropTypes.func,
5658
onMuteConversation: PropTypes.func,
5759
onBlock: PropTypes.func,
@@ -81,6 +83,10 @@ class ActionBar extends React.PureComponent {
8183
this.props.onBookmark(this.props.status, e);
8284
}
8385

86+
handleQuoteClick = (e) => {
87+
this.props.onQuote(this.props.status);
88+
}
89+
8490
handleDeleteClick = () => {
8591
this.props.onDelete(this.props.status, this.context.router.history);
8692
}
@@ -215,6 +221,7 @@ class ActionBar extends React.PureComponent {
215221
<div className='detailed-status__action-bar'>
216222
<div className='detailed-status__button'><IconButton title={intl.formatMessage(messages.reply)} icon={status.get('in_reply_to_id', null) === null ? 'reply' : 'reply-all'} onClick={this.handleReplyClick} /></div>
217223
<div className='detailed-status__button'><IconButton className={classNames({ reblogPrivate })} disabled={!publicStatus && !reblogPrivate} active={status.get('reblogged')} title={reblogTitle} icon='retweet' onClick={this.handleReblogClick} /></div>
224+
<div className='detailed-status__button'><IconButton className='quote-right-icon' disabled={!publicStatus} title={intl.formatMessage(messages.quote)} icon='quote-right' onClick={this.handleQuoteClick} /></div>
218225
<div className='detailed-status__button'><IconButton className='star-icon' animate active={status.get('favourited')} title={intl.formatMessage(messages.favourite)} icon='star' onClick={this.handleFavouriteClick} /></div>
219226
{shareButton}
220227
<div className='detailed-status__button'><IconButton className='bookmark-icon' disabled={!signedIn} active={status.get('bookmarked')} title={intl.formatMessage(messages.bookmark)} icon='bookmark' onClick={this.handleBookmarkClick} /></div>

app/javascript/flavours/glitch/features/status/containers/detailed_status_container.js

+18
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import DetailedStatus from '../components/detailed_status';
33
import { makeGetStatus } from 'flavours/glitch/selectors';
44
import {
55
replyCompose,
6+
quoteCompose,
67
mentionCompose,
78
directCompose,
89
} from 'flavours/glitch/actions/compose';
@@ -33,6 +34,8 @@ import { showAlertForError } from 'flavours/glitch/actions/alerts';
3334
const messages = defineMessages({
3435
deleteConfirm: { id: 'confirmations.delete.confirm', defaultMessage: 'Delete' },
3536
deleteMessage: { id: 'confirmations.delete.message', defaultMessage: 'Are you sure you want to delete this status?' },
37+
quoteConfirm: { id: 'confirmations.quote.confirm', defaultMessage: 'Quote' },
38+
quoteMessage: { id: 'confirmations.quote.message', defaultMessage: 'Quoting now will overwrite the message you are currently composing. Are you sure you want to proceed?' },
3639
redraftConfirm: { id: 'confirmations.redraft.confirm', defaultMessage: 'Delete & redraft' },
3740
redraftMessage: { id: 'confirmations.redraft.message', defaultMessage: 'Are you sure you want to delete this status and re-draft it? Favourites and boosts will be lost, and replies to the original post will be orphaned.' },
3841
replyConfirm: { id: 'confirmations.reply.confirm', defaultMessage: 'Reply' },
@@ -68,6 +71,21 @@ const mapDispatchToProps = (dispatch, { intl }) => ({
6871
});
6972
},
7073

74+
onQuote (status, router) {
75+
dispatch((_, getState) => {
76+
let state = getState();
77+
if (state.getIn(['compose', 'text']).trim().length !== 0) {
78+
dispatch(openModal('CONFIRM', {
79+
message: intl.formatMessage(messages.quoteMessage),
80+
confirm: intl.formatMessage(messages.quoteConfirm),
81+
onConfirm: () => dispatch(quoteCompose(status, router)),
82+
}));
83+
} else {
84+
dispatch(quoteCompose(status, router));
85+
}
86+
});
87+
},
88+
7189
onModalReblog (status, privacy) {
7290
dispatch(reblog(status, privacy));
7391
},

0 commit comments

Comments
 (0)