summaryrefslogtreecommitdiffstats
path: root/models/issue_comment.go
diff options
context:
space:
mode:
authorNorwin <noerw@users.noreply.github.com>2021-02-19 10:52:11 +0000
committerGitHub <noreply@github.com>2021-02-19 12:52:11 +0200
commitd38ae597e19f58bcd732717fe09c1ea97ab8bb12 (patch)
tree839f0b3c92a4b98a7be3b8aa316925615c16c76e /models/issue_comment.go
parent6a696b93b1e7e9dc1e7cc51d4eab2932b072170f (diff)
downloadgitea-d38ae597e19f58bcd732717fe09c1ea97ab8bb12.tar.gz
gitea-d38ae597e19f58bcd732717fe09c1ea97ab8bb12.zip
Add UI to delete tracked times (#14100)
Co-authored-by: 6543 <6543@obermui.de>
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