forked from tangled.org/core
this repo has no description

fix a few final bugs

Changed files
+22 -19
appview
pages
templates
fragments
state
+2 -2
appview/pages/templates/fragments/pullActions.html
···
</button>
{{ end }}
-
{{ if and $isPullAuthor $isPushAllowed $isOpen $isLastRound }}
+
{{ if and (or $isPullAuthor $isPushAllowed) $isOpen $isLastRound }}
<button
hx-post="/{{ .RepoInfo.FullName }}/pulls/{{ .Pull.PullId }}/close"
hx-swap="none"
···
</button>
{{ end }}
-
{{ if and $isPullAuthor $isPushAllowed $isClosed $isLastRound }}
+
{{ if and (or $isPullAuthor $isPushAllowed) $isClosed $isLastRound }}
<button
hx-post="/{{ .RepoInfo.FullName }}/pulls/{{ .Pull.PullId }}/reopen"
hx-swap="none"
+13 -10
appview/state/pull.go
···
}
}
-
resp, err := ksClient.MergeCheck([]byte(pull.LatestPatch()), pull.OwnerDid, f.RepoName, pull.TargetBranch)
+
resp, err := ksClient.MergeCheck([]byte(pull.LatestPatch()), f.OwnerDid(), f.RepoName, pull.TargetBranch)
if err != nil {
log.Println("failed to check for mergeability:", err)
-
switch resp.StatusCode {
-
case 400:
-
return types.MergeCheckResponse{
-
Error: "failed to check merge status: does this knot support PRs?",
-
}
-
default:
-
return types.MergeCheckResponse{
-
Error: "failed to check merge status: this knot is unreachable",
-
}
+
return types.MergeCheckResponse{
+
Error: "failed to check merge status",
+
}
+
}
+
switch resp.StatusCode {
+
case 404:
+
return types.MergeCheckResponse{
+
Error: "failed to check merge status: this knot does not support PRs",
+
}
+
case 400:
+
return types.MergeCheckResponse{
+
Error: "failed to check merge status: does this knot support PRs?",
}
}
+7 -7
appview/state/signer.go
···
Method = "POST"
)
endpoint := fmt.Sprintf("/%s/%s/merge", ownerDid, targetRepo)
-
+
mr := types.MergeRequest{
-
Branch: branch,
+
Branch: branch,
CommitMessage: commitMessage,
-
CommitBody: commitBody,
-
AuthorName: authorName,
-
AuthorEmail: authorEmail,
-
Patch: string(patch),
+
CommitBody: commitBody,
+
AuthorName: authorName,
+
AuthorEmail: authorEmail,
+
Patch: string(patch),
}
body, _ := json.Marshal(mr)
···
)
endpoint := fmt.Sprintf("/%s/%s/merge/check", ownerDid, targetRepo)
-
body, _ := json.Marshal(map[string]interface{}{
+
body, _ := json.Marshal(map[string]any{
"patch": string(patch),
"branch": branch,
})