Skip to content

Commit 0a9e0af

Browse files
authored
Merge branch 'main' into lunny/trim_title_match_db
2 parents 577c988 + b4abb6d commit 0a9e0af

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+591
-454
lines changed

.github/workflows/pull-compliance.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
python-version: "3.12"
3838
- uses: actions/setup-node@v4
3939
with:
40-
node-version: 20
40+
node-version: 22
4141
cache: npm
4242
cache-dependency-path: package-lock.json
4343
- run: pip install poetry
@@ -66,7 +66,7 @@ jobs:
6666
- uses: actions/checkout@v4
6767
- uses: actions/setup-node@v4
6868
with:
69-
node-version: 20
69+
node-version: 22
7070
cache: npm
7171
cache-dependency-path: package-lock.json
7272
- run: make deps-frontend
@@ -137,7 +137,7 @@ jobs:
137137
- uses: actions/checkout@v4
138138
- uses: actions/setup-node@v4
139139
with:
140-
node-version: 20
140+
node-version: 22
141141
cache: npm
142142
cache-dependency-path: package-lock.json
143143
- run: make deps-frontend
@@ -186,7 +186,7 @@ jobs:
186186
- uses: actions/checkout@v4
187187
- uses: actions/setup-node@v4
188188
with:
189-
node-version: 20
189+
node-version: 22
190190
cache: npm
191191
cache-dependency-path: package-lock.json
192192
- run: make deps-frontend

.github/workflows/pull-e2e-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
check-latest: true
2424
- uses: actions/setup-node@v4
2525
with:
26-
node-version: 20
26+
node-version: 22
2727
cache: npm
2828
cache-dependency-path: package-lock.json
2929
- run: make deps-frontend frontend deps-backend

.github/workflows/release-nightly.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
check-latest: true
2323
- uses: actions/setup-node@v4
2424
with:
25-
node-version: 20
25+
node-version: 22
2626
cache: npm
2727
cache-dependency-path: package-lock.json
2828
- run: make deps-frontend deps-backend

.github/workflows/release-tag-rc.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
check-latest: true
2424
- uses: actions/setup-node@v4
2525
with:
26-
node-version: 20
26+
node-version: 22
2727
cache: npm
2828
cache-dependency-path: package-lock.json
2929
- run: make deps-frontend deps-backend

.github/workflows/release-tag-version.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
check-latest: true
2626
- uses: actions/setup-node@v4
2727
with:
28-
node-version: 20
28+
node-version: 22
2929
cache: npm
3030
cache-dependency-path: package-lock.json
3131
- run: make deps-frontend deps-backend

flake.lock

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
gzip
2323

2424
# frontend
25-
nodejs_20
25+
nodejs_22
2626

2727
# linting
2828
python312

