diff options
author | Amine Hilaly <hilalyamine@gmail.com> | 2019-07-17 18:47:13 +0200 |
---|---|---|
committer | Amine Hilaly <hilalyamine@gmail.com> | 2019-07-23 17:18:04 +0200 |
commit | d34eae189c33c6d291cf944e8ddc694c1958e371 (patch) | |
tree | a63ac220ed4c4da5e903a76890462c976a07f050 | |
parent | e012b6c6226a0f4121e036b8829f28f238d87e46 (diff) | |
download | git-bug-d34eae189c33c6d291cf944e8ddc694c1958e371.tar.gz |
bug: add snapshot.SearchComment method
-rw-r--r-- | bug/snapshot.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/bug/snapshot.go b/bug/snapshot.go index 114b1123..f1da8099 100644 --- a/bug/snapshot.go +++ b/bug/snapshot.go @@ -70,6 +70,17 @@ func (snap *Snapshot) SearchTimelineItem(hash git.Hash) (TimelineItem, error) { return nil, fmt.Errorf("timeline item not found") } +// SearchComment will search for a comment matching the given hash +func (snap *Snapshot) SearchComment(hash git.Hash) (*Comment, error) { + for _, c := range snap.Comments { + if c.id == hash.String() { + return &c, nil + } + } + + return nil, fmt.Errorf("comment item not found") +} + // append the operation author to the actors list func (snap *Snapshot) addActor(actor identity.Interface) { for _, a := range snap.Actors { |