From 45b04351d8d02e53b3401b0ee23f7cbe750b63cd Mon Sep 17 00:00:00 2001 From: Michael Muré Date: Mon, 3 May 2021 11:45:15 +0200 Subject: bug: have a type for combined ids, fix https://github.com/MichaelMure/git-bug/issues/653 --- entities/bug/timeline.go | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) (limited to 'entities/bug/timeline.go') diff --git a/entities/bug/timeline.go b/entities/bug/timeline.go index d7f042db..84ece262 100644 --- a/entities/bug/timeline.go +++ b/entities/bug/timeline.go @@ -10,8 +10,8 @@ import ( ) type TimelineItem interface { - // Id return the identifier of the item - Id() entity.Id + // CombinedId returns the global identifier of the item + CombinedId() entity.CombinedId } // CommentHistoryStep hold one version of a message in the history @@ -26,46 +26,46 @@ type CommentHistoryStep struct { // CommentTimelineItem is a TimelineItem that holds a Comment and its edition history type CommentTimelineItem struct { - // id should be the same as in Comment - id entity.Id - Author identity.Interface - Message string - Files []repository.Hash - CreatedAt timestamp.Timestamp - LastEdit timestamp.Timestamp - History []CommentHistoryStep + combinedId entity.CombinedId + Author identity.Interface + Message string + Files []repository.Hash + CreatedAt timestamp.Timestamp + LastEdit timestamp.Timestamp + History []CommentHistoryStep } func NewCommentTimelineItem(comment Comment) CommentTimelineItem { return CommentTimelineItem{ - id: comment.id, - Author: comment.Author, - Message: comment.Message, - Files: comment.Files, - CreatedAt: comment.UnixTime, - LastEdit: comment.UnixTime, + // id: comment.id, + combinedId: comment.combinedId, + Author: comment.Author, + Message: comment.Message, + Files: comment.Files, + CreatedAt: comment.unixTime, + LastEdit: comment.unixTime, History: []CommentHistoryStep{ { Message: comment.Message, - UnixTime: comment.UnixTime, + UnixTime: comment.unixTime, }, }, } } -func (c *CommentTimelineItem) Id() entity.Id { - return c.id +func (c *CommentTimelineItem) CombinedId() entity.CombinedId { + return c.combinedId } // Append will append a new comment in the history and update the other values func (c *CommentTimelineItem) Append(comment Comment) { c.Message = comment.Message c.Files = comment.Files - c.LastEdit = comment.UnixTime + c.LastEdit = comment.unixTime c.History = append(c.History, CommentHistoryStep{ Author: comment.Author, Message: comment.Message, - UnixTime: comment.UnixTime, + UnixTime: comment.unixTime, }) } -- cgit