From ee35579b2e66a6132f2b8a5422c33a68fa2115ee Mon Sep 17 00:00:00 2001 From: oppiliappan Date: Tue, 4 Nov 2025 06:38:09 +0000 Subject: [PATCH] appview/models: rename Pull.PullAt() to Pull.AtUri() Change-Id: oowrmznwswprotpsnwrpxltzormmqosy in sync with Issue.AtUri. Signed-off-by: oppiliappan --- appview/db/pulls.go | 8 ++++---- appview/models/pull.go | 2 +- appview/notify/db/db.go | 6 +++--- .../templates/repo/pulls/fragments/pullHeader.html | 2 +- appview/pages/templates/repo/pulls/pull.html | 2 +- appview/pulls/pulls.go | 10 +++++----- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/appview/db/pulls.go b/appview/db/pulls.go index ff5d2def..145cefa4 100644 --- a/appview/db/pulls.go +++ b/appview/db/pulls.go @@ -92,7 +92,7 @@ func NewPull(tx *sql.Tx, pull *models.Pull) error { _, err = tx.Exec(` insert into pull_submissions (pull_at, round_number, patch, combined, source_rev) values (?, ?, ?, ?, ?) - `, pull.PullAt(), 0, pull.Submissions[0].Patch, pull.Submissions[0].Combined, pull.Submissions[0].SourceRev) + `, pull.AtUri(), 0, pull.Submissions[0].Patch, pull.Submissions[0].Combined, pull.Submissions[0].SourceRev) return err } @@ -101,7 +101,7 @@ func GetPullAt(e Execer, repoAt syntax.ATURI, pullId int) (syntax.ATURI, error) if err != nil { return "", err } - return pull.PullAt(), err + return pull.AtUri(), err } func NextPullId(e Execer, repoAt syntax.ATURI) (int, error) { @@ -214,12 +214,12 @@ func GetPullsWithLimit(e Execer, limit int, filters ...filter) ([]*models.Pull, pull.ParentChangeId = parentChangeId.String } - pulls[pull.PullAt()] = &pull + pulls[pull.AtUri()] = &pull } var pullAts []syntax.ATURI for _, p := range pulls { - pullAts = append(pullAts, p.PullAt()) + pullAts = append(pullAts, p.AtUri()) } submissionsMap, err := GetPullSubmissions(e, FilterIn("pull_at", pullAts)) if err != nil { diff --git a/appview/models/pull.go b/appview/models/pull.go index 2ca51db7..d8858fca 100644 --- a/appview/models/pull.go +++ b/appview/models/pull.go @@ -167,7 +167,7 @@ func (p *Pull) LatestSha() string { return p.LatestSubmission().SourceRev } -func (p *Pull) PullAt() syntax.ATURI { +func (p *Pull) AtUri() syntax.ATURI { return syntax.ATURI(fmt.Sprintf("at://%s/%s/%s", p.OwnerDid, tangled.RepoPullNSID, p.Rkey)) } diff --git a/appview/notify/db/db.go b/appview/notify/db/db.go index b5c76fab..ef29880f 100644 --- a/appview/notify/db/db.go +++ b/appview/notify/db/db.go @@ -203,7 +203,7 @@ func (n *databaseNotifier) NewPull(ctx context.Context, pull *models.Pull) { actorDid := syntax.DID(pull.OwnerDid) eventType := models.NotificationTypePullCreated entityType := "pull" - entityId := pull.PullAt().String() + entityId := pull.AtUri().String() repoId := &repo.Id var issueId *int64 p := int64(pull.ID) @@ -249,7 +249,7 @@ func (n *databaseNotifier) NewPullComment(ctx context.Context, comment *models.P actorDid := syntax.DID(comment.OwnerDid) eventType := models.NotificationTypePullCommented entityType := "pull" - entityId := pull.PullAt().String() + entityId := pull.AtUri().String() repoId := &repo.Id var issueId *int64 p := int64(pull.ID) @@ -353,7 +353,7 @@ func (n *databaseNotifier) NewPullState(ctx context.Context, actor syntax.DID, p } entityType := "pull" - entityId := pull.PullAt().String() + entityId := pull.AtUri().String() repoId := &repo.Id var issueId *int64 var eventType models.NotificationType diff --git a/appview/pages/templates/repo/pulls/fragments/pullHeader.html b/appview/pages/templates/repo/pulls/fragments/pullHeader.html index 47975e59..d063f566 100644 --- a/appview/pages/templates/repo/pulls/fragments/pullHeader.html +++ b/appview/pages/templates/repo/pulls/fragments/pullHeader.html @@ -75,7 +75,7 @@ "Kind" $kind "Count" $reactionData.Count "IsReacted" (index $.UserReacted $kind) - "ThreadAt" $.Pull.PullAt + "ThreadAt" $.Pull.AtUri "Users" $reactionData.Users) }} {{ end }} diff --git a/appview/pages/templates/repo/pulls/pull.html b/appview/pages/templates/repo/pulls/pull.html index 02f79d16..badd05b1 100644 --- a/appview/pages/templates/repo/pulls/pull.html +++ b/appview/pages/templates/repo/pulls/pull.html @@ -18,7 +18,7 @@ {{ template "repo/fragments/labelPanel" (dict "RepoInfo" $.RepoInfo "Defs" $.LabelDefs - "Subject" $.Pull.PullAt + "Subject" $.Pull.AtUri "State" $.Pull.Labels) }} {{ template "repo/fragments/participants" $.Pull.Participants }} diff --git a/appview/pulls/pulls.go b/appview/pulls/pulls.go index bb4c71fb..577dd8c4 100644 --- a/appview/pulls/pulls.go +++ b/appview/pulls/pulls.go @@ -192,7 +192,7 @@ func (s *Pulls) RepoSinglePull(w http.ResponseWriter, r *http.Request) { m[p.Sha] = p } - reactionMap, err := db.GetReactionMap(s.db, 20, pull.PullAt()) + reactionMap, err := db.GetReactionMap(s.db, 20, pull.AtUri()) if err != nil { log.Println("failed to get pull reactions") s.pages.Notice(w, "pulls", "Failed to load pull. Try again later.") @@ -200,7 +200,7 @@ func (s *Pulls) RepoSinglePull(w http.ResponseWriter, r *http.Request) { userReactions := map[models.ReactionKind]bool{} if user != nil { - userReactions = db.GetReactionStatusMap(s.db, user.Did, pull.PullAt()) + userReactions = db.GetReactionStatusMap(s.db, user.Did, pull.AtUri()) } labelDefs, err := db.GetLabelDefinitions( @@ -752,7 +752,7 @@ func (s *Pulls) PullComment(w http.ResponseWriter, r *http.Request) { Rkey: tid.TID(), Record: &lexutil.LexiconTypeDecoder{ Val: &tangled.RepoPullComment{ - Pull: pull.PullAt().String(), + Pull: pull.AtUri().String(), Body: body, CreatedAt: createdAt, }, @@ -1839,7 +1839,7 @@ func (s *Pulls) resubmitPullHelper( } defer tx.Rollback() - pullAt := pull.PullAt() + pullAt := pull.AtUri() newRoundNumber := len(pull.Submissions) newPatch := patch newSourceRev := sourceRev @@ -2036,7 +2036,7 @@ func (s *Pulls) resubmitStackedPullHelper( } // resubmit the new pull - pullAt := op.PullAt() + pullAt := op.AtUri() newRoundNumber := len(op.Submissions) newPatch := np.LatestPatch() combinedPatch := np.LatestSubmission().Combined -- 2.43.0