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

allow collaborators to close issues

Changed files
+12 -5
appview
pages
templates
repo
issues
+9 -4
appview/pages/pages.go
··· 231 return slices.Contains(r.Roles, "repo:owner") 232 } 233 234 func (r RepoInfo) OwnerWithAt() string { 235 if r.OwnerHandle != "" { 236 return fmt.Sprintf("@%s", r.OwnerHandle) ··· 441 } 442 443 type RepoSettingsParams struct { 444 - LoggedInUser *auth.User 445 - RepoInfo RepoInfo 446 - Collaborators []Collaborator 447 - Active string 448 IsCollaboratorInviteAllowed bool 449 } 450
··· 231 return slices.Contains(r.Roles, "repo:owner") 232 } 233 234 + func (r RolesInRepo) IsCollaborator() bool { 235 + return slices.Contains(r.Roles, "repo:collaborator") 236 + } 237 + 238 func (r RepoInfo) OwnerWithAt() string { 239 if r.OwnerHandle != "" { 240 return fmt.Sprintf("@%s", r.OwnerHandle) ··· 445 } 446 447 type RepoSettingsParams struct { 448 + LoggedInUser *auth.User 449 + RepoInfo RepoInfo 450 + Collaborators []Collaborator 451 + Active string 452 + // TODO: use repoinfo.roles 453 IsCollaboratorInviteAllowed bool 454 } 455
+3 -1
appview/pages/templates/repo/issues/issue.html
··· 101 </form> 102 {{ end }} 103 104 - {{ if eq .LoggedInUser.Did .Issue.OwnerDid }} 105 {{ $action := "close" }} 106 {{ $icon := "circle-x" }} 107 {{ $hoverColor := "red" }}
··· 101 </form> 102 {{ end }} 103 104 + {{ $isIssueAuthor := eq .LoggedInUser.Did .Issue.OwnerDid }} 105 + {{ $isRepoCollaborator := .RepoInfo.Roles.IsCollaborator }} 106 + {{ if or $isIssueAuthor $isRepoCollaborator }} 107 {{ $action := "close" }} 108 {{ $icon := "circle-x" }} 109 {{ $hoverColor := "red" }}