diff options
author | Unknwon <u@gogs.io> | 2016-03-09 19:53:30 -0500 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2016-03-09 19:53:30 -0500 |
commit | ad513a20e939691828ba415c9a565e8ff3daa95f (patch) | |
tree | c15aa2c82a5ed242ba51c837804f050690dd60ad /models/pull.go | |
parent | 0c9a616326ba096a2ff6c058cc96950f68c0fa6e (diff) | |
download | gitea-ad513a20e939691828ba415c9a565e8ff3daa95f.tar.gz gitea-ad513a20e939691828ba415c9a565e8ff3daa95f.zip |
#2302 Replace time.Time with Unix Timestamp (int64)
Diffstat (limited to 'models/pull.go')
-rw-r--r-- | models/pull.go | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/models/pull.go b/models/pull.go index a3b3d7bce5..86ddb5d944 100644 --- a/models/pull.go +++ b/models/pull.go @@ -58,20 +58,25 @@ type PullRequest struct { HasMerged bool MergedCommitID string `xorm:"VARCHAR(40)"` - Merged time.Time MergerID int64 - Merger *User `xorm:"-"` + Merger *User `xorm:"-"` + Merged time.Time `xorm:"-"` + MergedUnix int64 +} + +func (pr *PullRequest) BeforeUpdate() { + pr.MergedUnix = pr.Merged.UTC().Unix() } // Note: don't try to get Pull because will end up recursive querying. func (pr *PullRequest) AfterSet(colName string, _ xorm.Cell) { switch colName { - case "merged": + case "merged_unix": if !pr.HasMerged { return } - pr.Merged = regulateTimeZone(pr.Merged) + pr.Merged = time.Unix(pr.MergedUnix, 0).Local() } } |