+4
appview/pages/pages.go
+4
appview/pages/pages.go
···
235
235
return slices.Contains(r.Roles, "repo:collaborator")
236
236
}
237
237
238
+
func (r RolesInRepo) IsPushAllowed() bool {
239
+
return slices.Contains(r.Roles, "repo:push")
240
+
}
241
+
238
242
func (r RepoInfo) OwnerWithAt() string {
239
243
if r.OwnerHandle != "" {
240
244
return fmt.Sprintf("@%s", r.OwnerHandle)
+6
-6
appview/pages/templates/repo/pulls/pull.html
+6
-6
appview/pages/templates/repo/pulls/pull.html
···
152
152
153
153
{{ define "repoAfter" }}
154
154
{{ $isPullAuthor := and .LoggedInUser (eq .LoggedInUser.Did .Pull.OwnerDid) }}
155
-
{{ $isRepoCollaborator := .RepoInfo.Roles.IsCollaborator }}
155
+
{{ $isPushAllowed := .RepoInfo.Roles.IsPushAllowed }}
156
156
157
157
<section id="comments" class="mt-8 space-y-4 relative">
158
158
{{ block "comments" . }} {{ end }}
···
161
161
{{ block "alreadyMergedCard" . }} {{ end }}
162
162
{{ else if .MergeCheck }}
163
163
{{ if .MergeCheck.IsConflicted }}
164
-
{{ block "isConflictedCard" . }} {{ end }}
164
+
{{ block "isConflictedCard" $ }} {{ end }}
165
165
{{ else }}
166
-
{{ block "noConflictsCard" . }} {{ end }}
166
+
{{ block "noConflictsCard" $ }} {{ end }}
167
167
{{ end }}
168
168
{{ end }}
169
169
</section>
170
170
171
171
{{ block "newComment" . }} {{ end }}
172
172
173
-
{{ if and (or $isPullAuthor $isRepoCollaborator) (not .Pull.State.IsMerged) }}
173
+
{{ if and (or $isPullAuthor $isPushAllowed) (not .Pull.State.IsMerged) }}
174
174
{{ $action := "close" }}
175
175
{{ $icon := "circle-x" }}
176
176
{{ $hoverColor := "red" }}
···
324
324
325
325
326
326
{{ define "noConflictsCard" }}
327
-
{{ $isRepoCollaborator := .RepoInfo.Roles.IsCollaborator }}
327
+
{{ $isPushAllowed := .RepoInfo.Roles.IsPushAllowed }}
328
328
<div
329
329
id="merge-status-card"
330
330
class="rounded relative border bg-green-50 border-green-200 p-4">
···
345
345
</div>
346
346
347
347
<div class="mt-4 flex items-center gap-2">
348
-
{{ if $isRepoCollaborator }}
348
+
{{ if $isPushAllowed }}
349
349
<button
350
350
class="btn flex items-center gap-2"
351
351
hx-post="/{{ .RepoInfo.FullName }}/pulls/{{ .Pull.PullId }}/merge"
+1
-1
appview/state/router.go
+1
-1
appview/state/router.go