MCPcopy Create free account
hub / github.com/git-bug/git-bug / Apply

Method Apply

entities/bug/op_add_comment.go:29–51  ·  view source on GitHub ↗
(snapshot *Snapshot)

Source from the content-addressed store, hash-verified

27}
28
29func (op *AddCommentOperation) Apply(snapshot *Snapshot) {
30 snapshot.addActor(op.Author())
31 snapshot.addParticipant(op.Author())
32
33 opId := op.Id()
34
35 comment := Comment{
36 combinedId: entity.CombineIds(snapshot.Id(), opId),
37 targetId: opId,
38 Message: op.Message,
39 Author: op.Author(),
40 Files: op.Files,
41 unixTime: timestamp.Timestamp(op.UnixTime),
42 }
43
44 snapshot.Comments = append(snapshot.Comments, comment)
45
46 item := &AddCommentTimelineItem{
47 CommentTimelineItem: NewCommentTimelineItem(comment),
48 }
49
50 snapshot.Timeline = append(snapshot.Timeline, item)
51}
52
53func (op *AddCommentOperation) GetFiles() []repository.Hash {
54 return op.Files

Callers

nothing calls this directly

Calls 8

IdMethod · 0.95
CombineIdsFunction · 0.92
TimestampTypeAlias · 0.92
NewCommentTimelineItemFunction · 0.85
addActorMethod · 0.80
addParticipantMethod · 0.80
AuthorMethod · 0.65
IdMethod · 0.65

Tested by

no test coverage detected