aboutsummaryrefslogtreecommitdiffstats
path: root/entities/bug/timeline.go
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2022-08-23 15:01:36 +0200
committerGitHub <noreply@github.com>2022-08-23 15:01:36 +0200
commit5a70e8b3a2e0fe3d1a1dcd4c24bb6bf64633cb7f (patch)
treee5382a09a45098672b6d60397eac201617fdd6ec /entities/bug/timeline.go
parent81fd7a5d8b6443e65c861f00a7387c0a3c926c66 (diff)
parent6ed4b8b7a1185ad278eb2e40b32e859f828233d9 (diff)
downloadgit-bug-5a70e8b3a2e0fe3d1a1dcd4c24bb6bf64633cb7f.tar.gz
Merge pull request #664 from MichaelMure/combined-id-rework
bug: have a type for combined ids, fix #653
Diffstat (limited to 'entities/bug/timeline.go')
-rw-r--r--entities/bug/timeline.go42
1 files changed, 21 insertions, 21 deletions
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,
})
}