Monorepo for Tangled tangled.org

appview, knotserver: add didAssign event and PDS rewrite on login #1143

open opened by oyster.cafe targeting master from oyster.cafe/tangled-core: master
Labels

None yet.

assignee

None yet.

Participants 2
AT URI
at://did:plc:3fwecdnvtcscjnrx2p4n7alz/sh.tangled.repo.pull/3mgprvt2evm22
+21 -46
Interdiff #8 #9
+21 -46
appview/db/repos.go
··· 577 577 return GetRepo(e, orm.FilterEq("repo_did", repoDid)) 578 578 } 579 579 580 - func EnqueuePdsRewrite(e Execer, userDid, repoDid, recordNsid, recordRkey, oldRepoAt string) error { 581 - _, err := e.Exec( 582 - `INSERT OR IGNORE INTO pds_rewrite_status 583 - (user_did, repo_did, record_nsid, record_rkey, old_repo_at, status) 584 - VALUES (?, ?, ?, ?, ?, 'pending')`, 585 - userDid, repoDid, recordNsid, recordRkey, oldRepoAt, 586 - ) 587 - return err 588 - } 589 - 590 - func UpdateDescription(e Execer, repoAt, newDescription string) error { 591 - _, err := e.Exec( 592 - `update repos set description = ? where at_uri = ?`, newDescription, repoAt) 593 - 594 - 595 - 596 - return GetRepo(e, orm.FilterEq("repo_did", repoDid)) 597 - } 598 - 599 580 func EnqueuePdsRewritesForRepo(tx *sql.Tx, repoDid, repoAtUri string) error { 600 581 type record struct { 601 582 userDidCol string ··· 727 708 } 728 709 729 710 func CascadeRepoDid(tx *sql.Tx, repoAtUri, repoDid string) error { 730 - updates := []struct{ table, column string }{ 731 - {"repos", "at_uri"}, 732 - {"issues", "repo_at"}, 733 - {"pulls", "repo_at"}, 734 - {"collaborators", "repo_at"}, 735 - {"artifacts", "repo_at"}, 736 - {"webhooks", "repo_at"}, 737 - {"pull_comments", "repo_at"}, 738 - {"repo_issue_seqs", "repo_at"}, 739 - {"repo_pull_seqs", "repo_at"}, 740 - {"repo_languages", "repo_at"}, 741 - {"repo_labels", "repo_at"}, 742 - {"profile_pinned_repositories", "at_uri"}, 743 - } 744 - 745 - for _, u := range updates { 746 - _, err := tx.Exec( 747 - fmt.Sprintf(`UPDATE %s SET repo_did = ? WHERE %s = ?`, u.table, u.column), 748 - repoDid, repoAtUri, 749 - ) 750 - if err != nil { 751 - return fmt.Errorf("cascade repo_did to %s: %w", u.table, err) 752 - } 753 - } 754 - 755 711 _, err := tx.Exec( 756 - `UPDATE stars SET subject_did = ? WHERE subject_at = ?`, 712 + `UPDATE repos SET repo_did = ? WHERE at_uri = ?`, 757 713 repoDid, repoAtUri, 758 714 ) 759 715 if err != nil { 760 - return fmt.Errorf("cascade subject_did to stars: %w", err) 716 + return fmt.Errorf("cascade repo_did to repos: %w", err) 761 717 } 762 718 763 719 _, err = tx.Exec( ··· 772 728 } 773 729 774 730 func UpdateDescription(e Execer, repoAt, newDescription string) error { 731 + _, err := e.Exec( 732 + `update repos set description = ? where at_uri = ?`, newDescription, repoAt) 733 + 734 + 735 + 736 + return GetRepo(e, orm.FilterEq("repo_did", repoDid)) 737 + } 738 + 739 + func EnqueuePdsRewrite(e Execer, userDid, repoDid, recordNsid, recordRkey, oldRepoAt string) error { 740 + _, err := e.Exec( 741 + `INSERT OR IGNORE INTO pds_rewrite_status 742 + (user_did, repo_did, record_nsid, record_rkey, old_repo_at, status) 743 + VALUES (?, ?, ?, ?, ?, 'pending')`, 744 + userDid, repoDid, recordNsid, recordRkey, oldRepoAt, 745 + ) 746 + return err 747 + } 748 + 749 + func UpdateDescription(e Execer, repoAt, newDescription string) error { 775 750 _, err := e.Exec( 776 751 `update repos set description = ? where at_uri = ?`, newDescription, repoAt)
appview/oauth/handler.go

This file has not been changed.

appview/state/knotstream.go

This patch was likely rebased, as context lines do not match.

knotserver/db/didassign.go

This file has not been changed.

knotserver/db/events.go

This file has not been changed.

knotserver/events.go

This file has not been changed.

knotserver/git.go

This file has not been changed.

knotserver/internal.go

This file has not been changed.

knotserver/xrpc/xrpc.go

This file has not been changed.

rbac/rbac.go

This file has not been changed.

rbac/rbac_test.go

This file has not been changed.

History

12 rounds 1 comment
sign up or login to add to the discussion
1 commit
expand
appview, knotserver: add didAssign event and PDS rewrite on login
merge conflicts detected
expand
  • go.mod:34
  • go.sum:339
expand 0 comments
1 commit
expand
appview, knotserver: add didAssign event and PDS rewrite on login
expand 0 comments
1 commit
expand
appview, knotserver: add didAssign event and PDS rewrite on login
expand 1 comment

everything else lgtm!

1 commit
expand
appview, knotserver: add didAssign event and PDS rewrite on login
expand 0 comments
1 commit
expand
appview, knotserver: add didAssign event and PDS rewrite on login
expand 0 comments
1 commit
expand
appview, knotserver: add didAssign event and PDS rewrite on login
expand 0 comments
1 commit
expand
appview, knotserver: add didAssign event and PDS rewrite on login
expand 0 comments
1 commit
expand
appview, knotserver: add didAssign event and PDS rewrite on login
expand 0 comments
1 commit
expand
appview, knotserver: add didAssign event and PDS rewrite on login
expand 0 comments
1 commit
expand
appview, knotserver: add didAssign event and PDS rewrite on login
expand 0 comments
1 commit
expand
appview, knotserver: add didAssign event and PDS rewrite on login
expand 0 comments
1 commit
expand
appview, knotserver: add didAssign event and PDS rewrite on login
expand 0 comments