GroupsV2: Better group invite behavior
This commit is contained in:
parent
b9ff4f07d3
commit
d51a0b5ece
24 changed files with 1408 additions and 313 deletions
|
@ -237,18 +237,21 @@ function applyMessageRequestState(
|
|||
record: MessageRequestCapableRecord,
|
||||
conversation: ConversationModel
|
||||
): void {
|
||||
const messageRequestEnum =
|
||||
window.textsecure.protobuf.SyncMessage.MessageRequestResponse.Type;
|
||||
|
||||
if (record.blocked) {
|
||||
conversation.applyMessageRequestResponse(
|
||||
conversation.messageRequestEnum.BLOCK,
|
||||
{ fromSync: true, viaStorageServiceSync: true }
|
||||
);
|
||||
conversation.applyMessageRequestResponse(messageRequestEnum.BLOCK, {
|
||||
fromSync: true,
|
||||
viaStorageServiceSync: true,
|
||||
});
|
||||
} else if (record.whitelisted) {
|
||||
// unblocking is also handled by this function which is why the next
|
||||
// condition is part of the else-if and not separate
|
||||
conversation.applyMessageRequestResponse(
|
||||
conversation.messageRequestEnum.ACCEPT,
|
||||
{ fromSync: true, viaStorageServiceSync: true }
|
||||
);
|
||||
conversation.applyMessageRequestResponse(messageRequestEnum.ACCEPT, {
|
||||
fromSync: true,
|
||||
viaStorageServiceSync: true,
|
||||
});
|
||||
} else if (!record.blocked) {
|
||||
// if the condition above failed the state could still be blocked=false
|
||||
// in which case we should unblock the conversation
|
||||
|
@ -408,8 +411,9 @@ export async function mergeGroupV2Record(
|
|||
|
||||
const now = Date.now();
|
||||
const conversationId = window.ConversationController.ensureGroup(groupId, {
|
||||
// We want this conversation to show in the left pane when we first learn about it
|
||||
active_at: now,
|
||||
// Note: We don't set active_at, because we don't want the group to show until
|
||||
// we have information about it beyond these initial details.
|
||||
// see maybeUpdateGroup().
|
||||
timestamp: now,
|
||||
// Basic GroupV2 data
|
||||
groupVersion: 2,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue