Monorepo for Tangled tangled.org

appview/db: add helper to fetch set of participants in an issue

Signed-off-by: oppiliappan <me@oppi.li>

oppi.li e1a08c7b d208d22e

verified
Changed files
+20
appview
+20
appview/db/issues.go
··· 103 103 return listing 104 104 } 105 105 106 + func (i *Issue) Participants() []string { 107 + participantSet := make(map[string]struct{}) 108 + participants := []string{} 109 + 110 + addParticipant := func(did string) { 111 + if _, exists := participantSet[did]; !exists { 112 + participantSet[did] = struct{}{} 113 + participants = append(participants, did) 114 + } 115 + } 116 + 117 + addParticipant(i.Did) 118 + 119 + for _, c := range i.Comments { 120 + addParticipant(c.Did) 121 + } 122 + 123 + return participants 124 + } 125 + 106 126 func IssueFromRecord(did, rkey string, record tangled.RepoIssue) Issue { 107 127 created, err := time.Parse(time.RFC3339, record.CreatedAt) 108 128 if err != nil {