Mirror of @tangled.org/core. Running on a Raspberry Pi Zero 2 (Please be gentle).
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

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