tangled
alpha
login
or
join now
moll.dev
/
core
forked from
tangled.org/core
this repo has no description
0
fork
atom
overview
issues
pulls
pipelines
change merge-permissions to repo:push
oppi.li
10 months ago
c2e645e0
a2c54a1b
+11
-7
3 changed files
expand all
collapse all
unified
split
appview
pages
pages.go
templates
repo
pulls
pull.html
state
router.go
+4
appview/pages/pages.go
···
235
235
return slices.Contains(r.Roles, "repo:collaborator")
236
236
}
237
237
238
238
+
func (r RolesInRepo) IsPushAllowed() bool {
239
239
+
return slices.Contains(r.Roles, "repo:push")
240
240
+
}
241
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
···
152
152
153
153
{{ define "repoAfter" }}
154
154
{{ $isPullAuthor := and .LoggedInUser (eq .LoggedInUser.Did .Pull.OwnerDid) }}
155
155
-
{{ $isRepoCollaborator := .RepoInfo.Roles.IsCollaborator }}
155
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
164
-
{{ block "isConflictedCard" . }} {{ end }}
164
164
+
{{ block "isConflictedCard" $ }} {{ end }}
165
165
{{ else }}
166
166
-
{{ block "noConflictsCard" . }} {{ end }}
166
166
+
{{ block "noConflictsCard" $ }} {{ end }}
167
167
{{ end }}
168
168
{{ end }}
169
169
</section>
170
170
171
171
{{ block "newComment" . }} {{ end }}
172
172
173
173
-
{{ if and (or $isPullAuthor $isRepoCollaborator) (not .Pull.State.IsMerged) }}
173
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
327
-
{{ $isRepoCollaborator := .RepoInfo.Roles.IsCollaborator }}
327
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
348
-
{{ if $isRepoCollaborator }}
348
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
···
76
76
r.Post("/reopen", s.ReopenPull)
77
77
// collaborators only
78
78
r.Group(func(r chi.Router) {
79
79
-
r.Use(RepoPermissionMiddleware(s, "repo:collaborator"))
79
79
+
r.Use(RepoPermissionMiddleware(s, "repo:push"))
80
80
r.Post("/merge", s.MergePull)
81
81
// maybe lock, etc.
82
82
})