mirror of
https://github.com/go-gitea/gitea
synced 2024-12-24 03:35:55 +01:00
work #1500
This commit is contained in:
parent
87f5ca8e1f
commit
b846f195c1
@ -14,6 +14,8 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
"unicode"
|
"unicode"
|
||||||
|
|
||||||
|
"github.com/go-xorm/xorm"
|
||||||
|
|
||||||
"github.com/gogits/gogs/modules/base"
|
"github.com/gogits/gogs/modules/base"
|
||||||
"github.com/gogits/gogs/modules/git"
|
"github.com/gogits/gogs/modules/git"
|
||||||
"github.com/gogits/gogs/modules/log"
|
"github.com/gogits/gogs/modules/log"
|
||||||
@ -77,6 +79,13 @@ type Action struct {
|
|||||||
Created time.Time `xorm:"created"`
|
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 {
|
func (a Action) GetOpType() int {
|
||||||
return int(a.OpType)
|
return int(a.OpType)
|
||||||
}
|
}
|
||||||
|
@ -60,11 +60,6 @@ type Issue struct {
|
|||||||
Comments []*Comment `xorm:"-"`
|
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) {
|
func (i *Issue) AfterSet(colName string, _ xorm.Cell) {
|
||||||
var err error
|
var err error
|
||||||
switch colName {
|
switch colName {
|
||||||
@ -97,9 +92,16 @@ func (i *Issue) AfterSet(colName string, _ xorm.Cell) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(3, "GetUserByID[%d]: %v", i.ID, err)
|
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.
|
// IsPoster returns true if given user by ID is the poster.
|
||||||
func (i *Issue) IsPoster(uid int64) bool {
|
func (i *Issue) IsPoster(uid int64) bool {
|
||||||
return i.PosterID == uid
|
return i.PosterID == uid
|
||||||
@ -1337,16 +1339,6 @@ type Comment struct {
|
|||||||
ShowTag CommentTag `xorm:"-"`
|
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) {
|
func (c *Comment) AfterSet(colName string, _ xorm.Cell) {
|
||||||
var err error
|
var err error
|
||||||
switch colName {
|
switch colName {
|
||||||
@ -1366,9 +1358,21 @@ func (c *Comment) AfterSet(colName string, _ xorm.Cell) {
|
|||||||
log.Error(3, "GetUserByID[%d]: %v", c.ID, err)
|
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) {
|
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{
|
comment := &Comment{
|
||||||
PosterID: u.Id,
|
PosterID: u.Id,
|
||||||
|
Loading…
Reference in New Issue
Block a user