models/activities/action.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,9 @@ func (a *Action) GetActDisplayNameTitle(ctx context.Context) string {
251251
// GetRepoUserName returns the name of the action repository owner.
252252
func (a *Action) GetRepoUserName(ctx context.Context) string {
253253
a.loadRepo(ctx)
254+
if a.Repo == nil {
255+
return "(non-existing-repo)"
256+
}
254257
return a.Repo.OwnerName
255258
}
256259

@@ -263,6 +266,9 @@ func (a *Action) ShortRepoUserName(ctx context.Context) string {
263266
// GetRepoName returns the name of the action repository.
264267
func (a *Action) GetRepoName(ctx context.Context) string {
265268
a.loadRepo(ctx)
269+
if a.Repo == nil {
270+
return "(non-existing-repo)"
271+
}
266272
return a.Repo.Name
267273
}
268274

models/activities/notification.go

Lines changed: 49 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import (
1818
"code.gitea.io/gitea/modules/timeutil"
1919

2020
"xorm.io/builder"
21+
"xorm.io/xorm/schemas"
2122
)
2223

2324
type (
@@ -50,25 +51,64 @@ const (
5051
// Notification represents a notification
5152
type Notification struct {
5253
ID int64 `xorm:"pk autoincr"`
53-
UserID int64 `xorm:"INDEX NOT NULL"`
54-
RepoID int64 `xorm:"INDEX NOT NULL"`
54+
UserID int64 `xorm:"NOT NULL"`
55+
RepoID int64 `xorm:"NOT NULL"`
5556

56-
Status NotificationStatus `xorm:"SMALLINT INDEX NOT NULL"`
57-
Source NotificationSource `xorm:"SMALLINT INDEX NOT NULL"`
57+
Status NotificationStatus `xorm:"SMALLINT NOT NULL"`
58+
Source NotificationSource `xorm:"SMALLINT NOT NULL"`
5859

59-
IssueID int64 `xorm:"INDEX NOT NULL"`
60-
CommitID string `xorm:"INDEX"`
60+
IssueID int64 `xorm:"NOT NULL"`
61+
CommitID string
6162
CommentID int64
6263

63-
UpdatedBy int64 `xorm:"INDEX NOT NULL"`
64+
UpdatedBy int64 `xorm:"NOT NULL"`
6465

6566
Issue *issues_model.Issue `xorm:"-"`
6667
Repository *repo_model.Repository `xorm:"-"`
6768
Comment *issues_model.Comment `xorm:"-"`
6869
User *user_model.User `xorm:"-"`
6970

70-
CreatedUnix timeutil.TimeStamp `xorm:"created INDEX NOT NULL"`
71-
UpdatedUnix timeutil.TimeStamp `xorm:"updated INDEX NOT NULL"`
71+
CreatedUnix timeutil.TimeStamp `xorm:"created NOT NULL"`
72+
UpdatedUnix timeutil.TimeStamp `xorm:"updated NOT NULL"`
73+
}
74+
75+
// TableIndices implements xorm's TableIndices interface
76+
func (n *Notification) TableIndices() []*schemas.Index {
77+
indices := make([]*schemas.Index, 0, 8)
78+
usuuIndex := schemas.NewIndex("u_s_uu", schemas.IndexType)
79+
usuuIndex.AddColumn("user_id", "status", "updated_unix")
80+
indices = append(indices, usuuIndex)
81+
82+
// Add the individual indices that were previously defined in struct tags
83+
userIDIndex := schemas.NewIndex("idx_notification_user_id", schemas.IndexType)
84+
userIDIndex.AddColumn("user_id")
85+
indices = append(indices, userIDIndex)
86+
87+
repoIDIndex := schemas.NewIndex("idx_notification_repo_id", schemas.IndexType)
88+
repoIDIndex.AddColumn("repo_id")
89+
indices = append(indices, repoIDIndex)
90+
91+
statusIndex := schemas.NewIndex("idx_notification_status", schemas.IndexType)
92+
statusIndex.AddColumn("status")
93+
indices = append(indices, statusIndex)
94+
95+
sourceIndex := schemas.NewIndex("idx_notification_source", schemas.IndexType)
96+
sourceIndex.AddColumn("source")
97+
indices = append(indices, sourceIndex)
98+
99+
issueIDIndex := schemas.NewIndex("idx_notification_issue_id", schemas.IndexType)
100+
issueIDIndex.AddColumn("issue_id")
101+
indices = append(indices, issueIDIndex)
102+
103+
commitIDIndex := schemas.NewIndex("idx_notification_commit_id", schemas.IndexType)
104+
commitIDIndex.AddColumn("commit_id")
105+
indices = append(indices, commitIDIndex)
106+
107+
updatedByIndex := schemas.NewIndex("idx_notification_updated_by", schemas.IndexType)
108+
updatedByIndex.AddColumn("updated_by")
109+
indices = append(indices, updatedByIndex)
110+
111+
return indices
72112
}
73113

74114
func init() {

models/migrations/migrations.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,7 @@ func prepareMigrationTasks() []*migration {
366366
newMigration(306, "Add BlockAdminMergeOverride to ProtectedBranch", v1_23.AddBlockAdminMergeOverrideBranchProtection),
367367
newMigration(307, "Fix milestone deadline_unix when there is no due date", v1_23.FixMilestoneNoDueDate),
368368
newMigration(308, "Add index(user_id, is_deleted) for action table", v1_23.AddNewIndexForUserDashboard),
369+
newMigration(309, "Improve Notification table indices", v1_23.ImproveNotificationTableIndices),
369370
}
370371
return preparedMigrations
371372
}

0 commit comments

Comments
 (0)