feat: show group announcement read count and send read receipts
Backend added read_count/member_count/read_summary to the announcement payload in today's deploy (previously confirmed absent). Wire it up: - groups.ts: add the three fields to the GroupAnnouncement type. - GroupAnnouncementModal.tsx: render "已读N/M" per README §4.8, and call readGroupAnnouncement() on open -- that endpoint existed in groups.ts already but was never called from anywhere, so opening an announcement never told the server this member had read it.
This commit is contained in:
@@ -409,11 +409,15 @@ export function getGroupSummary(topic: string) {
|
||||
|
||||
/** Confirmed live (2026-09-08, real group `grpvrdHqKqkCq0`): `author` is a flat `usr...` id, not
|
||||
* the `published_by` object this file originally guessed -- resolve it against the group's member
|
||||
* list for a display name/role, same as any other bare user id in this API. `read_count`/
|
||||
* `member_count` are confirmed ABSENT from the real response (not just unconfirmed), and when
|
||||
* nothing has been published yet the endpoint still returns `200` with every field zero-valued
|
||||
* (`announcement_id:"", author:"", content:"", published_at:"", version:0`), never `404`/`null` --
|
||||
* callers must check `content` for emptiness, not object existence. */
|
||||
* list for a display name/role, same as any other bare user id in this API. When nothing has been
|
||||
* published yet the endpoint still returns `200` with every field zero-valued (`announcement_id:"",
|
||||
* author:"", content:"", published_at:"", version:0`), never `404`/`null` -- callers must check
|
||||
* `content` for emptiness, not object existence.
|
||||
* `read_count`/`member_count`/`read_summary` were confirmed ABSENT on 2026-09-08 (dropped from this
|
||||
* type entirely, not just left optional) -- backend added them in the 2026-09-18 deploy (confirmed
|
||||
* by reading `groupAnnouncementPayload` in `im_be/server/im_http.go`, which now sets all three).
|
||||
* Optional here because an old cached response (or a tenant not yet on the new deploy) may still
|
||||
* omit them. */
|
||||
export interface GroupAnnouncement {
|
||||
announcement_id: string;
|
||||
topic: string;
|
||||
@@ -422,6 +426,9 @@ export interface GroupAnnouncement {
|
||||
published_at: string;
|
||||
author: string;
|
||||
permissions?: { can_edit?: boolean };
|
||||
read_count?: number;
|
||||
member_count?: number;
|
||||
read_summary?: { read_count: number; member_count: number };
|
||||
}
|
||||
|
||||
export function getLatestGroupAnnouncement(topic: string) {
|
||||
|
||||
Reference in New Issue
Block a user