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/ssh_key.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/ssh_key.go')
-rw-r--r-- | models/ssh_key.go | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/models/ssh_key.go b/models/ssh_key.go index 4f93b5c44f..874f6b19f7 100644 --- a/models/ssh_key.go +++ b/models/ssh_key.go @@ -26,7 +26,7 @@ import ( "code.gitea.io/gitea/modules/log" "code.gitea.io/gitea/modules/process" "code.gitea.io/gitea/modules/setting" - "code.gitea.io/gitea/modules/util" + "code.gitea.io/gitea/modules/timeutil" "github.com/Unknwon/com" "github.com/go-xorm/xorm" @@ -62,16 +62,16 @@ type PublicKey struct { Type KeyType `xorm:"NOT NULL DEFAULT 1"` LoginSourceID int64 `xorm:"NOT NULL DEFAULT 0"` - CreatedUnix util.TimeStamp `xorm:"created"` - UpdatedUnix util.TimeStamp `xorm:"updated"` - HasRecentActivity bool `xorm:"-"` - HasUsed bool `xorm:"-"` + CreatedUnix timeutil.TimeStamp `xorm:"created"` + UpdatedUnix timeutil.TimeStamp `xorm:"updated"` + HasRecentActivity bool `xorm:"-"` + HasUsed bool `xorm:"-"` } // AfterLoad is invoked from XORM after setting the values of all fields of this object. func (key *PublicKey) AfterLoad() { key.HasUsed = key.UpdatedUnix > key.CreatedUnix - key.HasRecentActivity = key.UpdatedUnix.AddDuration(7*24*time.Hour) > util.TimeStampNow() + key.HasRecentActivity = key.UpdatedUnix.AddDuration(7*24*time.Hour) > timeutil.TimeStampNow() } // OmitEmail returns content of public key without email address. @@ -581,7 +581,7 @@ func UpdatePublicKeyUpdated(id int64) error { } _, err := x.ID(id).Cols("updated_unix").Update(&PublicKey{ - UpdatedUnix: util.TimeStampNow(), + UpdatedUnix: timeutil.TimeStampNow(), }) if err != nil { return err @@ -714,16 +714,16 @@ type DeployKey struct { Mode AccessMode `xorm:"NOT NULL DEFAULT 1"` - CreatedUnix util.TimeStamp `xorm:"created"` - UpdatedUnix util.TimeStamp `xorm:"updated"` - HasRecentActivity bool `xorm:"-"` - HasUsed bool `xorm:"-"` + CreatedUnix timeutil.TimeStamp `xorm:"created"` + UpdatedUnix timeutil.TimeStamp `xorm:"updated"` + HasRecentActivity bool `xorm:"-"` + HasUsed bool `xorm:"-"` } // AfterLoad is invoked from XORM after setting the values of all fields of this object. func (key *DeployKey) AfterLoad() { key.HasUsed = key.UpdatedUnix > key.CreatedUnix - key.HasRecentActivity = key.UpdatedUnix.AddDuration(7*24*time.Hour) > util.TimeStampNow() + key.HasRecentActivity = key.UpdatedUnix.AddDuration(7*24*time.Hour) > timeutil.TimeStampNow() } // GetContent gets associated public key content. |