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

more fixes for issue templates

Changed files
+22 -2
appview
pages
templates
repo
issues
state
+5 -1
appview/pages/templates/repo/issues/issue.html
···
<button type="submit" class="btn mt-2">comment</button>
<div id="issue-comment"></div>
</form>
+
{{ else }}
+
<div class="w-full rounded p-6 drop-shadow-sm bg-white">
+
<a href="/login" class="underline">login</a> to join the discussion
+
</div>
{{ end }}
-
{{ $isIssueAuthor := eq .LoggedInUser.Did .Issue.OwnerDid }}
+
{{ $isIssueAuthor := and .LoggedInUser (eq .LoggedInUser.Did .Issue.OwnerDid) }}
{{ $isRepoCollaborator := .RepoInfo.Roles.IsCollaborator }}
{{ if or $isIssueAuthor $isRepoCollaborator }}
{{ $action := "close" }}
+17 -1
appview/state/repo.go
···
return
}
-
if user.Did == f.OwnerDid() {
+
issue, err := db.GetIssue(s.db, f.RepoAt, issueIdInt)
+
if err != nil {
+
log.Println("failed to get issue", err)
+
s.pages.Notice(w, "issue-action", "Failed to close issue. Try again later.")
+
return
+
}
+
+
collaborators, err := f.Collaborators(r.Context(), s)
+
if err != nil {
+
log.Println("failed to fetch repo collaborators: %w", err)
+
}
+
isCollaborator := slices.ContainsFunc(collaborators, func(collab pages.Collaborator) bool {
+
return user.Did == collab.Did
+
})
+
isIssueOwner := user.Did == issue.OwnerDid
+
+
if isCollaborator || isIssueOwner {
err := db.ReopenIssue(s.db, f.RepoAt, issueIdInt)
if err != nil {
log.Println("failed to reopen issue", err)