Monorepo for Tangled tangled.org

appview: fix pull header template

Changed files
+40 -37
appview
db
pages
templates
repo
pulls
state
+12
appview/db/pulls.go
··· 654 654 return nil, err 655 655 } 656 656 657 + var pullSourceRepo *Repo 658 + if pull.PullSource != nil { 659 + if pull.PullSource.RepoAt != nil { 660 + pullSourceRepo, err = GetRepoByAtUri(e, pull.PullSource.RepoAt.String()) 661 + if err != nil { 662 + log.Printf("failed to get repo by at uri: %v", err) 663 + } else { 664 + pull.PullSource.Repo = pullSourceRepo 665 + } 666 + } 667 + } 668 + 657 669 pull.Submissions = make([]*PullSubmission, len(submissionsMap)) 658 670 for _, submission := range submissionsMap { 659 671 pull.Submissions[submission.RoundNumber] = submission
+7 -8
appview/pages/pages.go
··· 679 679 } 680 680 681 681 type RepoSinglePullParams struct { 682 - LoggedInUser *auth.User 683 - RepoInfo RepoInfo 684 - Active string 685 - DidHandleMap map[string]string 686 - Pull *db.Pull 687 - PullSourceRepo *db.Repo 688 - MergeCheck types.MergeCheckResponse 689 - ResubmitCheck ResubmitResult 682 + LoggedInUser *auth.User 683 + RepoInfo RepoInfo 684 + Active string 685 + DidHandleMap map[string]string 686 + Pull *db.Pull 687 + MergeCheck types.MergeCheckResponse 688 + ResubmitCheck ResubmitResult 690 689 } 691 690 692 691 func (p *Pages) RepoSinglePull(w io.Writer, params RepoSinglePullParams) error {
+8 -8
appview/pages/templates/repo/pulls/fragments/pullHeader.html
··· 43 43 </span> 44 44 {{ if not .Pull.IsPatchBased }} 45 45 <span>from 46 - {{ if not .Pull.IsBranchBased }} 47 - <a href="/{{ $owner }}/{{ .PullSourceRepo.Name }}" class="no-underline hover:underline">{{ $owner }}/{{ .PullSourceRepo.Name }}</a> 46 + {{ if .Pull.IsForkBased }} 47 + {{ if .Pull.PullSource.Repo }} 48 + <a href="/{{ $owner }}/{{ .Pull.PullSource.Repo.Name }}" class="no-underline hover:underline">{{ $owner }}/{{ .Pull.PullSource.Repo.Name }}</a> 49 + {{ else }} 50 + <span class="italic">[deleted fork]</span> 51 + {{ end }} 48 52 {{ end }} 49 53 50 - {{ $fullRepo := .RepoInfo.FullName }} 51 - {{ if not .Pull.IsBranchBased }} 52 - {{ $fullRepo = printf "%s/%s" $owner .PullSourceRepo.Name }} 53 - {{ end }} 54 54 <span class="text-xs rounded bg-gray-100 dark:bg-gray-700 text-black dark:text-white font-mono px-2 mx-1/2 inline-flex items-center"> 55 - <a href="/{{ $fullRepo }}/tree/{{ .Pull.PullSource.Branch }}" class="no-underline hover:underline">{{ .Pull.PullSource.Branch }}</a> 55 + {{ .Pull.PullSource.Branch }} 56 56 </span> 57 57 </span> 58 58 {{ end }} ··· 67 67 </section> 68 68 69 69 70 - {{ end }} 70 + {{ end }}
+7 -3
appview/pages/templates/repo/pulls/pull.html
··· 90 90 <div class="text-sm text-gray-500 dark:text-gray-400"> 91 91 {{ if not $.Pull.IsPatchBased }} 92 92 {{ $fullRepo := $.RepoInfo.FullName }} 93 - {{ if not $.Pull.IsBranchBased }} 94 - {{ $fullRepo = printf "%s/%s" $owner $.PullSourceRepo.Name }} 93 + {{ if $.Pull.IsForkBased }} 94 + {{ if $.Pull.PullSource.Repo }} 95 + {{ $fullRepo = printf "%s/%s" $owner $.Pull.PullSource.Repo.Name }} 96 + <a href="/{{ $fullRepo }}/commit/{{ .SHA }}" class="font-mono text-gray-500 dark:text-gray-400">{{ slice .SHA 0 8 }}</a> 97 + {{ else }} 98 + <span class="font-mono">{{ slice .SHA 0 8 }}</span> 99 + {{ end }} 95 100 {{ end }} 96 - <a href="/{{ $fullRepo }}/commit/{{ .SHA }}" class="font-mono text-gray-500 dark:text-gray-400">{{ slice .SHA 0 8 }}</a> 97 101 {{ else }} 98 102 <span class="font-mono">{{ slice .SHA 0 8 }}</span> 99 103 {{ end }}
+6 -18
appview/state/pull.go
··· 120 120 resubmitResult = s.resubmitCheck(f, pull) 121 121 } 122 122 123 - var pullSourceRepo *db.Repo 124 - if pull.PullSource != nil { 125 - if pull.PullSource.RepoAt != nil { 126 - pullSourceRepo, err = db.GetRepoByAtUri(s.db, pull.PullSource.RepoAt.String()) 127 - if err != nil { 128 - log.Printf("failed to get repo by at uri: %v", err) 129 - return 130 - } 131 - } 132 - } 133 - 134 123 s.pages.RepoSinglePull(w, pages.RepoSinglePullParams{ 135 - LoggedInUser: user, 136 - RepoInfo: f.RepoInfo(s, user), 137 - DidHandleMap: didHandleMap, 138 - Pull: pull, 139 - PullSourceRepo: pullSourceRepo, 140 - MergeCheck: mergeCheckResponse, 141 - ResubmitCheck: resubmitResult, 124 + LoggedInUser: user, 125 + RepoInfo: f.RepoInfo(s, user), 126 + DidHandleMap: didHandleMap, 127 + Pull: pull, 128 + MergeCheck: mergeCheckResponse, 129 + ResubmitCheck: resubmitResult, 142 130 }) 143 131 } 144 132