Invert pending/sent model
This commit is contained in:
parent
a66195a98f
commit
fa4022a4e3
6 changed files with 18 additions and 12 deletions
|
@ -92,7 +92,8 @@
|
|||
sent_at : data.timestamp,
|
||||
received_at : now,
|
||||
conversationId : data.destination,
|
||||
type : 'outgoing'
|
||||
type : 'outgoing',
|
||||
sent : true
|
||||
});
|
||||
|
||||
message.handleDataMessage(data.message);
|
||||
|
|
|
@ -75,8 +75,7 @@
|
|||
type : 'outgoing',
|
||||
attachments : attachments,
|
||||
sent_at : now,
|
||||
received_at : now,
|
||||
pending : true
|
||||
received_at : now
|
||||
});
|
||||
message.save();
|
||||
|
||||
|
@ -97,7 +96,7 @@
|
|||
sendFunc = textsecure.messaging.sendMessageToGroup;
|
||||
}
|
||||
sendFunc(this.get('id'), body, attachments, now).then(function() {
|
||||
message.save({'pending': false});
|
||||
message.save({'sent': true});
|
||||
}.bind(this)).catch(function(errors) {
|
||||
if (errors instanceof Error) {
|
||||
errors = [errors];
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
initialize: function() {
|
||||
this.listenTo(this.model, 'change:body change:errors', this.render);
|
||||
this.listenTo(this.model, 'change:delivered', this.renderDelivered);
|
||||
this.listenTo(this.model, 'change', this.renderPending);
|
||||
this.listenTo(this.model, 'change', this.renderSent);
|
||||
this.listenTo(this.model, 'change:flags change:group_update', this.renderControl);
|
||||
this.listenTo(this.model, 'destroy', this.remove);
|
||||
},
|
||||
|
@ -36,9 +36,9 @@
|
|||
className: function() {
|
||||
return ["entry", this.model.get('type')].join(' ');
|
||||
},
|
||||
renderPending: function() {
|
||||
renderSent: function() {
|
||||
if (this.model.isOutgoing()) {
|
||||
this.$el.toggleClass('pending', !!this.model.get('pending'));
|
||||
this.$el.toggleClass('sent', !!this.model.get('sent'));
|
||||
}
|
||||
},
|
||||
renderDelivered: function() {
|
||||
|
@ -69,8 +69,8 @@
|
|||
var escaped = content.html();
|
||||
content.html(escaped.replace(/\n/g, '<br>').replace(/(^|[\s\n]|<br\/?>)((?:https?|ftp):\/\/[\-A-Z0-9+\u0026\u2019@#\/%?=()~_|!:,.;]*[\-A-Z0-9+\u0026@#\/%=~()_|])/gi, "$1<a href='$2' target='_blank'>$2</a>"));
|
||||
|
||||
this.renderSent();
|
||||
this.renderDelivered();
|
||||
this.renderPending();
|
||||
this.renderControl();
|
||||
|
||||
this.$('.attachments').append(
|
||||
|
|
|
@ -194,9 +194,12 @@
|
|||
}
|
||||
}
|
||||
|
||||
.outgoing.pending .bubble {
|
||||
.outgoing .bubble {
|
||||
opacity: 0.7;
|
||||
}
|
||||
.outgoing.sent .bubble {
|
||||
opacity: 1.0;
|
||||
}
|
||||
|
||||
.incoming {
|
||||
.bubble {
|
||||
|
|
|
@ -571,9 +571,12 @@ input.search {
|
|||
.message-detail .bubble p,
|
||||
.message-list .bubble p {
|
||||
margin: 0; }
|
||||
.message-detail .outgoing.pending .bubble,
|
||||
.message-list .outgoing.pending .bubble {
|
||||
.message-detail .outgoing .bubble,
|
||||
.message-list .outgoing .bubble {
|
||||
opacity: 0.7; }
|
||||
.message-detail .outgoing.sent .bubble,
|
||||
.message-list .outgoing.sent .bubble {
|
||||
opacity: 1.0; }
|
||||
.message-detail .incoming .bubble,
|
||||
.message-list .incoming .bubble {
|
||||
color: #454545;
|
||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue