Skip to content

Commit

Permalink
change reply to be its own thing
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
  • Loading branch information
t3chguy committed Dec 16, 2017
1 parent 9c38794 commit 304d281
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 14 deletions.
38 changes: 25 additions & 13 deletions src/components/views/context_menus/MessageContextMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import { _t } from 'matrix-react-sdk/lib/languageHandler';
const Modal = require('matrix-react-sdk/lib/Modal');
const Resend = require("matrix-react-sdk/lib/Resend");
import SettingsStore from "matrix-react-sdk/lib/settings/SettingsStore";
import {makeEventPermalink} from 'matrix-react-sdk/lib/matrix-to';

module.exports = React.createClass({
displayName: 'MessageContextMenu',
Expand Down Expand Up @@ -170,17 +171,18 @@ module.exports = React.createClass({
},

onQuoteClick: function() {
if (SettingsStore.isFeatureEnabled("feature_rich_quoting")) {
dis.dispatch({
action: 'quote_event',
event: this.props.mxEvent,
});
} else {
dis.dispatch({
action: 'quote',
text: this.props.eventTileOps.getInnerText(),
});
}
dis.dispatch({
action: 'quote',
text: this.props.eventTileOps.getInnerText(),
});
this.closeMenu();
},

onReplyClick: function() {
dis.dispatch({
action: 'quote_event',
event: this.props.mxEvent,
});
this.closeMenu();
},

Expand All @@ -197,6 +199,7 @@ module.exports = React.createClass({
let permalinkButton;
let externalURLButton;
let quoteButton;
let replyButton;

if (eventStatus === 'not_sent') {
resendButton = (
Expand Down Expand Up @@ -268,8 +271,8 @@ module.exports = React.createClass({
// XXX: if we use room ID, we should also include a server where the event can be found (other than in the domain of the event ID)
permalinkButton = (
<div className="mx_MessageContextMenu_field">
<a href={ "https://matrix.to/#/" + this.props.mxEvent.getRoomId() +"/"+ this.props.mxEvent.getId() }
target="_blank" rel="noopener" onClick={ this.closeMenu }>{ _t('Permalink') }</a>
<a href={makeEventPermalink(this.props.mxEvent.getRoomId(), this.props.mxEvent.getId())}
target="_blank" rel="noopener" onClick={this.closeMenu}>{ _t('Permalink') }</a>
</div>
);

Expand All @@ -279,6 +282,14 @@ module.exports = React.createClass({
{ _t('Quote') }
</div>
);

if (SettingsStore.isFeatureEnabled("feature_rich_quoting")) {
replyButton = (
<div className="mx_MessageContextMenu_field" onClick={this.onReplyClick}>
{ _t('Reply') }
</div>
);
}
}

// Bridges can provide a 'external_url' to link back to the source.
Expand All @@ -304,6 +315,7 @@ module.exports = React.createClass({
{unhidePreviewButton}
{permalinkButton}
{quoteButton}
{replyButton}
{externalURLButton}
</div>
);
Expand Down
3 changes: 2 additions & 1 deletion src/i18n/strings/en_EN.json
Original file line number Diff line number Diff line change
Expand Up @@ -217,5 +217,6 @@
"Contributing code to Matrix and Riot": "Contributing code to Matrix and Riot",
"Dev chat for the Riot/Web dev team": "Dev chat for the Riot/Web dev team",
"Dev chat for the Dendrite dev team": "Dev chat for the Dendrite dev team",
"Co-ordination for Riot/Web translators": "Co-ordination for Riot/Web translators"
"Co-ordination for Riot/Web translators": "Co-ordination for Riot/Web translators",
"Reply": "Reply"
}

0 comments on commit 304d281

Please sign in to comment.