fix: allow members to query own group mute
This commit is contained in:
@@ -930,6 +930,24 @@ func (a *adapter) TenantGroupMuteList(id t.TenantID, topic, cursor string, limit
|
|||||||
return items, next, rows.Err()
|
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) {
|
func (a *adapter) TenantGroupMuteUpsert(id t.TenantID, mute *t.GroupMute) (*t.GroupMute, error) {
|
||||||
if tenantAdp, err := a.routeGroupTenant(id); err != nil {
|
if tenantAdp, err := a.routeGroupTenant(id); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|||||||
Reference in New Issue
Block a user