From 4f34095be505c1bc142f0b2dc4931644dc7422eb Mon Sep 17 00:00:00 2001 From: Samuel Shuert Date: Tue, 12 Aug 2025 07:58:42 +0000 Subject: [PATCH] appview: db: Update GetForksByDid Change-Id: zkmkprovpuursmppkoukvtooyykpkotk Signed-off-by: Samuel Shuert --- appview/db/repos.go | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/appview/db/repos.go b/appview/db/repos.go index 61e5029..a55a94d 100644 --- a/appview/db/repos.go +++ b/appview/db/repos.go @@ -467,11 +467,14 @@ func GetForksByDid(e Execer, did string) ([]Repo, error) { var repos []Repo rows, err := e.Query( - `select did, name, knot, rkey, description, created, at_uri, source - from repos - where did = ? and source is not null and source != '' - order by created desc`, - did, + `select distinct r.did, r.name, r.knot, r.rkey, r.description, r.created, r.at_uri, r.source + from repos r + left join collaborators c on r.at_uri = c.repo_at + where (r.did = ? or c.subject_did = ?) + and r.source is not null + and r.source != '' + order by r.created desc`, + did, did, ) if err != nil { return nil, err -- 2.43.0 From 9c938cdaca792e9919d64c50f239599764bf5373 Mon Sep 17 00:00:00 2001 From: Samuel Shuert Date: Tue, 12 Aug 2025 07:58:42 +0000 Subject: [PATCH] appview: pages: Update PRCompare fork page Change-Id: nvwonuuosssxmnwvnuvnkolkmlwytmon 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 Signed-off-by: Samuel Shuert --- .../templates/repo/pulls/fragments/pullCompareForks.html | 4 ++-- appview/pulls/pulls.go | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/appview/pages/templates/repo/pulls/fragments/pullCompareForks.html b/appview/pages/templates/repo/pulls/fragments/pullCompareForks.html index 3dd7903..e48cd4e 100644 --- a/appview/pages/templates/repo/pulls/fragments/pullCompareForks.html +++ b/appview/pages/templates/repo/pulls/fragments/pullCompareForks.html @@ -19,8 +19,8 @@ > {{ range .Forks }} - {{ end }} diff --git a/appview/pulls/pulls.go b/appview/pulls/pulls.go index ddff2e6..5c5828d 100644 --- a/appview/pulls/pulls.go +++ b/appview/pulls/pulls.go @@ -852,7 +852,8 @@ func (s *Pulls) handlePatchBasedPull(w http.ResponseWriter, r *http.Request, f * } 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) { - fork, err := db.GetForkByDid(s.db, user.Did, forkRepo) + splits := strings.SplitN(forkRepo, "/", 2) + fork, err := db.GetForkByDid(s.db, splits[0], splits[1]) if errors.Is(err, sql.ErrNoRows) { s.pages.Notice(w, "pull", "No such fork.") return @@ -1269,9 +1270,9 @@ func (s *Pulls) CompareForksBranchesFragment(w http.ResponseWriter, r *http.Requ } forkVal := r.URL.Query().Get("fork") - + split := strings.SplitN(forkVal, "/", 2) // fork repo - repo, err := db.GetRepo(s.db, user.Did, forkVal) + repo, err := db.GetRepo(s.db, split[0], split[1]) if err != nil { log.Println("failed to get repo", user.Did, forkVal) return -- 2.43.0