mirror of
https://github.com/element-hq/element-web
synced 2024-11-27 19:56:47 +03:00
support resending reactions
This commit is contained in:
parent
8160759a52
commit
0d79b03f53
2 changed files with 31 additions and 0 deletions
|
@ -100,6 +100,13 @@ module.exports = React.createClass({
|
||||||
this.closeMenu();
|
this.closeMenu();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onResendReactionsClick: function() {
|
||||||
|
for (const reaction of this._getUnsentReactions()) {
|
||||||
|
Resend.resend(reaction);
|
||||||
|
}
|
||||||
|
this.closeMenu();
|
||||||
|
},
|
||||||
|
|
||||||
e2eInfoClicked: function() {
|
e2eInfoClicked: function() {
|
||||||
this.props.e2eInfoCallback();
|
this.props.e2eInfoCallback();
|
||||||
this.closeMenu();
|
this.closeMenu();
|
||||||
|
@ -227,13 +234,28 @@ module.exports = React.createClass({
|
||||||
this.closeMenu();
|
this.closeMenu();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_getUnsentReactions() {
|
||||||
|
const cli = MatrixClientPeg.get();
|
||||||
|
const room = cli.getRoom(this.props.mxEvent.getRoomId());
|
||||||
|
const eventId = this.props.mxEvent.getId();
|
||||||
|
return room.getPendingEvents().filter(e => {
|
||||||
|
const relation = e.getRelation();
|
||||||
|
return relation &&
|
||||||
|
relation.rel_type === "m.annotation" &&
|
||||||
|
relation.event_id === eventId &&
|
||||||
|
e.status === EventStatus.NOT_SENT;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
render: function() {
|
render: function() {
|
||||||
const mxEvent = this.props.mxEvent;
|
const mxEvent = this.props.mxEvent;
|
||||||
const eventStatus = mxEvent.status;
|
const eventStatus = mxEvent.status;
|
||||||
const editStatus = mxEvent.replacingEvent() && mxEvent.replacingEvent().status;
|
const editStatus = mxEvent.replacingEvent() && mxEvent.replacingEvent().status;
|
||||||
const redactStatus = mxEvent.localRedactionEvent() && mxEvent.localRedactionEvent().status;
|
const redactStatus = mxEvent.localRedactionEvent() && mxEvent.localRedactionEvent().status;
|
||||||
|
const unsentReactionsCount = this._getUnsentReactions().length;
|
||||||
let resendButton;
|
let resendButton;
|
||||||
let resendEditButton;
|
let resendEditButton;
|
||||||
|
let resendReactionsButton;
|
||||||
let resendRedactionButton;
|
let resendRedactionButton;
|
||||||
let redactButton;
|
let redactButton;
|
||||||
let cancelButton;
|
let cancelButton;
|
||||||
|
@ -264,6 +286,14 @@ module.exports = React.createClass({
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (unsentReactionsCount !== 0) {
|
||||||
|
resendReactionsButton = (
|
||||||
|
<div className="mx_MessageContextMenu_field" onClick={this.onResendReactionsClick}>
|
||||||
|
{ _t('Resend %(unsentCount)s reactions', {unsentCount: unsentReactionsCount}) }
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if (redactStatus === EventStatus.NOT_SENT) {
|
if (redactStatus === EventStatus.NOT_SENT) {
|
||||||
resendRedactionButton = (
|
resendRedactionButton = (
|
||||||
<div className="mx_MessageContextMenu_field" onClick={this.onResendRedactionClick}>
|
<div className="mx_MessageContextMenu_field" onClick={this.onResendRedactionClick}>
|
||||||
|
|
|
@ -1303,6 +1303,7 @@
|
||||||
"You cannot delete this message. (%(code)s)": "You cannot delete this message. (%(code)s)",
|
"You cannot delete this message. (%(code)s)": "You cannot delete this message. (%(code)s)",
|
||||||
"Resend": "Resend",
|
"Resend": "Resend",
|
||||||
"Resend edit": "Resend edit",
|
"Resend edit": "Resend edit",
|
||||||
|
"Resend %(unsentCount)s reactions": "Resend %(unsentCount)s reactions",
|
||||||
"Resend removal": "Resend removal",
|
"Resend removal": "Resend removal",
|
||||||
"Cancel Sending": "Cancel Sending",
|
"Cancel Sending": "Cancel Sending",
|
||||||
"Forward Message": "Forward Message",
|
"Forward Message": "Forward Message",
|
||||||
|
|
Loading…
Reference in a new issue