Skip to content

Commit fa4c61e

Browse files
Merge branch 'main' into feat-32257-add-comments-unchanged-lines-and-show
2 parents 2db63b1 + 722e703 commit fa4c61e

File tree

34 files changed

+294
-112
lines changed

34 files changed

+294
-112
lines changed

models/activities/action.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -770,15 +770,15 @@ func DeleteIssueActions(ctx context.Context, repoID, issueID, issueIndex int64)
770770
// CountActionCreatedUnixString count actions where created_unix is an empty string
771771
func CountActionCreatedUnixString(ctx context.Context) (int64, error) {
772772
if setting.Database.Type.IsSQLite3() {
773-
return db.GetEngine(ctx).Where(`created_unix = ""`).Count(new(Action))
773+
return db.GetEngine(ctx).Where(`created_unix = ''`).Count(new(Action))
774774
}
775775
return 0, nil
776776
}
777777

778778
// FixActionCreatedUnixString set created_unix to zero if it is an empty string
779779
func FixActionCreatedUnixString(ctx context.Context) (int64, error) {
780780
if setting.Database.Type.IsSQLite3() {
781-
res, err := db.GetEngine(ctx).Exec(`UPDATE action SET created_unix = 0 WHERE created_unix = ""`)
781+
res, err := db.GetEngine(ctx).Exec(`UPDATE action SET created_unix = 0 WHERE created_unix = ''`)
782782
if err != nil {
783783
return 0, err
784784
}

models/activities/action_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ func TestConsistencyUpdateAction(t *testing.T) {
256256
unittest.AssertExistsAndLoadBean(t, &activities_model.Action{
257257
ID: int64(id),
258258
})
259-
_, err := db.GetEngine(db.DefaultContext).Exec(`UPDATE action SET created_unix = "" WHERE id = ?`, id)
259+
_, err := db.GetEngine(db.DefaultContext).Exec(`UPDATE action SET created_unix = '' WHERE id = ?`, id)
260260
assert.NoError(t, err)
261261
actions := make([]*activities_model.Action, 0, 1)
262262
//

models/issues/comment.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1108,7 +1108,7 @@ func FindComments(ctx context.Context, opts *FindCommentsOptions) (CommentList,
11081108
sess.Join("INNER", "issue", "issue.id = comment.issue_id")
11091109
}
11101110

1111-
if opts.Page != 0 {
1111+
if opts.Page > 0 {
11121112
sess = db.SetSessionPagination(sess, opts)
11131113
}
11141114

models/issues/issue.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -641,7 +641,7 @@ func (issue *Issue) BlockedByDependencies(ctx context.Context, opts db.ListOptio
641641
Where("issue_id = ?", issue.ID).
642642
// sort by repo id then created date, with the issues of the same repo at the beginning of the list
643643
OrderBy("CASE WHEN issue.repo_id = ? THEN 0 ELSE issue.repo_id END, issue.created_unix DESC", issue.RepoID)
644-
if opts.Page != 0 {
644+
if opts.Page > 0 {
645645
sess = db.SetSessionPagination(sess, &opts)
646646
}
647647
err = sess.Find(&issueDeps)

models/issues/issue_watch.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ func GetIssueWatchers(ctx context.Context, issueID int64, listOptions db.ListOpt
105105
And("`user`.prohibit_login = ?", false).
106106
Join("INNER", "`user`", "`user`.id = `issue_watch`.user_id")
107107

108-
if listOptions.Page != 0 {
108+
if listOptions.Page > 0 {
109109
sess = db.SetSessionPagination(sess, &listOptions)
110110
watches := make([]*IssueWatch, 0, listOptions.PageSize)
111111
return watches, sess.Find(&watches)

models/issues/label.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ func GetLabelsByRepoID(ctx context.Context, repoID int64, sortType string, listO
390390
sess.Asc("name")
391391
}
392392

393-
if listOptions.Page != 0 {
393+
if listOptions.Page > 0 {
394394
sess = db.SetSessionPagination(sess, &listOptions)
395395
}
396396

@@ -462,7 +462,7 @@ func GetLabelsByOrgID(ctx context.Context, orgID int64, sortType string, listOpt
462462
sess.Asc("name")
463463
}
464464

465-
if listOptions.Page != 0 {
465+
if listOptions.Page > 0 {
466466
sess = db.SetSessionPagination(sess, &listOptions)
467467
}
468468

models/issues/label_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ func TestDeleteIssueLabel(t *testing.T) {
406406
PosterID: doerID,
407407
IssueID: issueID,
408408
LabelID: labelID,
409-
}, `content=""`)
409+
}, `content=''`)
410410
label = unittest.AssertExistsAndLoadBean(t, &issues_model.Label{ID: labelID})
411411
assert.EqualValues(t, expectedNumIssues, label.NumIssues)
412412
assert.EqualValues(t, expectedNumClosedIssues, label.NumClosedIssues)

models/issues/reaction.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ func FindReactions(ctx context.Context, opts FindReactionsOptions) (ReactionList
163163
Where(opts.toConds()).
164164
In("reaction.`type`", setting.UI.Reactions).
165165
Asc("reaction.issue_id", "reaction.comment_id", "reaction.created_unix", "reaction.id")
166-
if opts.Page != 0 {
166+
if opts.Page > 0 {
167167
sess = db.SetSessionPagination(sess, &opts)
168168

169169
reactions := make([]*Reaction, 0, opts.PageSize)

models/issues/stopwatch.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ func GetUIDsAndStopwatch(ctx context.Context) ([]*UserStopwatch, error) {
9696
func GetUserStopwatches(ctx context.Context, userID int64, listOptions db.ListOptions) ([]*Stopwatch, error) {
9797
sws := make([]*Stopwatch, 0, 8)
9898
sess := db.GetEngine(ctx).Where("stopwatch.user_id = ?", userID)
99-
if listOptions.Page != 0 {
99+
if listOptions.Page > 0 {
100100
sess = db.SetSessionPagination(sess, &listOptions)
101101
}
102102

models/issues/tracked_time.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ func (opts *FindTrackedTimesOptions) toSession(e db.Engine) db.Engine {
139139

140140
sess = sess.Where(opts.ToConds())
141141

142-
if opts.Page != 0 {
142+
if opts.Page > 0 {
143143
sess = db.SetSessionPagination(sess, opts)
144144
}
145145

0 commit comments

Comments
 (0)