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/migrations | |
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/migrations')
-rw-r--r-- | models/migrations/v54.go | 4 | ||||
-rw-r--r-- | models/migrations/v57.go | 4 | ||||
-rw-r--r-- | models/migrations/v64.go | 14 | ||||
-rw-r--r-- | models/migrations/v65.go | 7 | ||||
-rw-r--r-- | models/migrations/v71.go | 12 | ||||
-rw-r--r-- | models/migrations/v72.go | 6 | ||||
-rw-r--r-- | models/migrations/v76.go | 4 | ||||
-rw-r--r-- | models/migrations/v83.go | 8 | ||||
-rw-r--r-- | models/migrations/v85.go | 14 |
9 files changed, 37 insertions, 36 deletions
diff --git a/models/migrations/v54.go b/models/migrations/v54.go index 96c26739c6..5194624f69 100644 --- a/models/migrations/v54.go +++ b/models/migrations/v54.go @@ -7,7 +7,7 @@ package migrations import ( "fmt" - "code.gitea.io/gitea/modules/util" + "code.gitea.io/gitea/modules/timeutil" "github.com/go-xorm/xorm" ) @@ -19,7 +19,7 @@ func addPullRequestOptions(x *xorm.Engine) error { RepoID int64 `xorm:"INDEX(s)"` Type int `xorm:"INDEX(s)"` Config map[string]interface{} `xorm:"JSON"` - CreatedUnix util.TimeStamp `xorm:"INDEX CREATED"` + CreatedUnix timeutil.TimeStamp `xorm:"INDEX CREATED"` } sess := x.NewSession() diff --git a/models/migrations/v57.go b/models/migrations/v57.go index 3a79a5cca7..fe4bf6b0ee 100644 --- a/models/migrations/v57.go +++ b/models/migrations/v57.go @@ -7,7 +7,7 @@ package migrations import ( "fmt" - "code.gitea.io/gitea/modules/util" + "code.gitea.io/gitea/modules/timeutil" "github.com/go-xorm/xorm" ) @@ -15,7 +15,7 @@ import ( func addIssueClosedTime(x *xorm.Engine) error { // Issue see models/issue.go type Issue struct { - ClosedUnix util.TimeStamp `xorm:"INDEX"` + ClosedUnix timeutil.TimeStamp `xorm:"INDEX"` } if err := x.Sync2(new(Issue)); err != nil { diff --git a/models/migrations/v64.go b/models/migrations/v64.go index e4a360f578..00637ca046 100644 --- a/models/migrations/v64.go +++ b/models/migrations/v64.go @@ -5,7 +5,7 @@ package migrations import ( - "code.gitea.io/gitea/modules/util" + "code.gitea.io/gitea/modules/timeutil" "github.com/go-xorm/xorm" ) @@ -27,10 +27,10 @@ func addMultipleAssignees(x *xorm.Engine) error { IsPull bool `xorm:"INDEX"` // Indicates whether is a pull request or not. NumComments int - DeadlineUnix util.TimeStamp `xorm:"INDEX"` - CreatedUnix util.TimeStamp `xorm:"INDEX created"` - UpdatedUnix util.TimeStamp `xorm:"INDEX updated"` - ClosedUnix util.TimeStamp `xorm:"INDEX"` + DeadlineUnix timeutil.TimeStamp `xorm:"INDEX"` + CreatedUnix timeutil.TimeStamp `xorm:"INDEX created"` + UpdatedUnix timeutil.TimeStamp `xorm:"INDEX updated"` + ClosedUnix timeutil.TimeStamp `xorm:"INDEX"` } // Updated the comment table @@ -53,8 +53,8 @@ func addMultipleAssignees(x *xorm.Engine) error { Content string `xorm:"TEXT"` RenderedContent string `xorm:"-"` - CreatedUnix util.TimeStamp `xorm:"INDEX created"` - UpdatedUnix util.TimeStamp `xorm:"INDEX updated"` + CreatedUnix timeutil.TimeStamp `xorm:"INDEX created"` + UpdatedUnix timeutil.TimeStamp `xorm:"INDEX updated"` // Reference issue in commit message CommitSHA string `xorm:"VARCHAR(40)"` diff --git a/models/migrations/v65.go b/models/migrations/v65.go index f73e632877..cc199d34e2 100644 --- a/models/migrations/v65.go +++ b/models/migrations/v65.go @@ -1,7 +1,8 @@ package migrations import ( - "code.gitea.io/gitea/modules/util" + "code.gitea.io/gitea/modules/timeutil" + "github.com/go-xorm/xorm" ) @@ -12,8 +13,8 @@ func addU2FReg(x *xorm.Engine) error { UserID int64 `xorm:"INDEX"` Raw []byte Counter uint32 - CreatedUnix util.TimeStamp `xorm:"INDEX created"` - UpdatedUnix util.TimeStamp `xorm:"INDEX updated"` + CreatedUnix timeutil.TimeStamp `xorm:"INDEX created"` + UpdatedUnix timeutil.TimeStamp `xorm:"INDEX updated"` } return x.Sync2(&U2FRegistration{}) } diff --git a/models/migrations/v71.go b/models/migrations/v71.go index 8594460370..004f0a3f51 100644 --- a/models/migrations/v71.go +++ b/models/migrations/v71.go @@ -8,11 +8,11 @@ import ( "crypto/sha256" "fmt" + "code.gitea.io/gitea/modules/generate" + "code.gitea.io/gitea/modules/timeutil" + "github.com/go-xorm/xorm" "golang.org/x/crypto/pbkdf2" - - "code.gitea.io/gitea/modules/generate" - "code.gitea.io/gitea/modules/util" ) func addScratchHash(x *xorm.Engine) error { @@ -24,9 +24,9 @@ func addScratchHash(x *xorm.Engine) error { ScratchToken string ScratchSalt string ScratchHash string - LastUsedPasscode string `xorm:"VARCHAR(10)"` - CreatedUnix util.TimeStamp `xorm:"INDEX created"` - UpdatedUnix util.TimeStamp `xorm:"INDEX updated"` + LastUsedPasscode string `xorm:"VARCHAR(10)"` + CreatedUnix timeutil.TimeStamp `xorm:"INDEX created"` + UpdatedUnix timeutil.TimeStamp `xorm:"INDEX updated"` } if err := x.Sync2(new(TwoFactor)); err != nil { diff --git a/models/migrations/v72.go b/models/migrations/v72.go index 4924b41ceb..c99b46afd2 100644 --- a/models/migrations/v72.go +++ b/models/migrations/v72.go @@ -7,7 +7,7 @@ package migrations import ( "fmt" - "code.gitea.io/gitea/modules/util" + "code.gitea.io/gitea/modules/timeutil" "github.com/go-xorm/xorm" ) @@ -20,8 +20,8 @@ func addReview(x *xorm.Engine) error { ReviewerID int64 `xorm:"index"` IssueID int64 `xorm:"index"` Content string - CreatedUnix util.TimeStamp `xorm:"INDEX created"` - UpdatedUnix util.TimeStamp `xorm:"INDEX updated"` + CreatedUnix timeutil.TimeStamp `xorm:"INDEX created"` + UpdatedUnix timeutil.TimeStamp `xorm:"INDEX updated"` } if err := x.Sync2(new(Review)); err != nil { diff --git a/models/migrations/v76.go b/models/migrations/v76.go index efab7e0cf0..e1fd6f100b 100644 --- a/models/migrations/v76.go +++ b/models/migrations/v76.go @@ -7,7 +7,7 @@ package migrations import ( "fmt" - "code.gitea.io/gitea/modules/util" + "code.gitea.io/gitea/modules/timeutil" "github.com/go-xorm/xorm" ) @@ -19,7 +19,7 @@ func addPullRequestRebaseWithMerge(x *xorm.Engine) error { RepoID int64 `xorm:"INDEX(s)"` Type int `xorm:"INDEX(s)"` Config map[string]interface{} `xorm:"JSON"` - CreatedUnix util.TimeStamp `xorm:"INDEX CREATED"` + CreatedUnix timeutil.TimeStamp `xorm:"INDEX CREATED"` } sess := x.NewSession() diff --git a/models/migrations/v83.go b/models/migrations/v83.go index 947645153c..cdc59292ab 100644 --- a/models/migrations/v83.go +++ b/models/migrations/v83.go @@ -5,7 +5,7 @@ package migrations import ( - "code.gitea.io/gitea/modules/util" + "code.gitea.io/gitea/modules/timeutil" "github.com/go-xorm/xorm" ) @@ -19,9 +19,9 @@ func addUploaderIDForAttachment(x *xorm.Engine) error { UploaderID int64 `xorm:"INDEX DEFAULT 0"` CommentID int64 Name string - DownloadCount int64 `xorm:"DEFAULT 0"` - Size int64 `xorm:"DEFAULT 0"` - CreatedUnix util.TimeStamp `xorm:"created"` + DownloadCount int64 `xorm:"DEFAULT 0"` + Size int64 `xorm:"DEFAULT 0"` + CreatedUnix timeutil.TimeStamp `xorm:"created"` } return x.Sync2(new(Attachment)) diff --git a/models/migrations/v85.go b/models/migrations/v85.go index 157c06d7ba..6066d5ebe9 100644 --- a/models/migrations/v85.go +++ b/models/migrations/v85.go @@ -7,11 +7,11 @@ package migrations import ( "fmt" - "github.com/go-xorm/xorm" - "code.gitea.io/gitea/modules/generate" "code.gitea.io/gitea/modules/log" - "code.gitea.io/gitea/modules/util" + "code.gitea.io/gitea/modules/timeutil" + + "github.com/go-xorm/xorm" ) func hashAppToken(x *xorm.Engine) error { @@ -26,10 +26,10 @@ func hashAppToken(x *xorm.Engine) error { TokenSalt string TokenLastEight string `xorm:"token_last_eight"` - CreatedUnix util.TimeStamp `xorm:"INDEX created"` - UpdatedUnix util.TimeStamp `xorm:"INDEX updated"` - HasRecentActivity bool `xorm:"-"` - HasUsed bool `xorm:"-"` + CreatedUnix timeutil.TimeStamp `xorm:"INDEX created"` + UpdatedUnix timeutil.TimeStamp `xorm:"INDEX updated"` + HasRecentActivity bool `xorm:"-"` + HasUsed bool `xorm:"-"` } // First remove the index |