From d5b958556f00df5b47477e9bf59e252dce746ef3 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 69095123..4fac2f15 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