Use MessageController whenever we create a new Message
This commit is contained in:
parent
7f958b0ff0
commit
adf21985c1
1 changed files with 21 additions and 15 deletions
|
@ -613,14 +613,15 @@
|
|||
const id = await window.Signal.Data.saveMessage(message, {
|
||||
Message: Whisper.Message,
|
||||
});
|
||||
|
||||
this.trigger(
|
||||
'newmessage',
|
||||
const model = MessageController.register(
|
||||
id,
|
||||
new Whisper.Message({
|
||||
...message,
|
||||
id,
|
||||
})
|
||||
);
|
||||
|
||||
this.trigger('newmessage', model);
|
||||
},
|
||||
async addVerifiedChange(verifiedChangeId, verified, providedOptions) {
|
||||
const options = providedOptions || {};
|
||||
|
@ -657,15 +658,16 @@
|
|||
const id = await window.Signal.Data.saveMessage(message, {
|
||||
Message: Whisper.Message,
|
||||
});
|
||||
|
||||
this.trigger(
|
||||
'newmessage',
|
||||
const model = MessageController.register(
|
||||
id,
|
||||
new Whisper.Message({
|
||||
...message,
|
||||
id,
|
||||
})
|
||||
);
|
||||
|
||||
this.trigger('newmessage', model);
|
||||
|
||||
if (this.isPrivate()) {
|
||||
ConversationController.getAllGroupsInvolvingId(this.id).then(groups => {
|
||||
_.forEach(groups, group => {
|
||||
|
@ -1278,7 +1280,7 @@
|
|||
Conversation: Whisper.Conversation,
|
||||
});
|
||||
|
||||
const message = this.messageCollection.add({
|
||||
const model = new Whisper.Message({
|
||||
// Even though this isn't reflected to the user, we want to place the last seen
|
||||
// indicator above it. We set it to 'unread' to trigger that placement.
|
||||
unread: 1,
|
||||
|
@ -1294,17 +1296,21 @@
|
|||
fromGroupUpdate: options.fromGroupUpdate,
|
||||
},
|
||||
});
|
||||
if (this.isPrivate()) {
|
||||
message.set({ destination: this.id });
|
||||
}
|
||||
if (message.isOutgoing()) {
|
||||
message.set({ recipients: this.getRecipients() });
|
||||
}
|
||||
|
||||
const id = await window.Signal.Data.saveMessage(message.attributes, {
|
||||
if (this.isPrivate()) {
|
||||
model.set({ destination: this.id });
|
||||
}
|
||||
if (model.isOutgoing()) {
|
||||
model.set({ recipients: this.getRecipients() });
|
||||
}
|
||||
const id = await window.Signal.Data.saveMessage(model.attributes, {
|
||||
Message: Whisper.Message,
|
||||
});
|
||||
message.set({ id });
|
||||
|
||||
model.set({ id });
|
||||
|
||||
const message = MessageController.register(id, model);
|
||||
this.messageCollection.add(message);
|
||||
|
||||
// if change was made remotely, don't send it to the number/group
|
||||
if (receivedAt) {
|
||||
|
|
Loading…
Reference in a new issue