Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 10 additions & 14 deletions routers/api/v1/org/member.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,18 +236,16 @@ func PublicizeMember(ctx *context.APIContext) {
if ctx.Written() {
return
}
allowed := userToPublicize.ID != ctx.Doer.ID && !ctx.Doer.IsAdmin
if !allowed {
if userToPublicize.ID != ctx.Doer.ID && !ctx.Doer.IsAdmin {
isOwner, err := ctx.Org.Organization.IsOwnedBy(ctx, ctx.Doer.ID)
if err != nil {
ctx.Error(http.StatusInternalServerError, "ChangeOrgUserStatus", err)
return
}
allowed = isOwner
}
if !allowed {
ctx.Error(http.StatusForbidden, "", "Cannot publicize another member")
return
if !isOwner {
ctx.Error(http.StatusForbidden, "", "Cannot publicize another member")
return
}
}
err := organization.ChangeOrgUserStatus(ctx, ctx.Org.Organization.ID, userToPublicize.ID, true)
if err != nil {
Expand Down Expand Up @@ -287,18 +285,16 @@ func ConcealMember(ctx *context.APIContext) {
if ctx.Written() {
return
}
allowed := userToConceal.ID != ctx.Doer.ID && !ctx.Doer.IsAdmin
if !allowed {
if userToConceal.ID != ctx.Doer.ID && !ctx.Doer.IsAdmin {
isOwner, err := ctx.Org.Organization.IsOwnedBy(ctx, ctx.Doer.ID)
if err != nil {
ctx.Error(http.StatusInternalServerError, "ChangeOrgUserStatus", err)
return
}
allowed = isOwner
}
if !allowed {
ctx.Error(http.StatusForbidden, "", "Cannot conceal another member")
return
if !isOwner {
ctx.Error(http.StatusForbidden, "", "Cannot conceal another member")
return
}
}
err := organization.ChangeOrgUserStatus(ctx, ctx.Org.Organization.ID, userToConceal.ID, false)
if err != nil {
Expand Down