Skip to content

Commit 862ab0c

Browse files
committed
Merge pull request element-hq#477 from vector-im/kegan/resending
Make unsent messages behave better
2 parents da5c687 + 2f905e1 commit 862ab0c

2 files changed

Lines changed: 21 additions & 3 deletions

File tree

‎src/components/views/rooms/MessageContextMenu.js‎

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,25 +57,42 @@ module.exports = React.createClass({
5757
if (this.props.onFinished) this.props.onFinished();
5858
},
5959

60+
onCancelSendClick: function() {
61+
Resend.removeFromQueue(this.props.mxEvent);
62+
if (this.props.onFinished) this.props.onFinished();
63+
},
64+
6065
render: function() {
66+
var eventStatus = this.props.mxEvent.status;
6167
var resendButton;
6268
var viewSourceButton;
6369
var redactButton;
70+
var cancelButton;
6471

65-
if (this.props.mxEvent.status == 'not_sent') {
72+
if (eventStatus === 'not_sent') {
6673
resendButton = (
6774
<div className="mx_ContextualMenu_field" onClick={this.onResendClick}>
6875
Resend
6976
</div>
7077
);
7178
}
72-
else {
79+
80+
if (!eventStatus) { // sent
7381
redactButton = (
7482
<div className="mx_ContextualMenu_field" onClick={this.onRedactClick}>
7583
Redact
7684
</div>
7785
);
7886
}
87+
88+
if (eventStatus === "queued" || eventStatus === "not_sent") {
89+
cancelButton = (
90+
<div className="mx_ContextualMenu_field" onClick={this.onCancelSendClick}>
91+
Cancel Sending
92+
</div>
93+
);
94+
}
95+
7996
viewSourceButton = (
8097
<div className="mx_ContextualMenu_field" onClick={this.onViewSourceClick}>
8198
View Source
@@ -86,6 +103,7 @@ module.exports = React.createClass({
86103
<div>
87104
{resendButton}
88105
{redactButton}
106+
{cancelButton}
89107
{viewSourceButton}
90108
</div>
91109
);

‎src/skins/vector/css/molecules/EventTile.css‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ limitations under the License.
111111
}
112112

113113
.mx_EventTile_notSent {
114-
color: #ddd;
114+
color: #f44;
115115
}
116116

117117
.mx_EventTile_highlight,

0 commit comments

Comments
 (0)