forked from tangled.org/core
Monorepo for Tangled — https://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
···
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 {