aboutsummaryrefslogtreecommitdiffstats
path: root/bug/snapshot.go
diff options
context:
space:
mode:
authorAmine Hilaly <hilalyamine@gmail.com>2019-03-31 22:32:35 +0200
committerAmine Hilaly <hilalyamine@gmail.com>2019-04-04 00:37:57 +0200
commit2a5fbc4dc988d2eea76fe5e844ccf6425f9386ee (patch)
tree8e5125a64ff3d54fa304ae758ddbbcc427b368af /bug/snapshot.go
parent5b0a92dea43f467f31a65a6f02e937d285cb0a71 (diff)
downloadgit-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.go36
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)
+}