feat: inbox actor tracking, issue detail extraction, UI polish
- Add actor_type/actor_id to inbox items for proper attribution - Extract issue detail into features/issues/components/issue-detail.tsx - Inbox page and store updates for actor-based notifications - Sidebar, layout, and actor-avatar refinements Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
586a4916d1
commit
bc39abc6ed
17 changed files with 203 additions and 85 deletions
|
|
@ -38,18 +38,23 @@ func registerInboxListeners(bus *events.Bus, queries *db.Queries) {
|
|||
IssueID: parseUUID(issue.ID),
|
||||
Title: "New issue assigned: " + issue.Title,
|
||||
Body: util.PtrToText(issue.Description),
|
||||
ActorType: util.StrToText(e.ActorType),
|
||||
ActorID: parseUUID(e.ActorID),
|
||||
})
|
||||
if err != nil {
|
||||
slog.Error("inbox item creation failed", "event", "issue:created", "error", err)
|
||||
return
|
||||
}
|
||||
|
||||
resp := inboxItemToResponse(item)
|
||||
resp["issue_status"] = issue.Status
|
||||
|
||||
bus.Publish(events.Event{
|
||||
Type: protocol.EventInboxNew,
|
||||
WorkspaceID: e.WorkspaceID,
|
||||
ActorType: e.ActorType,
|
||||
ActorID: e.ActorID,
|
||||
Payload: map[string]any{"item": inboxItemToResponse(item)},
|
||||
Payload: map[string]any{"item": resp},
|
||||
})
|
||||
})
|
||||
|
||||
|
|
@ -84,14 +89,18 @@ func registerInboxListeners(bus *events.Bus, queries *db.Queries) {
|
|||
Severity: "info",
|
||||
IssueID: parseUUID(issue.ID),
|
||||
Title: "Unassigned from: " + issue.Title,
|
||||
ActorType: util.StrToText(e.ActorType),
|
||||
ActorID: parseUUID(e.ActorID),
|
||||
})
|
||||
if err == nil {
|
||||
oldResp := inboxItemToResponse(oldItem)
|
||||
oldResp["issue_status"] = issue.Status
|
||||
bus.Publish(events.Event{
|
||||
Type: protocol.EventInboxNew,
|
||||
WorkspaceID: e.WorkspaceID,
|
||||
ActorType: e.ActorType,
|
||||
ActorID: actorID,
|
||||
Payload: map[string]any{"item": inboxItemToResponse(oldItem)},
|
||||
Payload: map[string]any{"item": oldResp},
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
@ -106,14 +115,18 @@ func registerInboxListeners(bus *events.Bus, queries *db.Queries) {
|
|||
Severity: "action_required",
|
||||
IssueID: parseUUID(issue.ID),
|
||||
Title: "Assigned to you: " + issue.Title,
|
||||
ActorType: util.StrToText(e.ActorType),
|
||||
ActorID: parseUUID(e.ActorID),
|
||||
})
|
||||
if err == nil {
|
||||
newResp := inboxItemToResponse(newItem)
|
||||
newResp["issue_status"] = issue.Status
|
||||
bus.Publish(events.Event{
|
||||
Type: protocol.EventInboxNew,
|
||||
WorkspaceID: e.WorkspaceID,
|
||||
ActorType: e.ActorType,
|
||||
ActorID: actorID,
|
||||
Payload: map[string]any{"item": inboxItemToResponse(newItem)},
|
||||
Payload: map[string]any{"item": newResp},
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
@ -130,14 +143,18 @@ func registerInboxListeners(bus *events.Bus, queries *db.Queries) {
|
|||
Severity: "info",
|
||||
IssueID: parseUUID(issue.ID),
|
||||
Title: issue.Title + " moved to " + issue.Status,
|
||||
ActorType: util.StrToText(e.ActorType),
|
||||
ActorID: parseUUID(e.ActorID),
|
||||
})
|
||||
if err == nil {
|
||||
aResp := inboxItemToResponse(aItem)
|
||||
aResp["issue_status"] = issue.Status
|
||||
bus.Publish(events.Event{
|
||||
Type: protocol.EventInboxNew,
|
||||
WorkspaceID: e.WorkspaceID,
|
||||
ActorType: e.ActorType,
|
||||
ActorID: actorID,
|
||||
Payload: map[string]any{"item": inboxItemToResponse(aItem)},
|
||||
Payload: map[string]any{"item": aResp},
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
@ -155,14 +172,18 @@ func registerInboxListeners(bus *events.Bus, queries *db.Queries) {
|
|||
Severity: "info",
|
||||
IssueID: parseUUID(issue.ID),
|
||||
Title: "Status changed: " + issue.Title,
|
||||
ActorType: util.StrToText(e.ActorType),
|
||||
ActorID: parseUUID(e.ActorID),
|
||||
})
|
||||
if err == nil {
|
||||
cResp := inboxItemToResponse(cItem)
|
||||
cResp["issue_status"] = issue.Status
|
||||
bus.Publish(events.Event{
|
||||
Type: protocol.EventInboxNew,
|
||||
WorkspaceID: e.WorkspaceID,
|
||||
ActorType: e.ActorType,
|
||||
ActorID: actorID,
|
||||
Payload: map[string]any{"item": inboxItemToResponse(cItem)},
|
||||
Payload: map[string]any{"item": cResp},
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
@ -183,6 +204,7 @@ func registerInboxListeners(bus *events.Bus, queries *db.Queries) {
|
|||
issueTitle, _ := payload["issue_title"].(string)
|
||||
issueAssigneeType, _ := payload["issue_assignee_type"].(*string)
|
||||
issueAssigneeID, _ := payload["issue_assignee_id"].(*string)
|
||||
issueStatus, _ := payload["issue_status"].(string)
|
||||
|
||||
// Only notify if assignee is a member and is not the commenter
|
||||
if issueAssigneeType == nil || issueAssigneeID == nil {
|
||||
|
|
@ -201,18 +223,23 @@ func registerInboxListeners(bus *events.Bus, queries *db.Queries) {
|
|||
IssueID: parseUUID(comment.IssueID),
|
||||
Title: "New comment on: " + issueTitle,
|
||||
Body: util.StrToText(comment.Content),
|
||||
ActorType: util.StrToText(e.ActorType),
|
||||
ActorID: parseUUID(e.ActorID),
|
||||
})
|
||||
if err != nil {
|
||||
slog.Error("inbox item creation failed", "event", "comment:created", "error", err)
|
||||
return
|
||||
}
|
||||
|
||||
commentResp := inboxItemToResponse(item)
|
||||
commentResp["issue_status"] = issueStatus
|
||||
|
||||
bus.Publish(events.Event{
|
||||
Type: protocol.EventInboxNew,
|
||||
WorkspaceID: e.WorkspaceID,
|
||||
ActorType: e.ActorType,
|
||||
ActorID: e.ActorID,
|
||||
Payload: map[string]any{"item": inboxItemToResponse(item)},
|
||||
Payload: map[string]any{"item": commentResp},
|
||||
})
|
||||
})
|
||||
}
|
||||
|
|
@ -233,5 +260,7 @@ func inboxItemToResponse(item db.InboxItem) map[string]any {
|
|||
"read": item.Read,
|
||||
"archived": item.Archived,
|
||||
"created_at": util.TimestampToString(item.CreatedAt),
|
||||
"actor_type": util.TextToPtr(item.ActorType),
|
||||
"actor_id": util.UUIDToPtr(item.ActorID),
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue