diff --git a/models/admin.go b/models/admin.go index 27a2032e2cf..a003aff7e62 100644 --- a/models/admin.go +++ b/models/admin.go @@ -107,7 +107,7 @@ func Notices(page, pageSize int) ([]*Notice, error) { notices := make([]*Notice, 0, pageSize) return notices, db.GetEngine(db.DefaultContext). Limit(pageSize, (page-1)*pageSize). - Desc("id"). + Desc("created_unix"). Find(¬ices) } diff --git a/models/issue.go b/models/issue.go index 9b02a839006..b62394919ce 100644 --- a/models/issue.go +++ b/models/issue.go @@ -843,7 +843,7 @@ func (issue *Issue) GetLastEventLabel() string { func (issue *Issue) GetLastComment() (*Comment, error) { var c Comment exist, err := db.GetEngine(db.DefaultContext).Where("type = ?", CommentTypeComment). - And("issue_id = ?", issue.ID).Desc("id").Get(&c) + And("issue_id = ?", issue.ID).Desc("created_unix").Get(&c) if err != nil { return nil, err } diff --git a/models/token.go b/models/token.go index 3cffdd9ba27..b3712fce5e5 100644 --- a/models/token.go +++ b/models/token.go @@ -161,7 +161,7 @@ func ListAccessTokens(opts ListAccessTokensOptions) ([]*AccessToken, error) { sess = sess.Where("name=?", opts.Name) } - sess = sess.Desc("id") + sess = sess.Desc("created_unix") if opts.Page != 0 { sess = db.SetSessionPagination(sess, &opts)