1
0
mirror of https://github.com/matrix-org/matrix-react-sdk.git synced 2025-11-13 08:02:38 +03:00

Refactor remove resend_all_events and cancel_all_events dispatches

This commit is contained in:
Luke Barnard
2017-02-27 13:39:12 +00:00
parent b68b0e25c8
commit 7221900497
4 changed files with 17 additions and 28 deletions

View File

@@ -26,7 +26,6 @@ var ContextualMenu = require("./ContextualMenu");
var RoomListSorter = require("../../RoomListSorter");
var UserActivity = require("../../UserActivity");
var Presence = require("../../Presence");
var Resend = require("../../Resend");
var dis = require("../../dispatcher");
var Login = require("./login/Login");
@@ -522,20 +521,6 @@ module.exports = React.createClass({
case 'set_theme':
this._onSetTheme(payload.value);
break;
case 'resend_all_events':
payload.room.getPendingEvents().filter(function(ev) {
return ev.status === Matrix.EventStatus.NOT_SENT;
}).forEach(function(event) {
Resend.resend(event);
});
break;
case 'cancel_all_events':
payload.room.getPendingEvents().filter(function(ev) {
return ev.status === Matrix.EventStatus.NOT_SENT;
}).forEach(function(event) {
Resend.removeFromQueue(event);
});
break;
case 'on_logged_in':
this._onLoggedIn();
break;

View File

@@ -716,17 +716,11 @@ module.exports = React.createClass({
},
onResendAllClick: function() {
dis.dispatch({
action: 'resend_all_events',
room: this.state.room,
});
Resend.resendUnsentEvents(this.state.room);
},
onCancelAllClick: function() {
dis.dispatch({
action: 'cancel_all_events',
room: this.state.room,
});
Resend.cancelUnsentEvents(this.state.room);
},
onJoinButtonClicked: function(ev) {

View File

@@ -159,10 +159,7 @@ export default React.createClass({
<button className="mx_Dialog_primary" autoFocus={ true }
onClick={() => {
this.props.onFinished();
dis.dispatch({
action: 'resend_all_events',
room: this.props.room,
});
Resend.resendUnsentEvents(this.props.room);
}}>
Send anyway
</button>