aboutsummaryrefslogtreecommitdiffstats
path: root/models/action.go
diff options
context:
space:
mode:
authorJimmy Praet <jimmy.praet@telenet.be>2020-12-27 20:58:03 +0100
committerGitHub <noreply@github.com>2020-12-27 21:58:03 +0200
commit40274b4a935fff50e223751ce3653c2549352b10 (patch)
treea526f098018a04bbb12bccbebc6122ca209fa732 /models/action.go
parent25f8970b2cc5d2c9fd357ef2c60a54886154f6c9 (diff)
downloadgitea-40274b4a935fff50e223751ce3653c2549352b10.tar.gz
gitea-40274b4a935fff50e223751ce3653c2549352b10.zip
Team dashboards (#14159)
Diffstat (limited to 'models/action.go')
-rw-r--r--models/action.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/models/action.go b/models/action.go
index ccf161192e..2fdab7f4e9 100644
--- a/models/action.go
+++ b/models/action.go
@@ -289,6 +289,7 @@ func (a *Action) GetIssueContent() string {
// GetFeedsOptions options for retrieving feeds
type GetFeedsOptions struct {
RequestedUser *User // the user we want activity for
+ RequestedTeam *Team // the team we want activity for
Actor *User // the user viewing the activity
IncludePrivate bool // include private actions
OnlyPerformedBy bool // only actions performed by requested user
@@ -357,6 +358,15 @@ func activityQueryCondition(opts GetFeedsOptions) (builder.Cond, error) {
}
}
+ if opts.RequestedTeam != nil {
+ env := opts.RequestedUser.AccessibleTeamReposEnv(opts.RequestedTeam)
+ teamRepoIDs, err := env.RepoIDs(1, opts.RequestedUser.NumRepos)
+ if err != nil {
+ return nil, fmt.Errorf("GetTeamRepositories: %v", err)
+ }
+ cond = cond.And(builder.In("repo_id", teamRepoIDs))
+ }
+
cond = cond.And(builder.Eq{"user_id": opts.RequestedUser.ID})
if opts.OnlyPerformedBy {