change reply to be its own thing

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Michael Telatynski 2017-12-16 19:01:56 +00:00
parent 9c38794ad5
commit 304d281ed2
No known key found for this signature in database
GPG Key ID: 3F879DA5AD802A5E
2 changed files with 27 additions and 14 deletions

View File

@ -25,6 +25,7 @@ import { _t } from 'matrix-react-sdk/lib/languageHandler';
const Modal = require('matrix-react-sdk/lib/Modal'); const Modal = require('matrix-react-sdk/lib/Modal');
const Resend = require("matrix-react-sdk/lib/Resend"); const Resend = require("matrix-react-sdk/lib/Resend");
import SettingsStore from "matrix-react-sdk/lib/settings/SettingsStore"; import SettingsStore from "matrix-react-sdk/lib/settings/SettingsStore";
import {makeEventPermalink} from 'matrix-react-sdk/lib/matrix-to';
module.exports = React.createClass({ module.exports = React.createClass({
displayName: 'MessageContextMenu', displayName: 'MessageContextMenu',
@ -170,17 +171,18 @@ module.exports = React.createClass({
}, },
onQuoteClick: function() { onQuoteClick: function() {
if (SettingsStore.isFeatureEnabled("feature_rich_quoting")) {
dis.dispatch({
action: 'quote_event',
event: this.props.mxEvent,
});
} else {
dis.dispatch({ dis.dispatch({
action: 'quote', action: 'quote',
text: this.props.eventTileOps.getInnerText(), text: this.props.eventTileOps.getInnerText(),
}); });
} this.closeMenu();
},
onReplyClick: function() {
dis.dispatch({
action: 'quote_event',
event: this.props.mxEvent,
});
this.closeMenu(); this.closeMenu();
}, },
@ -197,6 +199,7 @@ module.exports = React.createClass({
let permalinkButton; let permalinkButton;
let externalURLButton; let externalURLButton;
let quoteButton; let quoteButton;
let replyButton;
if (eventStatus === 'not_sent') { if (eventStatus === 'not_sent') {
resendButton = ( resendButton = (
@ -268,7 +271,7 @@ 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) // 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 = ( permalinkButton = (
<div className="mx_MessageContextMenu_field"> <div className="mx_MessageContextMenu_field">
<a href={ "https://matrix.to/#/" + this.props.mxEvent.getRoomId() +"/"+ this.props.mxEvent.getId() } <a href={makeEventPermalink(this.props.mxEvent.getRoomId(), this.props.mxEvent.getId())}
target="_blank" rel="noopener" onClick={this.closeMenu}>{ _t('Permalink') }</a> target="_blank" rel="noopener" onClick={this.closeMenu}>{ _t('Permalink') }</a>
</div> </div>
); );
@ -279,6 +282,14 @@ module.exports = React.createClass({
{ _t('Quote') } { _t('Quote') }
</div> </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. // Bridges can provide a 'external_url' to link back to the source.
@ -304,6 +315,7 @@ module.exports = React.createClass({
{unhidePreviewButton} {unhidePreviewButton}
{permalinkButton} {permalinkButton}
{quoteButton} {quoteButton}
{replyButton}
{externalURLButton} {externalURLButton}
</div> </div>
); );

View File

@ -217,5 +217,6 @@
"Contributing code to Matrix and Riot": "Contributing code to Matrix and Riot", "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 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", "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"
} }