diff options
author | Amine Hilaly <hilalyamine@gmail.com> | 2019-03-31 22:32:35 +0200 |
---|---|---|
committer | Amine Hilaly <hilalyamine@gmail.com> | 2019-04-04 00:37:57 +0200 |
commit | 2a5fbc4dc988d2eea76fe5e844ccf6425f9386ee (patch) | |
tree | 8e5125a64ff3d54fa304ae758ddbbcc427b368af /cache/bug_excerpt.go | |
parent | 5b0a92dea43f467f31a65a6f02e937d285cb0a71 (diff) | |
download | git-bug-2a5fbc4dc988d2eea76fe5e844ccf6425f9386ee.tar.gz |
Expose actors and participants in snapshot and bug excerpt
Append operations authors to each list on Apply() call
Expose actors and participants in graphql
Add actor/participant query filter and documentation
Diffstat (limited to 'cache/bug_excerpt.go')
-rw-r--r-- | cache/bug_excerpt.go | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/cache/bug_excerpt.go b/cache/bug_excerpt.go index a50d8c66..d78def4e 100644 --- a/cache/bug_excerpt.go +++ b/cache/bug_excerpt.go @@ -23,10 +23,12 @@ type BugExcerpt struct { CreateUnixTime int64 EditUnixTime int64 - Status bug.Status - Labels []bug.Label - Title string - LenComments int + Status bug.Status + Labels []bug.Label + Title string + LenComments int + Actors []string + Participants []string // If author is identity.Bare, LegacyAuthor is set // If author is identity.Identity, AuthorId is set and data is deported @@ -44,6 +46,16 @@ type LegacyAuthorExcerpt struct { } func NewBugExcerpt(b bug.Interface, snap *bug.Snapshot) *BugExcerpt { + participantsIds := make([]string, len(snap.Participants)) + for i, participant := range snap.Participants { + participantsIds[i] = participant.Id() + } + + actorsIds := make([]string, len(snap.Actors)) + for i, actor := range snap.Actors { + actorsIds[i] = actor.Id() + } + e := &BugExcerpt{ Id: b.Id(), CreateLamportTime: b.CreateLamportTime(), @@ -52,6 +64,8 @@ func NewBugExcerpt(b bug.Interface, snap *bug.Snapshot) *BugExcerpt { EditUnixTime: snap.LastEditUnix(), Status: snap.Status, Labels: snap.Labels, + Actors: actorsIds, + Participants: participantsIds, Title: snap.Title, LenComments: len(snap.Comments), CreateMetadata: b.FirstOp().AllMetadata(), |