@@ -15,6 +15,7 @@ import (
1515 "time"
1616
1717 "code.gitea.io/gitea/models/db"
18+ group_model "code.gitea.io/gitea/models/group"
1819 issues_model "code.gitea.io/gitea/models/issues"
1920 "code.gitea.io/gitea/models/organization"
2021 repo_model "code.gitea.io/gitea/models/repo"
@@ -435,6 +436,7 @@ type GetFeedsOptions struct {
435436 db.ListOptions
436437 RequestedUser * user_model.User // the user we want activity for
437438 RequestedTeam * organization.Team // the team we want activity for
439+ RequestedGroup * group_model.Group // the group we want activity for
438440 RequestedRepo * repo_model.Repository // the repo we want activity for
439441 Actor * user_model.User // the user viewing the activity
440442 IncludePrivate bool // include private actions
@@ -514,8 +516,16 @@ func ActivityQueryCondition(ctx context.Context, opts GetFeedsOptions) (builder.
514516 if opts .Actor == nil || ! opts .Actor .IsAdmin {
515517 cond = cond .And (builder .In ("repo_id" , repo_model .AccessibleRepoIDsQuery (opts .Actor )))
516518 }
517-
518- if opts .RequestedRepo != nil {
519+ if opts .RequestedGroup != nil {
520+ cond = cond .And (builder .In ("`action`.repo_id" ,
521+ builder .Select ("id" ).
522+ From ("repository" ).
523+ Where (builder .Or (
524+ builder .In ("`repository`.group_id" , group_model .ChildGroupCond (opts .RequestedGroup .ID )),
525+ builder.Eq {"`repository`.group_id" : opts .RequestedGroup .ID }),
526+ ),
527+ ))
528+ } else if opts .RequestedRepo != nil {
519529 // repo's actions could have duplicate items, see the comment of NotifyWatchers
520530 // so here we only filter the "original items", aka: user_id == act_user_id
521531 cond = cond .And (
0 commit comments