fix(server): 修复群组权限缓存与解散群问题

1. 新增group事件处理逻辑,实时刷新内存中的群组权限与状态
2. 加载topic时过滤已解散的群组,防止被旧成员恢复
3. 补充群成员离开事件的用户ID字段,完善事件处理
This commit is contained in:
Austin
2026-09-15 15:18:14 +08:00
parent 5dd0a42002
commit 55afd976c9
4 changed files with 217 additions and 0 deletions
+8
View File
@@ -1743,6 +1743,11 @@ func (groupBusinessMapper) Dissolve(tenantID types.TenantID, topic string, actor
invalidateGroupMemberPages(tenantID, topic)
invalidateGroupMemberObjects(tenantID, topic)
invalidateTopicSubscriptions(tenantID, topic)
// The dissolve flips im_topics.state to StateDeleted. The cached topic
// object must be dropped too, otherwise a later Topics.Get (e.g. from
// initTopicGrp when a former member re-subscribes) would restore the
// dissolved group from the stale cache.
_ = DeleteCachedObject(tenantID, cacheNamespaceTopic, strings.TrimSpace(topic))
}
return settings, err
}
@@ -2132,6 +2137,9 @@ func (groupBusinessMapper) TransferOwner(tenantID types.TenantID, topic string,
_ = DeleteCachedObject(tenantID, cacheNamespaceSub, subscriptionCacheID(topic, uid, false))
_ = DeleteCachedObject(tenantID, cacheNamespaceSub, subscriptionCacheID(topic, uid, true))
}
// im_topics.owner is updated by the transfer; drop the cached topic
// object so a later Topics.Get sees the new owner.
_ = DeleteCachedObject(tenantID, cacheNamespaceTopic, topic)
invalidateGroupMemberPages(tenantID, topic)
return nil
}