]> source.dussan.org Git - gitea.git/commitdiff
work #1500
authorUnknwon <u@gogs.io>
Wed, 19 Aug 2015 16:12:43 +0000 (00:12 +0800)
committerUnknwon <u@gogs.io>
Wed, 19 Aug 2015 16:12:43 +0000 (00:12 +0800)
models/action.go
models/issue.go

index de7f93a973cc75c6d199857387e870c6057cf392..0e336c372b4c3adfc24fd620b1a2c3bb9a02f853 100644 (file)
@@ -14,6 +14,8 @@ import (
        "time"
        "unicode"
 
+       "github.com/go-xorm/xorm"
+
        "github.com/gogits/gogs/modules/base"
        "github.com/gogits/gogs/modules/git"
        "github.com/gogits/gogs/modules/log"
@@ -77,6 +79,13 @@ type Action struct {
        Created      time.Time `xorm:"created"`
 }
 
+func (a *Action) AfterSet(colName string, _ xorm.Cell) {
+       switch colName {
+       case "created":
+               a.Created = a.Created.UTC()
+       }
+}
+
 func (a Action) GetOpType() int {
        return int(a.OpType)
 }
index 1e49fda75465c2f668b7bde32f0665e87250e09c..cd22f1a5a10d9b245e53d8c05be44460f8aa90e5 100644 (file)
@@ -60,11 +60,6 @@ type Issue struct {
        Comments    []*Comment    `xorm:"-"`
 }
 
-// HashTag returns unique hash tag for issue.
-func (i *Issue) HashTag() string {
-       return "issue-" + com.ToStr(i.ID)
-}
-
 func (i *Issue) AfterSet(colName string, _ xorm.Cell) {
        var err error
        switch colName {
@@ -97,9 +92,16 @@ func (i *Issue) AfterSet(colName string, _ xorm.Cell) {
                if err != nil {
                        log.Error(3, "GetUserByID[%d]: %v", i.ID, err)
                }
+       case "created":
+               i.Created = i.Created.UTC()
        }
 }
 
+// HashTag returns unique hash tag for issue.
+func (i *Issue) HashTag() string {
+       return "issue-" + com.ToStr(i.ID)
+}
+
 // IsPoster returns true if given user by ID is the poster.
 func (i *Issue) IsPoster(uid int64) bool {
        return i.PosterID == uid
@@ -1337,16 +1339,6 @@ type Comment struct {
        ShowTag CommentTag `xorm:"-"`
 }
 
-// HashTag returns unique hash tag for comment.
-func (c *Comment) HashTag() string {
-       return "issuecomment-" + com.ToStr(c.ID)
-}
-
-// EventTag returns unique event hash tag for comment.
-func (c *Comment) EventTag() string {
-       return "event-" + com.ToStr(c.ID)
-}
-
 func (c *Comment) AfterSet(colName string, _ xorm.Cell) {
        var err error
        switch colName {
@@ -1366,9 +1358,21 @@ func (c *Comment) AfterSet(colName string, _ xorm.Cell) {
                                log.Error(3, "GetUserByID[%d]: %v", c.ID, err)
                        }
                }
+       case "created":
+               c.Created = c.Created.UTC()
        }
 }
 
+// HashTag returns unique hash tag for comment.
+func (c *Comment) HashTag() string {
+       return "issuecomment-" + com.ToStr(c.ID)
+}
+
+// EventTag returns unique event hash tag for comment.
+func (c *Comment) EventTag() string {
+       return "event-" + com.ToStr(c.ID)
+}
+
 func createComment(e *xorm.Session, u *User, repo *Repository, issue *Issue, commitID, line int64, cmtType CommentType, content string, uuids []string) (_ *Comment, err error) {
        comment := &Comment{
                PosterID: u.Id,