diff options
author | 6543 <6543@obermui.de> | 2022-03-10 15:54:51 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-10 15:54:51 +0100 |
commit | cc98737ca81d9552f20c277e6ad0031927f9b757 (patch) | |
tree | 5db0ddab8b4aec4586d18ee30a7586f14661be80 /routers/web/feed/profile.go | |
parent | 5fdd30423eac1f9de8546461e11d5fde26bc7d7c (diff) | |
download | gitea-cc98737ca81d9552f20c277e6ad0031927f9b757.tar.gz gitea-cc98737ca81d9552f20c277e6ad0031927f9b757.zip |
RSS/Atom support for Orgs (#17714)
part of #569
Diffstat (limited to 'routers/web/feed/profile.go')
-rw-r--r-- | routers/web/feed/profile.go | 45 |
1 files changed, 24 insertions, 21 deletions
diff --git a/routers/web/feed/profile.go b/routers/web/feed/profile.go index 1a7f4ad24b..4c1eff04a9 100644 --- a/routers/web/feed/profile.go +++ b/routers/web/feed/profile.go @@ -23,31 +23,34 @@ func RetrieveFeeds(ctx *context.Context, options models.GetFeedsOptions) []*mode return nil } - userCache := map[int64]*user_model.User{options.RequestedUser.ID: options.RequestedUser} - if ctx.User != nil { - userCache[ctx.User.ID] = ctx.User - } - for _, act := range actions { - if act.ActUser != nil { - userCache[act.ActUserID] = act.ActUser + // TODO: move load repoOwner of act.Repo into models.GetFeeds->loadAttributes() + { + userCache := map[int64]*user_model.User{options.RequestedUser.ID: options.RequestedUser} + if ctx.User != nil { + userCache[ctx.User.ID] = ctx.User } - } - - for _, act := range actions { - repoOwner, ok := userCache[act.Repo.OwnerID] - if !ok { - repoOwner, err = user_model.GetUserByID(act.Repo.OwnerID) - if err != nil { - if user_model.IsErrUserNotExist(err) { - continue + for _, act := range actions { + if act.ActUser != nil { + userCache[act.ActUserID] = act.ActUser + } + } + for _, act := range actions { + repoOwner, ok := userCache[act.Repo.OwnerID] + if !ok { + repoOwner, err = user_model.GetUserByID(act.Repo.OwnerID) + if err != nil { + if user_model.IsErrUserNotExist(err) { + continue + } + ctx.ServerError("GetUserByID", err) + return nil } - ctx.ServerError("GetUserByID", err) - return nil + userCache[repoOwner.ID] = repoOwner } - userCache[repoOwner.ID] = repoOwner + act.Repo.Owner = repoOwner } - act.Repo.Owner = repoOwner } + return actions } @@ -57,7 +60,7 @@ func ShowUserFeed(ctx *context.Context, ctxUser *user_model.User, formatType str RequestedUser: ctxUser, Actor: ctx.User, IncludePrivate: false, - OnlyPerformedBy: true, + OnlyPerformedBy: !ctxUser.IsOrganization(), IncludeDeleted: false, Date: ctx.FormString("date"), }) |