Include outgoing control messages in message history
So you know it worked.
This commit is contained in:
parent
f067bb9954
commit
ce36c36bd0
2 changed files with 28 additions and 0 deletions
|
@ -112,14 +112,30 @@
|
||||||
|
|
||||||
endSession: function() {
|
endSession: function() {
|
||||||
if (this.get('type') === 'private') {
|
if (this.get('type') === 'private') {
|
||||||
|
var now = Date.now();
|
||||||
textsecure.messaging.closeSession(this.id);
|
textsecure.messaging.closeSession(this.id);
|
||||||
|
this.messageCollection.add({
|
||||||
|
conversationId : this.id,
|
||||||
|
type : 'outgoing',
|
||||||
|
sent_at : now,
|
||||||
|
received_at : now,
|
||||||
|
flags : textsecure.protobuf.PushMessageContent.Flags.END_SESSION
|
||||||
|
}).save();
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
leaveGroup: function() {
|
leaveGroup: function() {
|
||||||
|
var now = Date.now();
|
||||||
if (this.get('type') === 'group') {
|
if (this.get('type') === 'group') {
|
||||||
textsecure.messaging.leaveGroup(this.id);
|
textsecure.messaging.leaveGroup(this.id);
|
||||||
|
this.messageCollection.add({
|
||||||
|
group_update: { left: 'You' },
|
||||||
|
conversationId : this.id,
|
||||||
|
type : 'outgoing',
|
||||||
|
sent_at : now,
|
||||||
|
received_at : now
|
||||||
|
}).save();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -127,6 +127,18 @@
|
||||||
group.save().then(function() {
|
group.save().then(function() {
|
||||||
this.trigger('open', {modelId: groupId});
|
this.trigger('open', {modelId: groupId});
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
|
var now = Date.now();
|
||||||
|
group.messageCollection.add({
|
||||||
|
conversationId : this.id,
|
||||||
|
type : 'outgoing',
|
||||||
|
sent_at : now,
|
||||||
|
received_at : now,
|
||||||
|
group_update : {
|
||||||
|
name: group.get('name'),
|
||||||
|
avatar: group.get('avatar'),
|
||||||
|
joined: group.get('members')
|
||||||
|
}
|
||||||
|
}).save();
|
||||||
textsecure.messaging.updateGroup(
|
textsecure.messaging.updateGroup(
|
||||||
group.id,
|
group.id,
|
||||||
group.get('name'),
|
group.get('name'),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue