From e1a08c7ba78e28d7add5b8c65e0d6c287d86f1ab Mon Sep 17 00:00:00 2001 From: oppiliappan Date: Mon, 15 Sep 2025 10:13:06 +0100 Subject: [PATCH] appview/db: add helper to fetch set of participants in an issue Signed-off-by: oppiliappan --- appview/db/issues.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/appview/db/issues.go b/appview/db/issues.go index c8f8a029..052ac46b 100644 --- a/appview/db/issues.go +++ b/appview/db/issues.go @@ -103,6 +103,26 @@ func (i *Issue) CommentList() []CommentListItem { return listing } +func (i *Issue) Participants() []string { + participantSet := make(map[string]struct{}) + participants := []string{} + + addParticipant := func(did string) { + if _, exists := participantSet[did]; !exists { + participantSet[did] = struct{}{} + participants = append(participants, did) + } + } + + addParticipant(i.Did) + + for _, c := range i.Comments { + addParticipant(c.Did) + } + + return participants +} + func IssueFromRecord(did, rkey string, record tangled.RepoIssue) Issue { created, err := time.Parse(time.RFC3339, record.CreatedAt) if err != nil { -- 2.51.2