mirror of
https://github.com/go-gitea/gitea
synced 2024-09-27 16:56:49 +02:00
show repo actions correct
This commit is contained in:
parent
de5a3e3941
commit
d85fd31161
@ -519,7 +519,7 @@ func activityQueryCondition(ctx context.Context, opts GetFeedsOptions) (builder.
|
||||
|
||||
includePrivateRepos := opts.RequestedUser != nil && opts.RequestedUser.ActionsVisibility.ShowAll()
|
||||
// check readable repositories by doer/actor
|
||||
if opts.Actor == nil || !includePrivateRepos && !opts.Actor.IsAdmin {
|
||||
if !includePrivateRepos && !opts.Actor.IsAdmin {
|
||||
cond = cond.And(builder.In("repo_id", repo_model.AccessibleRepoIDsQuery(opts.Actor)))
|
||||
}
|
||||
|
||||
|
@ -13,6 +13,7 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"code.gitea.io/gitea/models/organization"
|
||||
user_model "code.gitea.io/gitea/models/user"
|
||||
"code.gitea.io/gitea/modules/base"
|
||||
"code.gitea.io/gitea/modules/markup"
|
||||
@ -176,6 +177,9 @@ func NewFuncMap() template.FuncMap {
|
||||
|
||||
"FilenameIsImage": FilenameIsImage,
|
||||
"TabSizeClass": TabSizeClass,
|
||||
|
||||
// org
|
||||
"IsOrganizationMember": organization.IsOrganizationMember,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -74,14 +74,13 @@ func userProfile(ctx *context.Context) {
|
||||
profileDbRepo, profileGitRepo, profileReadmeBlob, profileClose := shared_user.FindUserProfileReadme(ctx, ctx.Doer)
|
||||
defer profileClose()
|
||||
|
||||
showPrivate := ctx.IsSigned && (ctx.Doer.IsAdmin || ctx.Doer.ID == ctx.ContextUser.ID || ctx.ContextUser.ActionsVisibility.ShowAll())
|
||||
prepareUserProfileTabData(ctx, showPrivate, profileDbRepo, profileGitRepo, profileReadmeBlob)
|
||||
prepareUserProfileTabData(ctx, profileDbRepo, profileGitRepo, profileReadmeBlob)
|
||||
// call PrepareContextForProfileBigAvatar later to avoid re-querying the NumFollowers & NumFollowing
|
||||
shared_user.PrepareContextForProfileBigAvatar(ctx)
|
||||
ctx.HTML(http.StatusOK, tplProfile)
|
||||
}
|
||||
|
||||
func prepareUserProfileTabData(ctx *context.Context, showPrivate bool, profileDbRepo *repo_model.Repository, profileGitRepo *git.Repository, profileReadme *git.Blob) {
|
||||
func prepareUserProfileTabData(ctx *context.Context, profileDbRepo *repo_model.Repository, profileGitRepo *git.Repository, profileReadme *git.Blob) {
|
||||
// if there is a profile readme, default to "overview" page, otherwise, default to "repositories" page
|
||||
// if there is not a profile readme, the overview tab should be treated as the repositories tab
|
||||
tab := ctx.FormString("tab")
|
||||
@ -174,7 +173,7 @@ func prepareUserProfileTabData(ctx *context.Context, showPrivate bool, profileDb
|
||||
items, count, err := activities_model.GetFeeds(ctx, activities_model.GetFeedsOptions{
|
||||
RequestedUser: ctx.ContextUser,
|
||||
Actor: ctx.Doer,
|
||||
IncludePrivate: showPrivate,
|
||||
IncludePrivate: true,
|
||||
OnlyPerformedBy: true,
|
||||
IncludeDeleted: false,
|
||||
Date: date,
|
||||
|
@ -1,6 +1,13 @@
|
||||
<div id="activity-feed" class="flex-list">
|
||||
{{range .Feeds}}
|
||||
{{$isPrivateView := and (not $.IsAdmin) .IsPrivate (ne $.ContextUser.ID $.SignedUserID) (not $.IsOrganizationMember)}}
|
||||
{{$isPrivateView := and (not $.IsAdmin) .IsPrivate (ne $.ContextUser.ID $.SignedUserID)}}
|
||||
{{if $isPrivateView}}
|
||||
{{$isOrganizationMember := $.IsOrganizationMember}}
|
||||
{{if eq $isOrganizationMember nil}}
|
||||
{{$isOrganizationMember = IsOrganizationMember ctx .Repo.Owner.ID $.SignedUserID}}
|
||||
{{end}}
|
||||
{{$isPrivateView = and $isPrivateView (not $isOrganizationMember)}}
|
||||
{{end}}
|
||||
<div class="flex-item">
|
||||
<div class="flex-item-leading">
|
||||
{{ctx.AvatarUtils.AvatarByAction .}}
|
||||
|
Loading…
Reference in New Issue
Block a user