mirror of
https://github.com/SchildiChat/element-web.git
synced 2024-10-01 01:26:12 -04:00
Merge pull request #477 from vector-im/kegan/resending
Make unsent messages behave better
This commit is contained in:
commit
862ab0c115
@ -57,25 +57,42 @@ module.exports = React.createClass({
|
|||||||
if (this.props.onFinished) this.props.onFinished();
|
if (this.props.onFinished) this.props.onFinished();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onCancelSendClick: function() {
|
||||||
|
Resend.removeFromQueue(this.props.mxEvent);
|
||||||
|
if (this.props.onFinished) this.props.onFinished();
|
||||||
|
},
|
||||||
|
|
||||||
render: function() {
|
render: function() {
|
||||||
|
var eventStatus = this.props.mxEvent.status;
|
||||||
var resendButton;
|
var resendButton;
|
||||||
var viewSourceButton;
|
var viewSourceButton;
|
||||||
var redactButton;
|
var redactButton;
|
||||||
|
var cancelButton;
|
||||||
|
|
||||||
if (this.props.mxEvent.status == 'not_sent') {
|
if (eventStatus === 'not_sent') {
|
||||||
resendButton = (
|
resendButton = (
|
||||||
<div className="mx_ContextualMenu_field" onClick={this.onResendClick}>
|
<div className="mx_ContextualMenu_field" onClick={this.onResendClick}>
|
||||||
Resend
|
Resend
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
|
if (!eventStatus) { // sent
|
||||||
redactButton = (
|
redactButton = (
|
||||||
<div className="mx_ContextualMenu_field" onClick={this.onRedactClick}>
|
<div className="mx_ContextualMenu_field" onClick={this.onRedactClick}>
|
||||||
Redact
|
Redact
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (eventStatus === "queued" || eventStatus === "not_sent") {
|
||||||
|
cancelButton = (
|
||||||
|
<div className="mx_ContextualMenu_field" onClick={this.onCancelSendClick}>
|
||||||
|
Cancel Sending
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
viewSourceButton = (
|
viewSourceButton = (
|
||||||
<div className="mx_ContextualMenu_field" onClick={this.onViewSourceClick}>
|
<div className="mx_ContextualMenu_field" onClick={this.onViewSourceClick}>
|
||||||
View Source
|
View Source
|
||||||
@ -86,6 +103,7 @@ module.exports = React.createClass({
|
|||||||
<div>
|
<div>
|
||||||
{resendButton}
|
{resendButton}
|
||||||
{redactButton}
|
{redactButton}
|
||||||
|
{cancelButton}
|
||||||
{viewSourceButton}
|
{viewSourceButton}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
@ -111,7 +111,7 @@ limitations under the License.
|
|||||||
}
|
}
|
||||||
|
|
||||||
.mx_EventTile_notSent {
|
.mx_EventTile_notSent {
|
||||||
color: #ddd;
|
color: #f44;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mx_EventTile_highlight,
|
.mx_EventTile_highlight,
|
||||||
|
Loading…
Reference in New Issue
Block a user