GroupV2: Add 'you were invited' to timeline after link

This commit is contained in:
Scott Nonnenberg 2020-11-10 07:15:37 -08:00 committed by GitHub
parent 957a1e0d07
commit 4ef4aebf85
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 17 additions and 15 deletions

View File

@ -1259,7 +1259,23 @@ function extractDiffs({
// Here we hardcode initial messages if this is our first time processing data this
// group. Ideally we can collapse it down to just one of: 'you were added',
// 'you were invited', or 'you created.'
if (firstUpdate && dropInitialJoinMessage) {
if (firstUpdate && ourConversationId && areWeInvitedToGroup) {
// Note, we will add 'you were invited' to group even if dropInitialJoinMessage = true
message = {
...generateBasicMessage(),
type: 'group-v2-change',
groupV2Change: {
from: whoInvitedUsUserId || sourceConversationId,
details: [
{
type: 'pending-add-one',
conversationId: ourConversationId,
},
],
},
};
} else if (firstUpdate && dropInitialJoinMessage) {
// None of the rest of the messages should be added if dropInitialJoinMessage = true
message = undefined;
} else if (
firstUpdate &&
@ -1279,20 +1295,6 @@ function extractDiffs({
],
},
};
} else if (firstUpdate && ourConversationId && areWeInvitedToGroup) {
message = {
...generateBasicMessage(),
type: 'group-v2-change',
groupV2Change: {
from: whoInvitedUsUserId || sourceConversationId,
details: [
{
type: 'pending-add-one',
conversationId: ourConversationId,
},
],
},
};
} else if (firstUpdate && ourConversationId && areWeInGroup) {
message = {
...generateBasicMessage(),