From 7405277f27d1afb886b68b3ee04baefd2b2da1ac Mon Sep 17 00:00:00 2001 From: richjohnrambo Date: Thu, 24 Sep 2026 16:47:19 +0800 Subject: [PATCH] fix: omit admin-only actions from group notices --- docs/IM-前后端对接文档.md | 6 +++--- docs/对接文档最新/IM-前后端对接文档.md | 6 +++--- server/im_http.go | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/IM-前后端对接文档.md b/docs/IM-前后端对接文档.md index 0190267..4e51bae 100644 --- a/docs/IM-前后端对接文档.md +++ b/docs/IM-前后端对接文档.md @@ -362,7 +362,7 @@ X-MeetingIM-APIKey: <预置的普通 API Key> | 类型 | 适用场景 | 服务端下行示例 | 客户端渲染 | | --- | --- | --- | --- | | `system_notice` | “你已添加了安妮,现在可以开始聊天了”、撤回提示、群名修改、成员进出群等纯提示 | `{"data":{"topic":"p2p...","seq":19,"from":"","head":{"x-im-schema":1,"x-im-type":"system_notice","x-im-template":"friend_added","x-im-from":"system"},"content":{"text":"你已添加了安妮,现在可以开始聊天了。","level":"normal","template":"friend_added","actors":[{"user_id":"usr_anne","name":"安妮"}],"actions":[]}}}` | 居中灰色提示;不显示发送人头像;如 `actors.click` 为空则不可点 | -| `system_action` | 群邀请确认说明、审批入口、群设置入口、可点击人名或群名提示 | `{"data":{"topic":"grp...","seq":20,"from":"","head":{"x-im-schema":1,"x-im-type":"system_action","x-im-template":"group_invite_confirm_enabled","x-im-from":"system"},"content":{"text":"安妮邀请栗子来了加入了群聊","template":"group_invite_confirm_enabled","actors":[{"user_id":"usr_anne","name":"安妮","click":{"type":"user_profile","target_id":"usr_anne"}},{"user_id":"usr_lizi","name":"栗子来了","click":{"type":"user_profile","target_id":"usr_lizi"}}],"actions":[{"type":"open_group_invite_settings","label":"群聊邀请确认","target_id":"grp..."}]}}}` | 居中灰色或业务提示样式;可点击片段按 `actors.click` 高亮;按钮或文字入口按 `actions` 渲染 | +| `system_action` | 审批入口、群设置入口、可点击人名或群名提示;仅在当前消息对所有接收者都可操作时下发 `actions` | `{"data":{"topic":"grp...","seq":20,"from":"","head":{"x-im-schema":1,"x-im-type":"system_action","x-im-template":"group_member_joined","x-im-from":"system"},"content":{"text":"安妮邀请栗子来了加入了群聊","template":"group_member_joined","actors":[{"user_id":"usr_anne","name":"安妮","click":{"type":"user_profile","target_id":"usr_anne"}},{"user_id":"usr_lizi","name":"栗子来了","click":{"type":"user_profile","target_id":"usr_lizi"}}],"actions":[]}}}` | 居中灰色或业务提示样式;可点击片段按 `actors.click` 高亮;按钮或文字入口按 `actions` 渲染。若 `actions` 为空,不得将普通文案渲染为可点击入口 | `content` 字段约定: @@ -372,7 +372,7 @@ X-MeetingIM-APIKey: <预置的普通 API Key> | `template` | string | 是 | 服务端稳定模板编码,例如 `friend_added`、`group_member_joined`、`group_invite_confirm_enabled` | | `level` | string | 否 | `normal`、`warning`、`danger`,影响颜色和强调程度 | | `actors` | array | 否 | 文案中的用户、群、文件等实体;支持局部高亮和点击 | -| `actions` | array | 否 | 当前消息可触发的操作入口;只允许客户端白名单动作 | +| `actions` | array | 否 | 当前消息可触发的操作入口;只允许客户端白名单动作。群邀请确认开关、全员禁言开关、成员私信权限开关等设置变更公告面向全员广播,服务端不下发仅管理员可操作的 `actions`;客户端不得仅凭模板名高亮入口。若历史消息或兼容字段携带 `min_role`,客户端必须按当前成员角色过滤,角色不足时忽略该 action | | `extra` | object | 否 | 模板扩展参数;客户端不得依赖未知字段完成关键流程 | `actors[].click` 和 `actions[]` 的 `type` 首版白名单: @@ -381,7 +381,7 @@ X-MeetingIM-APIKey: <预置的普通 API Key> | --- | --- | --- | | `user_profile` | `target_id` | 打开用户资料页 | | `group_profile` | `target_id` | 打开群资料页 | -| `open_group_invite_settings` | `target_id` | 打开群邀请确认设置 | +| `open_group_invite_settings` | `target_id` | 打开群邀请确认设置;仅用于明确发给管理员/群主或全员都可执行的入口,不用于全员广播的开关结果公告 | | `open_group_join_requests` | `target_id` | 打开群入群审批列表 | | `open_message` | `topic,seq` | 定位到指定消息 | diff --git a/docs/对接文档最新/IM-前后端对接文档.md b/docs/对接文档最新/IM-前后端对接文档.md index 5c16ab1..f85d404 100644 --- a/docs/对接文档最新/IM-前后端对接文档.md +++ b/docs/对接文档最新/IM-前后端对接文档.md @@ -323,7 +323,7 @@ X-MeetingIM-APIKey: <预置的普通 API Key> | 类型 | 适用场景 | 服务端下行示例 | 客户端渲染 | | --- | --- | --- | --- | | `system_notice` | “你已添加了安妮,现在可以开始聊天了”、撤回提示、群名修改、成员进出群等纯提示 | `{"data":{"topic":"p2p...","seq":19,"from":"","head":{"x-im-schema":1,"x-im-type":"system_notice","x-im-template":"friend_added","x-im-from":"system"},"content":{"text":"你已添加了安妮,现在可以开始聊天了。","level":"normal","template":"friend_added","actors":[{"user_id":"usr_anne","name":"安妮"}],"actions":[]}}}` | 居中灰色提示;不显示发送人头像;如 `actors.click` 为空则不可点 | -| `system_action` | 群邀请确认说明、审批入口、群设置入口、可点击人名或群名提示 | `{"data":{"topic":"grp...","seq":20,"from":"","head":{"x-im-schema":1,"x-im-type":"system_action","x-im-template":"group_invite_confirm_enabled","x-im-from":"system"},"content":{"text":"安妮邀请栗子来了加入了群聊","template":"group_invite_confirm_enabled","actors":[{"user_id":"usr_anne","name":"安妮","click":{"type":"user_profile","target_id":"usr_anne"}},{"user_id":"usr_lizi","name":"栗子来了","click":{"type":"user_profile","target_id":"usr_lizi"}}],"actions":[{"type":"open_group_invite_settings","label":"群聊邀请确认","target_id":"grp..."}]}}}` | 居中灰色或业务提示样式;可点击片段按 `actors.click` 高亮;按钮或文字入口按 `actions` 渲染 | +| `system_action` | 审批入口、群设置入口、可点击人名或群名提示;仅在当前消息对所有接收者都可操作时下发 `actions` | `{"data":{"topic":"grp...","seq":20,"from":"","head":{"x-im-schema":1,"x-im-type":"system_action","x-im-template":"group_member_joined","x-im-from":"system"},"content":{"text":"安妮邀请栗子来了加入了群聊","template":"group_member_joined","actors":[{"user_id":"usr_anne","name":"安妮","click":{"type":"user_profile","target_id":"usr_anne"}},{"user_id":"usr_lizi","name":"栗子来了","click":{"type":"user_profile","target_id":"usr_lizi"}}],"actions":[]}}}` | 居中灰色或业务提示样式;可点击片段按 `actors.click` 高亮;按钮或文字入口按 `actions` 渲染。若 `actions` 为空,不得将普通文案渲染为可点击入口 | `content` 字段约定: @@ -333,7 +333,7 @@ X-MeetingIM-APIKey: <预置的普通 API Key> | `template` | string | 是 | 服务端稳定模板编码,例如 `friend_added`、`group_member_joined`、`group_invite_confirm_enabled` | | `level` | string | 否 | `normal`、`warning`、`danger`,影响颜色和强调程度 | | `actors` | array | 否 | 文案中的用户、群、文件等实体;支持局部高亮和点击 | -| `actions` | array | 否 | 当前消息可触发的操作入口;只允许客户端白名单动作 | +| `actions` | array | 否 | 当前消息可触发的操作入口;只允许客户端白名单动作。群邀请确认开关、全员禁言开关、成员私信权限开关等设置变更公告面向全员广播,服务端不下发仅管理员可操作的 `actions`;客户端不得仅凭模板名高亮入口。若历史消息或兼容字段携带 `min_role`,客户端必须按当前成员角色过滤,角色不足时忽略该 action | | `extra` | object | 否 | 模板扩展参数;客户端不得依赖未知字段完成关键流程 | `actors[].click` 和 `actions[]` 的 `type` 首版白名单: @@ -342,7 +342,7 @@ X-MeetingIM-APIKey: <预置的普通 API Key> | --- | --- | --- | | `user_profile` | `target_id` | 打开用户资料页 | | `group_profile` | `target_id` | 打开群资料页 | -| `open_group_invite_settings` | `target_id` | 打开群邀请确认设置 | +| `open_group_invite_settings` | `target_id` | 打开群邀请确认设置;仅用于明确发给管理员/群主或全员都可执行的入口,不用于全员广播的开关结果公告 | | `open_group_join_requests` | `target_id` | 打开群入群审批列表 | | `open_message` | `topic,seq` | 定位到指定消息 | diff --git a/server/im_http.go b/server/im_http.go index 55c1391..5034c73 100644 --- a/server/im_http.go +++ b/server/im_http.go @@ -5451,11 +5451,11 @@ func serveIMGroupGovernance(wrt http.ResponseWriter, req *http.Request, topic st text = "群聊邀请确认已启用,群成员邀请好友进群需要群主或管理员确认。" } publishIMConversationSystemNotice(principal.TenantID, topic, - "system_action", template, text, + "system_notice", template, text, []imSystemMessageActor{ {UserID: principal.Uid.UserId(), Click: map[string]any{"type": "user_profile", "target_id": principal.Uid.UserId()}}, }, - []imSystemMessageAction{{Type: "open_group_invite_settings", Label: "群聊邀请确认", TargetID: topic, MinRole: "admin"}}, + nil, map[string]any{"join_approval": *body.JoinApproval, "version": settings.Version}) } if body.MemberPrivateChat != nil && imReliableHTTPEventsEnabled(req) {