diff --git a/appview/pages/templates/repo/pulls/pull.html b/appview/pages/templates/repo/pulls/pull.html index 93a6329..284ad85 100644 --- a/appview/pages/templates/repo/pulls/pull.html +++ b/appview/pages/templates/repo/pulls/pull.html @@ -66,27 +66,6 @@ - {{ $isPullAuthor := and .LoggedInUser (eq .LoggedInUser.Did .Pull.OwnerDid) }} - {{ $isPushAllowed := .RepoInfo.Roles.IsPushAllowed }} - - {{ if and $isPullAuthor (not .Pull.State.IsMerged) }} -
- {{ block "resubmitCard" . }} {{ end }} -
- {{ end }} - -
- {{ if .Pull.State.IsMerged }} - {{ block "alreadyMergedCard" . }} {{ end }} - {{ else if .MergeCheck }} - {{ if .MergeCheck.IsConflicted }} - {{ block "isConflictedCard" $ }} {{ end }} - {{ else }} - {{ block "noConflictsCard" $ }} {{ end }} - {{ end }} - {{ end }} -
-
{{ end }} @@ -100,7 +79,7 @@ {{ with $item }} {{ $oneIndexedRound := add .RoundNumber 1 }}
- +
#{{ $oneIndexedRound }} @@ -110,7 +89,7 @@ {{ $owner := index $.DidHandleMap $.Pull.OwnerDid }} submitted by {{ $owner }} - + {{ $s := "s" }} {{ if eq (len .Comments) 1 }} @@ -138,14 +117,119 @@
{{ end }} - {{ block "newComment" (list $ .ID) }} {{ end }} + + {{ block "mergeStatus" $ }} {{ end }} + + {{ if $.LoggedInUser }} + {{ block "actions" (list $ .ID) }} {{ end }} + {{ else }} +
+
+ login to join the discussion +
+ {{ end }}
-
{{ end }} {{ end }} {{ end }} +{{ define "mergeStatus" }} + {{ if .Pull.State.IsMerged }} +
+
+
+ + pull request successfully merged +
+
+ {{ else if and .MergeCheck .MergeCheck.IsConflicted }} +
+
+
+ + merge conflicts detected + +
+
+ {{ else if .MergeCheck }} +
+
+
+ + no conflicts, ready to merge +
+
+ {{ end }} +{{ end }} + +{{ define "actions" }} + {{ $rootObj := index . 0 }} + {{ $submissionId := index . 1 }} + + {{ with $rootObj }} + {{ $isPushAllowed := .RepoInfo.Roles.IsPushAllowed }} + {{ $isMerged := .Pull.State.IsMerged }} + {{ $isClosed := .Pull.State.IsClosed }} + {{ $isOpen := .Pull.State.IsOpen }} + {{ $isConflicted := and .MergeCheck .MergeCheck.IsConflicted }} + {{ $isPullAuthor := and .LoggedInUser (eq .LoggedInUser.Did .Pull.OwnerDid) }} +
+
+
+ + {{ if and $isPushAllowed $isOpen }} + {{ $disabled := "" }} + {{ if $isConflicted }} + {{ $disabled = "disabled" }} + {{ end }} + + {{ end }} + + {{ if and $isPullAuthor $isOpen }} + + {{ end }} + + {{ if and $isPullAuthor $isPushAllowed $isOpen }} + + {{ end }} + + {{ if and $isPullAuthor $isPushAllowed $isClosed }} + + {{ end }} +
+
+ {{ end }} +{{ end }} + {{ define "newComment" }} {{ $rootObj := index . 0 }} {{ $submissionId := index . 1 }} diff --git a/appview/state/pull.go b/appview/state/pull.go index 218801f..dc9094b 100644 --- a/appview/state/pull.go +++ b/appview/state/pull.go @@ -94,6 +94,8 @@ func (s *State) RepoSinglePull(w http.ResponseWriter, r *http.Request) { } } + log.Println(mergeCheckResponse) + s.pages.RepoSinglePull(w, pages.RepoSinglePullParams{ LoggedInUser: user, RepoInfo: f.RepoInfo(s, user),