fix(team): mark permission_request inbox messages as read after scan
Restored markInboxMessagesRead for permission_request messages in the early scan. Without this, processed permission_request messages stayed read=false forever, potentially showing stale unread indicators in UI.
This commit is contained in:
parent
e431cfd02c
commit
ccd11a5eb0
1 changed files with 10 additions and 0 deletions
|
|
@ -4042,12 +4042,22 @@ export class TeamProvisioningService {
|
||||||
const leadName = config.members?.find((m) => isLeadMember(m))?.name?.trim() || 'team-lead';
|
const leadName = config.members?.find((m) => isLeadMember(m))?.name?.trim() || 'team-lead';
|
||||||
try {
|
try {
|
||||||
const leadInboxMessages = await this.inboxReader.getMessagesFor(teamName, leadName);
|
const leadInboxMessages = await this.inboxReader.getMessagesFor(teamName, leadName);
|
||||||
|
const permMsgsToMarkRead: { messageId: string }[] = [];
|
||||||
for (const msg of leadInboxMessages) {
|
for (const msg of leadInboxMessages) {
|
||||||
if (typeof msg.text !== 'string') continue;
|
if (typeof msg.text !== 'string') continue;
|
||||||
const perm = parsePermissionRequest(msg.text);
|
const perm = parsePermissionRequest(msg.text);
|
||||||
if (!perm) continue;
|
if (!perm) continue;
|
||||||
// Dedup is handled inside handleTeammatePermissionRequest via processedPermissionRequestIds
|
// Dedup is handled inside handleTeammatePermissionRequest via processedPermissionRequestIds
|
||||||
this.handleTeammatePermissionRequest(run, perm, msg.timestamp);
|
this.handleTeammatePermissionRequest(run, perm, msg.timestamp);
|
||||||
|
// Mark unread permission_request messages as read to prevent stale unread indicators
|
||||||
|
if (!msg.read && this.hasStableMessageId(msg)) {
|
||||||
|
permMsgsToMarkRead.push({ messageId: msg.messageId });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (permMsgsToMarkRead.length > 0) {
|
||||||
|
await this.markInboxMessagesRead(teamName, leadName, permMsgsToMarkRead).catch(
|
||||||
|
() => {}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
} catch {
|
} catch {
|
||||||
// best-effort — inbox may not exist yet
|
// best-effort — inbox may not exist yet
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue