增加群聊置顶、免打扰和应用内提醒

This commit is contained in:
xhgit committed 2026-11-14 16:00:46 +08:00
1 parent ced6e9030d
commit f54077ce46
17 files changed
+228 -42

No files matched your search

+29
View File
@@ -134,3 +134,32 @@ func (a *API) hintGroupList(ctx context.Context, users []string) {
}
_, _ = pipe.Exec(ctx)
}
func (a *API) setGroupPreferences(w http.ResponseWriter, r *http.Request, _ string, actor account.Identity) {
group := r.PathValue("id")
if !uuidPattern.MatchString(group) {
groupError(w, groups.ErrUnavailable)
return
}
var input struct {
Pinned *bool `json:"pinned"`
Muted *bool `json:"muted"`
}
if !parse(w, r, &input) {
return
}
if input.Pinned == nil && input.Muted == nil {
problem(w, 400, "invalid_group_preferences", "请选择要修改的群设置")
return
}
if !a.limit(w, r, "group-change:"+actor.User.ID, 60) {
return
}
result, err := a.groups.SetPreferences(r.Context(), group, actor.User.ID, actor.Device.ID, input.Pinned, input.Muted)
if err != nil {
groupError(w, err)
return
}
a.hintGroupList(r.Context(), []string{actor.User.ID})
respond(w, 200, result)
}