summaryrefslogtreecommitdiffstats
path: root/models/issue_comment.go
diff options
context:
space:
mode:
Diffstat (limited to 'models/issue_comment.go')
-rw-r--r--models/issue_comment.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/models/issue_comment.go b/models/issue_comment.go
index b15b5169ff..6cc03ba0e8 100644
--- a/models/issue_comment.go
+++ b/models/issue_comment.go
@@ -136,6 +136,8 @@ type Comment struct {
MilestoneID int64
OldMilestone *Milestone `xorm:"-"`
Milestone *Milestone `xorm:"-"`
+ TimeID int64
+ Time *TrackedTime `xorm:"-"`
AssigneeID int64
RemovedAssignee bool
Assignee *User `xorm:"-"`
@@ -541,6 +543,16 @@ func (c *Comment) LoadDepIssueDetails() (err error) {
return err
}
+// LoadTime loads the associated time for a CommentTypeAddTimeManual
+func (c *Comment) LoadTime() error {
+ if c.Time != nil || c.TimeID == 0 {
+ return nil
+ }
+ var err error
+ c.Time, err = GetTrackedTimeByID(c.TimeID)
+ return err
+}
+
func (c *Comment) loadReactions(e Engine, repo *Repository) (err error) {
if c.Reactions != nil {
return nil
@@ -692,6 +704,7 @@ func createComment(e *xorm.Session, opts *CreateCommentOptions) (_ *Comment, err
MilestoneID: opts.MilestoneID,
OldProjectID: opts.OldProjectID,
ProjectID: opts.ProjectID,
+ TimeID: opts.TimeID,
RemovedAssignee: opts.RemovedAssignee,
AssigneeID: opts.AssigneeID,
AssigneeTeamID: opts.AssigneeTeamID,
@@ -859,6 +872,7 @@ type CreateCommentOptions struct {
MilestoneID int64
OldProjectID int64
ProjectID int64
+ TimeID int64
AssigneeID int64
AssigneeTeamID int64
RemovedAssignee bool