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 /bug/snapshot.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 'bug/snapshot.go')
-rw-r--r-- | bug/snapshot.go | 36 |
1 files changed, 30 insertions, 6 deletions
diff --git a/bug/snapshot.go b/bug/snapshot.go index 83b94416..53f6873a 100644 --- a/bug/snapshot.go +++ b/bug/snapshot.go @@ -12,12 +12,14 @@ import ( type Snapshot struct { id string - Status Status - Title string - Comments []Comment - Labels []Label - Author identity.Interface - CreatedAt time.Time + Status Status + Title string + Comments []Comment + Labels []Label + Author identity.Interface + Actors []identity.Interface + Participants []identity.Interface + CreatedAt time.Time Timeline []TimelineItem @@ -62,3 +64,25 @@ func (snap *Snapshot) SearchTimelineItem(hash git.Hash) (TimelineItem, error) { return nil, fmt.Errorf("timeline item not found") } + +// append the operation author to the actors list +func (snap *Snapshot) addActor(actor identity.Interface) { + for _, a := range snap.Actors { + if actor.Id() == a.Id() { + return + } + } + + snap.Actors = append(snap.Actors, actor) +} + +// append the operation author to the participants list +func (snap *Snapshot) addParticipant(participant identity.Interface) { + for _, p := range snap.Participants { + if participant.Id() == p.Id() { + return + } + } + + snap.Participants = append(snap.Participants, participant) +} |