diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2019-08-15 22:46:21 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-08-15 22:46:21 +0800 |
commit | 85202d4784758573f80f93dbbda97a444e7ece99 (patch) | |
tree | 7957506de8657463e79f121e1b79567ef1cc84a1 /models/issue.go | |
parent | 5a44be627c055d3e9eb406ec4a91579de78b6910 (diff) | |
download | gitea-85202d4784758573f80f93dbbda97a444e7ece99.tar.gz gitea-85202d4784758573f80f93dbbda97a444e7ece99.zip |
Display ui time with customize time location (#7792)
* display ui time with customize time location
* fix lint
* rename UILocation to DefaultUILocation
* move time related functions to modules/timeutil
* fix tests
* fix tests
* fix build
* fix swagger
Diffstat (limited to 'models/issue.go')
-rw-r--r-- | models/issue.go | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/models/issue.go b/models/issue.go index 7561083e0f..ddfa2a2e14 100644 --- a/models/issue.go +++ b/models/issue.go @@ -16,6 +16,7 @@ import ( "code.gitea.io/gitea/modules/log" "code.gitea.io/gitea/modules/setting" api "code.gitea.io/gitea/modules/structs" + "code.gitea.io/gitea/modules/timeutil" "code.gitea.io/gitea/modules/util" "github.com/Unknwon/com" @@ -49,11 +50,11 @@ type Issue struct { NumComments int Ref string - DeadlineUnix util.TimeStamp `xorm:"INDEX"` + DeadlineUnix timeutil.TimeStamp `xorm:"INDEX"` - CreatedUnix util.TimeStamp `xorm:"INDEX created"` - UpdatedUnix util.TimeStamp `xorm:"INDEX updated"` - ClosedUnix util.TimeStamp `xorm:"INDEX"` + CreatedUnix timeutil.TimeStamp `xorm:"INDEX created"` + UpdatedUnix timeutil.TimeStamp `xorm:"INDEX updated"` + ClosedUnix timeutil.TimeStamp `xorm:"INDEX"` Attachments []*Attachment `xorm:"-"` Comments []*Comment `xorm:"-"` @@ -90,7 +91,7 @@ func (issue *Issue) loadTotalTimes(e Engine) (err error) { // IsOverdue checks if the issue is overdue func (issue *Issue) IsOverdue() bool { - return util.TimeStampNow() >= issue.DeadlineUnix + return timeutil.TimeStampNow() >= issue.DeadlineUnix } // LoadRepo loads issue's repository @@ -744,7 +745,7 @@ func (issue *Issue) changeStatus(e *xorm.Session, doer *User, isClosed bool) (er issue.IsClosed = isClosed if isClosed { - issue.ClosedUnix = util.TimeStampNow() + issue.ClosedUnix = timeutil.TimeStampNow() } else { issue.ClosedUnix = 0 } @@ -991,7 +992,7 @@ func (issue *Issue) GetTasksDone() int { } // GetLastEventTimestamp returns the last user visible event timestamp, either the creation of this issue or the close. -func (issue *Issue) GetLastEventTimestamp() util.TimeStamp { +func (issue *Issue) GetLastEventTimestamp() timeutil.TimeStamp { if issue.IsClosed { return issue.ClosedUnix } @@ -1794,7 +1795,7 @@ func UpdateIssue(issue *Issue) error { } // UpdateIssueDeadline updates an issue deadline and adds comments. Setting a deadline to 0 means deleting it. -func UpdateIssueDeadline(issue *Issue, deadlineUnix util.TimeStamp, doer *User) (err error) { +func UpdateIssueDeadline(issue *Issue, deadlineUnix timeutil.TimeStamp, doer *User) (err error) { // if the deadline hasn't changed do nothing if issue.DeadlineUnix == deadlineUnix { |