From 152e2402fa93970ab70fe029e53573c6115a8300 Mon Sep 17 00:00:00 2001 From: richjohnrambo Date: Tue, 15 Sep 2026 15:28:00 +0800 Subject: [PATCH] fix: allow members to query own group mute --- server/db/mysql/tenant_groups.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/server/db/mysql/tenant_groups.go b/server/db/mysql/tenant_groups.go index f6aa82e..7d9670a 100644 --- a/server/db/mysql/tenant_groups.go +++ b/server/db/mysql/tenant_groups.go @@ -930,6 +930,24 @@ func (a *adapter) TenantGroupMuteList(id t.TenantID, topic, cursor string, limit return items, next, rows.Err() } +func (a *adapter) TenantGroupMuteGet(id t.TenantID, topic string, uid t.Uid) (*t.GroupMute, error) { + if tenantAdp, err := a.routeGroupTenant(id); err != nil { + return nil, err + } else if tenantAdp != a { + return tenantAdp.TenantGroupMuteGet(id, topic, uid) + } + if topic == "" || uid.IsZero() { + return nil, t.ErrMalformed + } + now := time.Now().UTC() + ctx, cancel := a.getContext() + if cancel != nil { + defer cancel() + } + return a.groupMuteByQuery(ctx, "SELECT "+groupMuteSelectColumns+" FROM im_group_mutes WHERE topic=? AND user_id=? AND status=? AND (expires_at IS NULL OR expires_at>?)", + topic, decodeUID(uid), t.GroupMuteStatusActive, now) +} + func (a *adapter) TenantGroupMuteUpsert(id t.TenantID, mute *t.GroupMute) (*t.GroupMute, error) { if tenantAdp, err := a.routeGroupTenant(id); err != nil { return nil, err