Did group leave or did not leave? hm?

This commit is contained in:
Natsumi
2025-11-05 02:36:06 +11:00
parent c930739491
commit f5b29ea775
2 changed files with 17 additions and 14 deletions
+1 -2
View File
@@ -423,8 +423,7 @@ function handlePipeline(args) {
break; break;
case 'group-left': case 'group-left':
// var groupId = content.groupId; groupStore.onGroupLeft(content.groupId);
// $app.onGroupLeft(groupId);
break; break;
case 'group-role-updated': case 'group-role-updated':
+16 -12
View File
@@ -344,22 +344,25 @@ export const useGroupStore = defineStore('Group', () => {
* *
* @param {string} groupId * @param {string} groupId
*/ */
function onGroupLeft(groupId) { async function onGroupLeft(groupId) {
const args = await groupRequest.getGroup({ groupId });
const ref = applyGroup(args.json);
if (ref.membershipStatus === 'member') {
// wtf, not trusting presence
console.error(
`onGroupLeft: presence lied, still a member of ${groupId}`
);
return;
}
if (groupDialog.value.visible && groupDialog.value.id === groupId) { if (groupDialog.value.visible && groupDialog.value.id === groupId) {
showGroupDialog(groupId); showGroupDialog(groupId);
} }
if (currentUserGroups.has(groupId)) { if (currentUserGroups.has(groupId)) {
currentUserGroups.delete(groupId); currentUserGroups.delete(groupId);
groupRequest.getCachedGroup({ groupId }).then((args) => { groupChange(ref, 'Left group');
if (args.ref?.ownerId === userStore.currentUser.id) {
// Issue #1455 // delay to wait for json to be assigned to ref
console.log( workerTimers.setTimeout(saveCurrentUserGroups, 100);
`Not sending left group notification for owned group ${groupId}`
);
return;
}
groupChange(args.ref, 'Left group');
});
} }
} }
@@ -1096,6 +1099,7 @@ export const useGroupStore = defineStore('Group', () => {
handleGroupList, handleGroupList,
handleGroupRepresented, handleGroupRepresented,
showModerateGroupDialog, showModerateGroupDialog,
showGroupMemberModerationDialog showGroupMemberModerationDialog,
onGroupLeft
}; };
}); });