1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-22 18:28:37 +00:00

Team dashboards (#14159)

This commit is contained in:
Jimmy Praet
2020-12-27 20:58:03 +01:00
committed by GitHub
parent 25f8970b2c
commit 40274b4a93
12 changed files with 148 additions and 47 deletions

View File

@@ -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 {