Improved handling of group changes
This commit is contained in:
parent
29de50c12a
commit
47e46e0f43
1 changed files with 30 additions and 0 deletions
|
@ -996,8 +996,17 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
const conversation = ConversationController.get(groupId || sender);
|
const conversation = ConversationController.get(groupId || sender);
|
||||||
|
const ourNumber = textsecure.storage.user.getNumber();
|
||||||
|
|
||||||
if (conversation) {
|
if (conversation) {
|
||||||
|
// We drop typing notifications in groups we're not a part of
|
||||||
|
if (!conversation.isPrivate() && !conversation.hasMember(ourNumber)) {
|
||||||
|
window.log.warn(
|
||||||
|
`Received typing indicator for group ${conversation.idForLogging()}, which we're not a part of. Dropping.`
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
conversation.notifyTyping({
|
conversation.notifyTyping({
|
||||||
isTyping: started,
|
isTyping: started,
|
||||||
sender,
|
sender,
|
||||||
|
@ -1276,10 +1285,31 @@
|
||||||
return event.confirm();
|
return event.confirm();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const ourNumber = textsecure.storage.user.getNumber();
|
||||||
|
const isGroupUpdate =
|
||||||
|
data.message.group &&
|
||||||
|
data.message.group.type !== textsecure.protobuf.GroupContext.Type.DELIVER;
|
||||||
|
const conversation = ConversationController.get(messageDescriptor.id);
|
||||||
|
|
||||||
|
// We drop messages for groups we already know about, which we're not a part of,
|
||||||
|
// except for group updates
|
||||||
|
if (
|
||||||
|
conversation &&
|
||||||
|
!conversation.isPrivate() &&
|
||||||
|
!conversation.hasMember(ourNumber) &&
|
||||||
|
!isGroupUpdate
|
||||||
|
) {
|
||||||
|
window.log.warn(
|
||||||
|
`Received message destined for group ${conversation.idForLogging()}, which we're not a part of. Dropping.`
|
||||||
|
);
|
||||||
|
return event.confirm();
|
||||||
|
}
|
||||||
|
|
||||||
await ConversationController.getOrCreateAndWait(
|
await ConversationController.getOrCreateAndWait(
|
||||||
messageDescriptor.id,
|
messageDescriptor.id,
|
||||||
messageDescriptor.type
|
messageDescriptor.type
|
||||||
);
|
);
|
||||||
|
|
||||||
return message.handleDataMessage(data.message, event.confirm, {
|
return message.handleDataMessage(data.message, event.confirm, {
|
||||||
initialLoadComplete,
|
initialLoadComplete,
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue