alpha
Login
or
Join now
tangled.org
/
core
Star
2
Fork
66
Atom
Configure Feed
Issues
Pull Requests
Commits
Tags
Feed URL
Select the types of activity you want to include in your feed.
Monorepo for Tangled
tangled.org
Star
2
Fork
66
Atom
Configure Feed
Issues
Pull Requests
Commits
Tags
Feed URL
Select the types of activity you want to include in your feed.
Overview
Issues
11
Pulls
25
Pipelines
appview: db: avoid setting PullAt
author
Akshay
committer
Tangled
date
1 year ago
(Apr 29, 2025, 6:03 PM UTC)
commit
79ed2d0a
79ed2d0a8374b4803d37ba9a3eb466ec20b81cca
parent
9b359e68
9b359e6870da717f5d334ff249a3e3dd4f8d3e6a
+14
-18
2 changed files
Expand all
Collapse all
Unified
Split
appview
db
pulls.go
state
pull.go
+11
-14
appview/db/pulls.go
Reviewed
···
10
10
11
11
"github.com/bluekeyes/go-gitdiff/gitdiff"
12
12
"github.com/bluesky-social/indigo/atproto/syntax"
13
13
+
tangled "tangled.sh/tangled.sh/core/api/tangled"
13
14
"tangled.sh/tangled.sh/core/patchutil"
14
15
"tangled.sh/tangled.sh/core/types"
15
16
)
···
54
55
RepoAt syntax.ATURI
55
56
OwnerDid string
56
57
Rkey string
57
57
-
PullAt syntax.ATURI
58
58
59
59
// content
60
60
Title string
···
118
118
func (p *Pull) LatestPatch() string {
119
119
latestSubmission := p.Submissions[p.LastRoundNumber()]
120
120
return latestSubmission.Patch
121
121
+
}
122
122
+
123
123
+
func (p *Pull) PullAt() syntax.ATURI {
124
124
+
return syntax.ATURI(fmt.Sprintf("at://%s/%s/%s", p.OwnerDid, tangled.RepoPullNSID, p.Rkey))
121
125
}
122
126
123
127
func (p *Pull) LastRoundNumber() int {
···
298
302
return nil
299
303
}
300
304
301
301
-
func SetPullAt(e Execer, repoAt syntax.ATURI, pullId int, pullAt string) error {
302
302
-
_, err := e.Exec(`update pulls set pull_at = ? where repo_at = ? and pull_id = ?`, pullAt, repoAt, pullId)
303
303
-
return err
304
304
-
}
305
305
-
306
306
-
func GetPullAt(e Execer, repoAt syntax.ATURI, pullId int) (string, error) {
307
307
-
var pullAt string
308
308
-
err := e.QueryRow(`select pull_at from pulls where repo_at = ? and pull_id = ?`, repoAt, pullId).Scan(&pullAt)
309
309
-
return pullAt, err
305
305
+
func GetPullAt(e Execer, repoAt syntax.ATURI, pullId int) (syntax.ATURI, error) {
306
306
+
pull, err := GetPull(e, repoAt, pullId)
307
307
+
if err != nil {
308
308
+
return "", err
309
309
+
}
310
310
+
return pull.PullAt(), err
310
311
}
311
312
312
313
func NextPullId(e Execer, repoAt syntax.ATURI) (int, error) {
···
326
327
title,
327
328
state,
328
329
target_branch,
329
329
-
pull_at,
330
330
body,
331
331
rkey,
332
332
source_branch,
···
351
351
&pull.Title,
352
352
&pull.State,
353
353
&pull.TargetBranch,
354
354
-
&pull.PullAt,
355
354
&pull.Body,
356
355
&pull.Rkey,
357
356
&sourceBranch,
···
487
486
title,
488
487
state,
489
488
target_branch,
490
490
-
pull_at,
491
489
repo_at,
492
490
body,
493
491
rkey,
···
510
508
&pull.Title,
511
509
&pull.State,
512
510
&pull.TargetBranch,
513
513
-
&pull.PullAt,
514
511
&pull.RepoAt,
515
512
&pull.Body,
516
513
&pull.Rkey,
+3
-4
appview/state/pull.go
Reviewed
···
528
528
Record: &lexutil.LexiconTypeDecoder{
529
529
Val: &tangled.RepoPullComment{
530
530
Repo: &atUri,
531
531
-
Pull: pullAt,
531
531
+
Pull: string(pullAt),
532
532
Owner: &ownerDid,
533
533
Body: &body,
534
534
CreatedAt: &createdAt,
···
879
879
return
880
880
}
881
881
882
882
-
atResp, err := comatproto.RepoPutRecord(r.Context(), client, &comatproto.RepoPutRecord_Input{
882
882
+
_, err = comatproto.RepoPutRecord(r.Context(), client, &comatproto.RepoPutRecord_Input{
883
883
Collection: tangled.RepoPullNSID,
884
884
Repo: user.Did,
885
885
Rkey: rkey,
···
895
895
},
896
896
})
897
897
898
898
-
err = db.SetPullAt(s.db, f.RepoAt, pullId, atResp.Uri)
899
898
if err != nil {
900
900
-
log.Println("failed to get pull id", err)
899
899
+
log.Println("failed to create pull request", err)
901
900
s.pages.Notice(w, "pull", "Failed to create pull request. Try again later.")
902
901
return
903
902
}