this repo has no description

appview: pages: update pr compare fork page

Show fork titles in owner/repo format, otherwise if you have collaborator
access to multiple forks of the same repo (in which the forks have the
same title) it may be hard to differentiate

Also update the underlying logic to use the option value instead of
checking against the currently logged in users DID

Co-Authored-By: oppiliappan <me@oppi.li>
Signed-off-by: Samuel Shuert <me@thecoded.prof>

authored by Samuel Shuert oppiliappan and committed by Anirudh Oppiliappan bb04c7a8 7f658363

Changed files
+13 -8
appview
pages
templates
repo
pulls
+2 -2
appview/pages/templates/repo/pulls/fragments/pullCompareForks.html
··· 19 > 20 <option disabled selected>select a fork</option> 21 {{ range .Forks }} 22 - <option value="{{ .Name }}" {{ if eq .Name $.Selected }}selected{{ end }} class="py-1"> 23 - {{ .Name }} 24 </option> 25 {{ end }} 26 </select>
··· 19 > 20 <option disabled selected>select a fork</option> 21 {{ range .Forks }} 22 + <option value="{{ .Did }}/{{ .Name }}" {{ if eq .Name $.Selected }}selected{{ end }} class="py-1"> 23 + {{ .Did | resolve }}/{{ .Name }} 24 </option> 25 {{ end }} 26 </select>
+1 -1
appview/pages/templates/repo/pulls/fragments/pullHeader.html
··· 17 {{ $icon = "git-merge" }} 18 {{ end }} 19 20 - {{ $owner := resolve .Pull.OwnerDid }} 21 <section class="mt-2"> 22 <div class="flex items-center gap-2"> 23 <div
··· 17 {{ $icon = "git-merge" }} 18 {{ end }} 19 20 + {{ $owner := resolve .Pull.PullSource.Repo.Did }} 21 <section class="mt-2"> 22 <div class="flex items-center gap-2"> 23 <div
+10 -5
appview/pulls/pulls.go
··· 850 } 851 852 func (s *Pulls) handleForkBasedPull(w http.ResponseWriter, r *http.Request, f *reporesolver.ResolvedRepo, user *oauth.User, forkRepo string, title, body, targetBranch, sourceBranch string, isStacked bool) { 853 - fork, err := db.GetForkByDid(s.db, user.Did, forkRepo) 854 if errors.Is(err, sql.ErrNoRows) { 855 s.pages.Notice(w, "pull", "No such fork.") 856 return ··· 908 // hiddenRef: hidden/feature-1/main (on repo-fork) 909 // targetBranch: main (on repo-1) 910 // sourceBranch: feature-1 (on repo-fork) 911 - comparison, err := us.Compare(user.Did, fork.Name, hiddenRef, sourceBranch) 912 if err != nil { 913 log.Println("failed to compare across branches", err) 914 s.pages.Notice(w, "pull", err.Error()) ··· 1271 } 1272 1273 forkVal := r.URL.Query().Get("fork") 1274 - 1275 // fork repo 1276 - repo, err := db.GetRepo(s.db, user.Did, forkVal) 1277 if err != nil { 1278 log.Println("failed to get repo", user.Did, forkVal) 1279 return ··· 1286 return 1287 } 1288 1289 - sourceResult, err := sourceBranchesClient.Branches(user.Did, repo.Name) 1290 if err != nil { 1291 log.Println("failed to reach knotserver for source branches", err) 1292 return
··· 850 } 851 852 func (s *Pulls) handleForkBasedPull(w http.ResponseWriter, r *http.Request, f *reporesolver.ResolvedRepo, user *oauth.User, forkRepo string, title, body, targetBranch, sourceBranch string, isStacked bool) { 853 + repoString := strings.SplitN(forkRepo, "/", 2) 854 + forkOwnerDid := repoString[0] 855 + repoName := repoString[1] 856 + fork, err := db.GetForkByDid(s.db, forkOwnerDid, repoName) 857 if errors.Is(err, sql.ErrNoRows) { 858 s.pages.Notice(w, "pull", "No such fork.") 859 return ··· 911 // hiddenRef: hidden/feature-1/main (on repo-fork) 912 // targetBranch: main (on repo-1) 913 // sourceBranch: feature-1 (on repo-fork) 914 + comparison, err := us.Compare(fork.Did, fork.Name, hiddenRef, sourceBranch) 915 if err != nil { 916 log.Println("failed to compare across branches", err) 917 s.pages.Notice(w, "pull", err.Error()) ··· 1274 } 1275 1276 forkVal := r.URL.Query().Get("fork") 1277 + repoString := strings.SplitN(forkVal, "/", 2) 1278 + forkOwnerDid := repoString[0] 1279 + forkName := repoString[1] 1280 // fork repo 1281 + repo, err := db.GetRepo(s.db, forkOwnerDid, forkName) 1282 if err != nil { 1283 log.Println("failed to get repo", user.Did, forkVal) 1284 return ··· 1291 return 1292 } 1293 1294 + sourceResult, err := sourceBranchesClient.Branches(forkOwnerDid, repo.Name) 1295 if err != nil { 1296 log.Println("failed to reach knotserver for source branches", err) 1297 return