aboutsummaryrefslogtreecommitdiffstats
path: root/bug/snapshot.go
diff options
context:
space:
mode:
Diffstat (limited to 'bug/snapshot.go')
-rw-r--r--bug/snapshot.go27
1 files changed, 11 insertions, 16 deletions
diff --git a/bug/snapshot.go b/bug/snapshot.go
index f1da8099..39366c6d 100644
--- a/bug/snapshot.go
+++ b/bug/snapshot.go
@@ -4,13 +4,13 @@ import (
"fmt"
"time"
+ "github.com/MichaelMure/git-bug/entity"
"github.com/MichaelMure/git-bug/identity"
- "github.com/MichaelMure/git-bug/util/git"
)
// Snapshot is a compiled form of the Bug data structure used for storage and merge
type Snapshot struct {
- id string
+ id entity.Id
Status Status
Title string
@@ -27,15 +27,10 @@ type Snapshot struct {
}
// Return the Bug identifier
-func (snap *Snapshot) Id() string {
+func (snap *Snapshot) Id() entity.Id {
return snap.id
}
-// Return the Bug identifier truncated for human consumption
-func (snap *Snapshot) HumanId() string {
- return FormatHumanID(snap.id)
-}
-
// Return the last time a bug was modified
func (snap *Snapshot) LastEditTime() time.Time {
if len(snap.Operations) == 0 {
@@ -60,9 +55,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(hash git.Hash) (TimelineItem, error) {
+func (snap *Snapshot) SearchTimelineItem(id entity.Id) (TimelineItem, error) {
for i := range snap.Timeline {
- if snap.Timeline[i].Hash() == hash {
+ if snap.Timeline[i].Id() == id {
return snap.Timeline[i], nil
}
}
@@ -71,9 +66,9 @@ func (snap *Snapshot) SearchTimelineItem(hash git.Hash) (TimelineItem, error) {
}
// SearchComment will search for a comment matching the given hash
-func (snap *Snapshot) SearchComment(hash git.Hash) (*Comment, error) {
+func (snap *Snapshot) SearchComment(id entity.Id) (*Comment, error) {
for _, c := range snap.Comments {
- if c.id == hash.String() {
+ if c.id == id {
return &c, nil
}
}
@@ -104,7 +99,7 @@ func (snap *Snapshot) addParticipant(participant identity.Interface) {
}
// HasParticipant return true if the id is a participant
-func (snap *Snapshot) HasParticipant(id string) bool {
+func (snap *Snapshot) HasParticipant(id entity.Id) bool {
for _, p := range snap.Participants {
if p.Id() == id {
return true
@@ -114,7 +109,7 @@ func (snap *Snapshot) HasParticipant(id string) bool {
}
// HasAnyParticipant return true if one of the ids is a participant
-func (snap *Snapshot) HasAnyParticipant(ids ...string) bool {
+func (snap *Snapshot) HasAnyParticipant(ids ...entity.Id) bool {
for _, id := range ids {
if snap.HasParticipant(id) {
return true
@@ -124,7 +119,7 @@ func (snap *Snapshot) HasAnyParticipant(ids ...string) bool {
}
// HasActor return true if the id is a actor
-func (snap *Snapshot) HasActor(id string) bool {
+func (snap *Snapshot) HasActor(id entity.Id) bool {
for _, p := range snap.Actors {
if p.Id() == id {
return true
@@ -134,7 +129,7 @@ func (snap *Snapshot) HasActor(id string) bool {
}
// HasAnyActor return true if one of the ids is a actor
-func (snap *Snapshot) HasAnyActor(ids ...string) bool {
+func (snap *Snapshot) HasAnyActor(ids ...entity.Id) bool {
for _, id := range ids {
if snap.HasActor(id) {
return true