tangled
alpha
login
or
join now
lewis.moe
/
tangled-core
forked from
tangled.org/core
1
fork
atom
Monorepo for Tangled
1
fork
atom
overview
issues
1
pulls
pipelines
more fixes for issue templates
oppi.li
1 year ago
e780eb1a
6f9e3143
+22
-2
2 changed files
expand all
collapse all
unified
split
appview
pages
templates
repo
issues
issue.html
state
repo.go
+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
102
+
{{ else }}
103
103
+
<div class="w-full rounded p-6 drop-shadow-sm bg-white">
104
104
+
<a href="/login" class="underline">login</a> to join the discussion
105
105
+
</div>
102
106
{{ end }}
103
107
104
104
-
{{ $isIssueAuthor := eq .LoggedInUser.Did .Issue.OwnerDid }}
108
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
···
820
820
return
821
821
}
822
822
823
823
-
if user.Did == f.OwnerDid() {
823
823
+
issue, err := db.GetIssue(s.db, f.RepoAt, issueIdInt)
824
824
+
if err != nil {
825
825
+
log.Println("failed to get issue", err)
826
826
+
s.pages.Notice(w, "issue-action", "Failed to close issue. Try again later.")
827
827
+
return
828
828
+
}
829
829
+
830
830
+
collaborators, err := f.Collaborators(r.Context(), s)
831
831
+
if err != nil {
832
832
+
log.Println("failed to fetch repo collaborators: %w", err)
833
833
+
}
834
834
+
isCollaborator := slices.ContainsFunc(collaborators, func(collab pages.Collaborator) bool {
835
835
+
return user.Did == collab.Did
836
836
+
})
837
837
+
isIssueOwner := user.Did == issue.OwnerDid
838
838
+
839
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)