|
|
@@ -69,8 +69,8 @@ type Issue struct { |
|
|
|
|
|
|
|
//block_chain |
|
|
|
Amount int64 |
|
|
|
IsTransformed bool `xorm:"INDEX NOT NULL DEFAULT false"` |
|
|
|
StayTop int `xorm:"NOT NULL DEFAULT 0"` |
|
|
|
IsTransformed bool `xorm:"INDEX NOT NULL DEFAULT false"` |
|
|
|
StayTop int64 `xorm:"NOT NULL DEFAULT 0"` |
|
|
|
} |
|
|
|
|
|
|
|
var ( |
|
|
@@ -776,6 +776,19 @@ func (issue *Issue) ChangeContent(doer *User, content string) (err error) { |
|
|
|
return sess.Commit() |
|
|
|
} |
|
|
|
|
|
|
|
func (issue *Issue) ChangeStayTop(doer *User, stayTop int64) (err error) { |
|
|
|
issue.StayTop = stayTop |
|
|
|
sess := x.NewSession() |
|
|
|
defer sess.Close() |
|
|
|
if err = sess.Begin(); err != nil { |
|
|
|
return err |
|
|
|
} |
|
|
|
if err = updateIssueCols(sess, issue, "stay_top"); err != nil { |
|
|
|
return fmt.Errorf("UpdateIssueCols,stayTop: %v", err) |
|
|
|
} |
|
|
|
return sess.Commit() |
|
|
|
} |
|
|
|
|
|
|
|
// ChangeRef changes issue ref, as the given user. |
|
|
|
func (issue *Issue) ChangeRef(doer *User, newRef string) (err error) { |
|
|
|
oldRef := issue.Ref |
|
|
@@ -1968,3 +1981,14 @@ func UpdateReactionsMigrationsByType(gitServiceType structs.GitServiceType, orig |
|
|
|
}) |
|
|
|
return err |
|
|
|
} |
|
|
|
|
|
|
|
func GetMaxStayTop(repoId int64) int64 { |
|
|
|
re := new(Issue) |
|
|
|
isExist, err := x.Table(new(Issue)).Where("repo_id="+fmt.Sprint(repoId)).Desc("stay_top").Limit(1, 0).Get(re) |
|
|
|
if err == nil { |
|
|
|
if isExist { |
|
|
|
return re.StayTop + 1 |
|
|
|
} |
|
|
|
} |
|
|
|
return 1 |
|
|
|
} |