Add resending bar (and resend all option)
Factor out resend logic which was in the context menu into a separate Resend file (it shouldn't be in the skin, but it also isn't really suitable for a controller given 2 different views invoke it..)
This commit is contained in:
parent
804af341ac
commit
3a8c263e8e
5 changed files with 78 additions and 16 deletions
|
@ -209,6 +209,10 @@ limitations under the License.
|
|||
font-size: 12px;
|
||||
}
|
||||
|
||||
.mx_RoomView_resend_link {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.mx_RoomView_typingBar {
|
||||
margin-top: 10px;
|
||||
margin-left: 54px;
|
||||
|
|
|
@ -22,25 +22,13 @@ var MatrixClientPeg = require('matrix-react-sdk/lib/MatrixClientPeg');
|
|||
var dis = require('matrix-react-sdk/lib/dispatcher');
|
||||
var sdk = require('matrix-react-sdk')
|
||||
var Modal = require('matrix-react-sdk/lib/Modal');
|
||||
var Resend = require("../../../../Resend");
|
||||
|
||||
module.exports = React.createClass({
|
||||
displayName: 'MessageContextMenu',
|
||||
|
||||
onResendClick: function() {
|
||||
MatrixClientPeg.get().resendEvent(
|
||||
this.props.mxEvent, MatrixClientPeg.get().getRoom(
|
||||
this.props.mxEvent.getRoomId()
|
||||
)
|
||||
).done(function() {
|
||||
dis.dispatch({
|
||||
action: 'message_sent'
|
||||
});
|
||||
}, function() {
|
||||
dis.dispatch({
|
||||
action: 'message_send_failed'
|
||||
});
|
||||
});
|
||||
dis.dispatch({action: 'message_resend_started'});
|
||||
Resend.resend(this.props.mxEvent);
|
||||
if (this.props.onFinished) this.props.onFinished();
|
||||
},
|
||||
|
||||
|
|
|
@ -199,6 +199,8 @@ module.exports = React.createClass({
|
|||
var unreadMsgs = this.getUnreadMessagesString();
|
||||
// no conn bar trumps unread count since you can't get unread messages
|
||||
// without a connection! (technically may already have some but meh)
|
||||
// It also trumps the "some not sent" msg since you can't resend without
|
||||
// a connection!
|
||||
if (this.state.syncState === "ERROR") {
|
||||
statusBar = (
|
||||
<div className="mx_RoomView_connectionLostBar">
|
||||
|
@ -214,6 +216,24 @@ module.exports = React.createClass({
|
|||
</div>
|
||||
);
|
||||
}
|
||||
else if (this.state.hasUnsentMessages) {
|
||||
statusBar = (
|
||||
<div className="mx_RoomView_connectionLostBar">
|
||||
<img src="img/cancel.png" width="10" height="12" alt=""/>
|
||||
<div className="mx_RoomView_connectionLostBar_textArea">
|
||||
<span className="mx_RoomView_connectionLostBar_title">
|
||||
Some of your messages have not been sent.
|
||||
</span>
|
||||
<div className="mx_RoomView_connectionLostBar_desc">
|
||||
<span className="mx_RoomView_resend_link"
|
||||
onClick={ this.onResendAllClick } >
|
||||
Resend all now
|
||||
</span> or select individual messages to re-send.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
// unread count trumps who is typing since the unread count is only
|
||||
// set when you've scrolled up
|
||||
else if (unreadMsgs) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue