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';
|
||||
try {
|
||||
const leadInboxMessages = await this.inboxReader.getMessagesFor(teamName, leadName);
|
||||
const permMsgsToMarkRead: { messageId: string }[] = [];
|
||||
for (const msg of leadInboxMessages) {
|
||||
if (typeof msg.text !== 'string') continue;
|
||||
const perm = parsePermissionRequest(msg.text);
|
||||
if (!perm) continue;
|
||||
// Dedup is handled inside handleTeammatePermissionRequest via processedPermissionRequestIds
|
||||
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 {
|
||||
// best-effort — inbox may not exist yet
|
||||
|
|
|
|||
Loading…
Reference in a new issue