@@ -15,7 +15,6 @@ import (
15
15
16
16
"code.gitea.io/gitea/models/db"
17
17
git_model "code.gitea.io/gitea/models/git"
18
- access_model "code.gitea.io/gitea/models/perm/access"
19
18
repo_model "code.gitea.io/gitea/models/repo"
20
19
unit_model "code.gitea.io/gitea/models/unit"
21
20
user_model "code.gitea.io/gitea/models/user"
@@ -31,6 +30,7 @@ import (
31
30
"code.gitea.io/gitea/routers/web/feed"
32
31
"code.gitea.io/gitea/services/context"
33
32
repo_service "code.gitea.io/gitea/services/repository"
33
+ "code.gitea.io/gitea/services/uinotification"
34
34
)
35
35
36
36
func checkOutdatedBranch (ctx * context.Context ) {
@@ -196,56 +196,6 @@ func prepareUpstreamDivergingInfo(ctx *context.Context) {
196
196
ctx .Data ["UpstreamDivergingInfo" ] = upstreamDivergingInfo
197
197
}
198
198
199
- func prepareRecentlyPushedNewBranches (ctx * context.Context ) {
200
- if ctx .Doer != nil {
201
- if err := ctx .Repo .Repository .GetBaseRepo (ctx ); err != nil {
202
- ctx .ServerError ("GetBaseRepo" , err )
203
- return
204
- }
205
-
206
- opts := & git_model.FindRecentlyPushedNewBranchesOptions {
207
- Repo : ctx .Repo .Repository ,
208
- BaseRepo : ctx .Repo .Repository ,
209
- }
210
- if ctx .Repo .Repository .IsFork {
211
- opts .BaseRepo = ctx .Repo .Repository .BaseRepo
212
- }
213
-
214
- baseRepoPerm , err := access_model .GetUserRepoPermission (ctx , opts .BaseRepo , ctx .Doer )
215
- if err != nil {
216
- ctx .ServerError ("GetUserRepoPermission" , err )
217
- return
218
- }
219
-
220
- if ! opts .Repo .IsMirror && ! opts .BaseRepo .IsMirror &&
221
- opts .BaseRepo .UnitEnabled (ctx , unit_model .TypePullRequests ) &&
222
- baseRepoPerm .CanRead (unit_model .TypePullRequests ) {
223
- var finalBranches []* git_model.RecentlyPushedNewBranch
224
- branches , err := git_model .FindRecentlyPushedNewBranches (ctx , ctx .Doer , opts )
225
- if err != nil {
226
- log .Error ("FindRecentlyPushedNewBranches failed: %v" , err )
227
- }
228
-
229
- for _ , branch := range branches {
230
- divergingInfo , err := repo_service .GetBranchDivergingInfo (ctx ,
231
- branch .BranchRepo , branch .BranchName , // "base" repo for diverging info
232
- opts .BaseRepo , opts .BaseRepo .DefaultBranch , // "head" repo for diverging info
233
- )
234
- if err != nil {
235
- log .Error ("GetBranchDivergingInfo failed: %v" , err )
236
- continue
237
- }
238
- branchRepoHasNewCommits := divergingInfo .BaseHasNewCommits
239
- baseRepoCommitsBehind := divergingInfo .HeadCommitsBehind
240
- if branchRepoHasNewCommits || baseRepoCommitsBehind > 0 {
241
- finalBranches = append (finalBranches , branch )
242
- }
243
- }
244
- ctx .Data ["RecentlyPushedNewBranches" ] = finalBranches
245
- }
246
- }
247
- }
248
-
249
199
func updateContextRepoEmptyAndStatus (ctx * context.Context , empty bool , status repo_model.RepositoryStatus ) {
250
200
if ctx .Repo .Repository .IsEmpty == empty && ctx .Repo .Repository .Status == status {
251
201
return
@@ -471,7 +421,7 @@ func Home(ctx *context.Context) {
471
421
prepareHomeSidebarRepoTopics ,
472
422
checkOutdatedBranch ,
473
423
prepareToRenderDirOrFile (entry ),
474
- prepareRecentlyPushedNewBranches ,
424
+ uinotification . PrepareRecentlyPushedNewBranches ,
475
425
}
476
426
477
427
if isTreePathRoot {
0 commit comments