fix: groupv2 control message join/remove are now correctly used

pull/3052/head
Audric Ackermann 6 months ago
parent 9c098ff3a8
commit 6c945a173d
No known key found for this signature in database

@ -32,7 +32,7 @@ export function getKickedGroupUpdateStr(
switch (othersNames.length) { switch (othersNames.length) {
case 0: case 0:
return { token: 'groupUpdated' } return { token: 'groupUpdated' };
case 1: case 1:
return { token: 'groupRemoved', args: { name: othersNames[0] } }; return { token: 'groupRemoved', args: { name: othersNames[0] } };
case 2: case 2:
@ -88,7 +88,7 @@ export function getJoinedGroupUpdateChangeStr(
case 1: case 1:
return addedWithHistory return addedWithHistory
? { token: 'groupMemberNewYouHistoryTwo', args: { name: othersNames[0] } } ? { token: 'groupMemberNewYouHistoryTwo', args: { name: othersNames[0] } }
: { token: 'legacyGroupMemberNewYouOther', args: { other_name: othersNames[0] } }; : { token: 'groupInviteYouAndOtherNew', args: { other_name: othersNames[0] } };
default: default:
return addedWithHistory return addedWithHistory
? { token: 'groupMemberNewYouHistoryMultiple', args: { count: othersNames.length } } ? { token: 'groupMemberNewYouHistoryMultiple', args: { count: othersNames.length } }
@ -97,11 +97,15 @@ export function getJoinedGroupUpdateChangeStr(
} }
switch (othersNames.length) { switch (othersNames.length) {
case 0: case 0:
return { token: addedWithHistory ? 'groupInviteYouHistory' : 'groupInviteYou' }; return { token: 'groupUpdated' }; // this is an invalid case, but well.
case 1: case 1:
return addedWithHistory return addedWithHistory
? { token: 'groupMemberNewYouHistoryTwo', args: { name: othersNames[0] } } ? { token: 'groupMemberNewHistory', args: { name: othersNames[0] } }
: { token: 'legacyGroupMemberNewYouOther', args: { other_name: othersNames[0] } }; : { token: 'groupMemberNew', args: { name: othersNames[0] } };
case 2:
return addedWithHistory
? { token: 'groupMemberNewHistoryTwo', args: { name: othersNames[0], other_name: othersNames[1] } }
: { token: 'groupMemberNewTwo', args: { name: othersNames[0], other_name: othersNames[1] } };
default: default:
return addedWithHistory return addedWithHistory
? { ? {
@ -115,6 +119,7 @@ export function getJoinedGroupUpdateChangeStr(
} }
} }
// legacy groups
if (us) { if (us) {
switch (othersNames.length) { switch (othersNames.length) {
case 0: case 0:
@ -127,7 +132,7 @@ export function getJoinedGroupUpdateChangeStr(
} }
switch (othersNames.length) { switch (othersNames.length) {
case 0: case 0:
return { token: 'groupUpdated' } return { token: 'groupUpdated' };
case 1: case 1:
return { token: 'legacyGroupMemberNew', args: { name: othersNames[0] } }; return { token: 'legacyGroupMemberNew', args: { name: othersNames[0] } };
case 2: case 2:
@ -167,7 +172,7 @@ export function getPromotedGroupUpdateChangeStr(
} }
switch (othersNames.length) { switch (othersNames.length) {
case 0: case 0:
return { token: 'groupUpdated' } return { token: 'groupUpdated' };
case 1: case 1:
return { token: 'adminPromotedToAdmin', args: { name: othersNames[0] } }; return { token: 'adminPromotedToAdmin', args: { name: othersNames[0] } };
case 2: case 2:

Loading…
Cancel
Save