aboutsummaryrefslogtreecommitdiffstats
path: root/entities/bug/snapshot.go
diff options
context:
space:
mode:
Diffstat (limited to 'entities/bug/snapshot.go')
-rw-r--r--entities/bug/snapshot.go23
1 files changed, 17 insertions, 6 deletions
diff --git a/entities/bug/snapshot.go b/entities/bug/snapshot.go
index 442496f7..333fe207 100644
--- a/entities/bug/snapshot.go
+++ b/entities/bug/snapshot.go
@@ -58,9 +58,9 @@ func (snap *Snapshot) GetCreateMetadata(key string) (string, bool) {
}
// SearchTimelineItem will search in the timeline for an item matching the given hash
-func (snap *Snapshot) SearchTimelineItem(id entity.Id) (TimelineItem, error) {
+func (snap *Snapshot) SearchTimelineItem(id entity.CombinedId) (TimelineItem, error) {
for i := range snap.Timeline {
- if snap.Timeline[i].Id() == id {
+ if snap.Timeline[i].CombinedId() == id {
return snap.Timeline[i], nil
}
}
@@ -68,15 +68,26 @@ func (snap *Snapshot) SearchTimelineItem(id entity.Id) (TimelineItem, error) {
return nil, fmt.Errorf("timeline item not found")
}
-// SearchComment will search for a comment matching the given hash
-func (snap *Snapshot) SearchComment(id entity.Id) (*Comment, error) {
+// SearchComment will search for a comment matching the given id
+func (snap *Snapshot) SearchComment(id entity.CombinedId) (*Comment, error) {
for _, c := range snap.Comments {
- if c.id == id {
+ if c.combinedId == id {
return &c, nil
}
}
- return nil, fmt.Errorf("comment item not found")
+ return nil, fmt.Errorf("comment not found")
+}
+
+// SearchCommentByOpId will search for a comment generated by the given operation Id
+func (snap *Snapshot) SearchCommentByOpId(id entity.Id) (*Comment, error) {
+ for _, c := range snap.Comments {
+ if c.targetId == id {
+ return &c, nil
+ }
+ }
+
+ return nil, fmt.Errorf("comment not found")
}
// append the operation author to the actors list