From c2e645e0ab82fcd0a5b28c9af69091bc1739e39d Mon Sep 17 00:00:00 2001 From: Akshay Date: Sat, 15 Mar 2025 10:09:36 +0000 Subject: [PATCH] change merge-permissions to repo:push --- appview/pages/pages.go | 4 ++++ appview/pages/templates/repo/pulls/pull.html | 12 ++++++------ appview/state/router.go | 2 +- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/appview/pages/pages.go b/appview/pages/pages.go index 7e1de38d..eb2c7986 100644 --- a/appview/pages/pages.go +++ b/appview/pages/pages.go @@ -235,6 +235,10 @@ func (r RolesInRepo) IsCollaborator() bool { return slices.Contains(r.Roles, "repo:collaborator") } +func (r RolesInRepo) IsPushAllowed() bool { + return slices.Contains(r.Roles, "repo:push") +} + func (r RepoInfo) OwnerWithAt() string { if r.OwnerHandle != "" { return fmt.Sprintf("@%s", r.OwnerHandle) diff --git a/appview/pages/templates/repo/pulls/pull.html b/appview/pages/templates/repo/pulls/pull.html index bedc734b..c4910854 100644 --- a/appview/pages/templates/repo/pulls/pull.html +++ b/appview/pages/templates/repo/pulls/pull.html @@ -152,7 +152,7 @@ {{ define "repoAfter" }} {{ $isPullAuthor := and .LoggedInUser (eq .LoggedInUser.Did .Pull.OwnerDid) }} - {{ $isRepoCollaborator := .RepoInfo.Roles.IsCollaborator }} + {{ $isPushAllowed := .RepoInfo.Roles.IsPushAllowed }}
{{ block "comments" . }} {{ end }} @@ -161,16 +161,16 @@ {{ block "alreadyMergedCard" . }} {{ end }} {{ else if .MergeCheck }} {{ if .MergeCheck.IsConflicted }} - {{ block "isConflictedCard" . }} {{ end }} + {{ block "isConflictedCard" $ }} {{ end }} {{ else }} - {{ block "noConflictsCard" . }} {{ end }} + {{ block "noConflictsCard" $ }} {{ end }} {{ end }} {{ end }}
{{ block "newComment" . }} {{ end }} - {{ if and (or $isPullAuthor $isRepoCollaborator) (not .Pull.State.IsMerged) }} + {{ if and (or $isPullAuthor $isPushAllowed) (not .Pull.State.IsMerged) }} {{ $action := "close" }} {{ $icon := "circle-x" }} {{ $hoverColor := "red" }} @@ -324,7 +324,7 @@ {{ define "noConflictsCard" }} - {{ $isRepoCollaborator := .RepoInfo.Roles.IsCollaborator }} + {{ $isPushAllowed := .RepoInfo.Roles.IsPushAllowed }}
@@ -345,7 +345,7 @@
- {{ if $isRepoCollaborator }} + {{ if $isPushAllowed }}