Invert pending/sent model

pull/749/head
lilia 10 years ago
parent a66195a98f
commit fa4022a4e3

@ -92,7 +92,8 @@
sent_at : data.timestamp, sent_at : data.timestamp,
received_at : now, received_at : now,
conversationId : data.destination, conversationId : data.destination,
type : 'outgoing' type : 'outgoing',
sent : true
}); });
message.handleDataMessage(data.message); message.handleDataMessage(data.message);

@ -75,8 +75,7 @@
type : 'outgoing', type : 'outgoing',
attachments : attachments, attachments : attachments,
sent_at : now, sent_at : now,
received_at : now, received_at : now
pending : true
}); });
message.save(); message.save();
@ -97,7 +96,7 @@
sendFunc = textsecure.messaging.sendMessageToGroup; sendFunc = textsecure.messaging.sendMessageToGroup;
} }
sendFunc(this.get('id'), body, attachments, now).then(function() { sendFunc(this.get('id'), body, attachments, now).then(function() {
message.save({'pending': false}); message.save({'sent': true});
}.bind(this)).catch(function(errors) { }.bind(this)).catch(function(errors) {
if (errors instanceof Error) { if (errors instanceof Error) {
errors = [errors]; errors = [errors];

@ -23,7 +23,7 @@
initialize: function() { initialize: function() {
this.listenTo(this.model, 'change:body change:errors', this.render); this.listenTo(this.model, 'change:body change:errors', this.render);
this.listenTo(this.model, 'change:delivered', this.renderDelivered); 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, 'change:flags change:group_update', this.renderControl);
this.listenTo(this.model, 'destroy', this.remove); this.listenTo(this.model, 'destroy', this.remove);
}, },
@ -36,9 +36,9 @@
className: function() { className: function() {
return ["entry", this.model.get('type')].join(' '); return ["entry", this.model.get('type')].join(' ');
}, },
renderPending: function() { renderSent: function() {
if (this.model.isOutgoing()) { if (this.model.isOutgoing()) {
this.$el.toggleClass('pending', !!this.model.get('pending')); this.$el.toggleClass('sent', !!this.model.get('sent'));
} }
}, },
renderDelivered: function() { renderDelivered: function() {
@ -69,8 +69,8 @@
var escaped = content.html(); 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>")); 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.renderDelivered();
this.renderPending();
this.renderControl(); this.renderControl();
this.$('.attachments').append( this.$('.attachments').append(

@ -194,9 +194,12 @@
} }
} }
.outgoing.pending .bubble { .outgoing .bubble {
opacity: 0.7; opacity: 0.7;
} }
.outgoing.sent .bubble {
opacity: 1.0;
}
.incoming { .incoming {
.bubble { .bubble {

@ -571,9 +571,12 @@ input.search {
.message-detail .bubble p, .message-detail .bubble p,
.message-list .bubble p { .message-list .bubble p {
margin: 0; } margin: 0; }
.message-detail .outgoing.pending .bubble, .message-detail .outgoing .bubble,
.message-list .outgoing.pending .bubble { .message-list .outgoing .bubble {
opacity: 0.7; } opacity: 0.7; }
.message-detail .outgoing.sent .bubble,
.message-list .outgoing.sent .bubble {
opacity: 1.0; }
.message-detail .incoming .bubble, .message-detail .incoming .bubble,
.message-list .incoming .bubble { .message-list .incoming .bubble {
color: #454545; color: #454545;

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save