+5
-1
appview/pages/templates/repo/issues/issue.html
+5
-1
appview/pages/templates/repo/issues/issue.html
···
99
99
<button type="submit" class="btn mt-2">comment</button>
100
100
<div id="issue-comment"></div>
101
101
</form>
102
+
{{ else }}
103
+
<div class="w-full rounded p-6 drop-shadow-sm bg-white">
104
+
<a href="/login" class="underline">login</a> to join the discussion
105
+
</div>
102
106
{{ end }}
103
107
104
-
{{ $isIssueAuthor := eq .LoggedInUser.Did .Issue.OwnerDid }}
108
+
{{ $isIssueAuthor := and .LoggedInUser (eq .LoggedInUser.Did .Issue.OwnerDid) }}
105
109
{{ $isRepoCollaborator := .RepoInfo.Roles.IsCollaborator }}
106
110
{{ if or $isIssueAuthor $isRepoCollaborator }}
107
111
{{ $action := "close" }}
+17
-1
appview/state/repo.go
+17
-1
appview/state/repo.go
···
820
820
return
821
821
}
822
822
823
-
if user.Did == f.OwnerDid() {
823
+
issue, err := db.GetIssue(s.db, f.RepoAt, issueIdInt)
824
+
if err != nil {
825
+
log.Println("failed to get issue", err)
826
+
s.pages.Notice(w, "issue-action", "Failed to close issue. Try again later.")
827
+
return
828
+
}
829
+
830
+
collaborators, err := f.Collaborators(r.Context(), s)
831
+
if err != nil {
832
+
log.Println("failed to fetch repo collaborators: %w", err)
833
+
}
834
+
isCollaborator := slices.ContainsFunc(collaborators, func(collab pages.Collaborator) bool {
835
+
return user.Did == collab.Did
836
+
})
837
+
isIssueOwner := user.Did == issue.OwnerDid
838
+
839
+
if isCollaborator || isIssueOwner {
824
840
err := db.ReopenIssue(s.db, f.RepoAt, issueIdInt)
825
841
if err != nil {
826
842
log.Println("failed to reopen issue", err)