Monorepo for Tangled tangled.org

appview: replace IssueComment to Comment #866

open opened by boltless.me targeting master from sl/wnrvrwyvrlzo
Labels

None yet.

assignee

None yet.

Participants 2
AT URI
at://did:plc:xasnlahkri4ewmbuzly2rlc5/sh.tangled.repo.pull/3m7iohv2yb622
+15 -16
Interdiff #4 #5
-1
appview/db/comments.go
··· 172 172 if err := rows.Err(); err != nil { 173 173 return nil, err 174 174 } 175 - defer rows.Close() 176 175 177 176 // collect references from each comments 178 177 commentAts := slices.Collect(maps.Keys(commentMap))
appview/db/issues.go

This file has not been changed.

appview/db/reference.go

This file has not been changed.

appview/ingester.go

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

+14 -14
appview/issues/issues.go
··· 410 410 var replyTo *syntax.ATURI 411 411 replyToRaw := r.FormValue("reply-to") 412 412 if replyToRaw != "" { 413 - aturi, err := syntax.ParseATURI(r.FormValue("reply-to")) 413 + aturi, err := syntax.ParseATURI(replyToRaw) 414 414 if err != nil { 415 415 rp.pages.Notice(w, "issue-comment", "reply-to should be valid AT-URI") 416 416 return ··· 422 422 423 423 comment := models.Comment{ 424 424 Did: syntax.DID(user.Active.Did), 425 + Collection: tangled.CommentNSID, 425 426 Rkey: tid.TID(), 426 427 Subject: issue.AtUri(), 427 428 ReplyTo: replyTo, ··· 435 436 rp.pages.Notice(w, "issue-comment", "Failed to create comment.") 436 437 return 437 438 } 438 - record := comment.AsRecord() 439 439 440 440 client, err := rp.oauth.AuthorizedClient(r) 441 441 if err != nil { ··· 446 446 447 447 // create a record first 448 448 resp, err := comatproto.RepoPutRecord(r.Context(), client, &comatproto.RepoPutRecord_Input{ 449 - Collection: tangled.CommentNSID, 449 + Collection: comment.Collection.String(), 450 450 Repo: comment.Did.String(), 451 451 Rkey: comment.Rkey, 452 452 Record: &lexutil.LexiconTypeDecoder{ 453 - Val: &record, 453 + Val: comment.AsRecord(), 454 454 }, 455 455 }) 456 456 if err != nil { ··· 560 560 comment := comments[0] 561 561 562 562 if comment.Did.String() != user.Active.Did { 563 - l.Error("unauthorized comment edit", "expectedDid", comment.Did, "gotDid", user.Did) 563 + l.Error("unauthorized comment edit", "expectedDid", comment.Did, "gotDid", user.Active.Did) 564 564 http.Error(w, "you are not the author of this comment", http.StatusUnauthorized) 565 565 return 566 566 } ··· 589 589 newComment.Edited = &now 590 590 newComment.Mentions, newComment.References = rp.mentionsResolver.Resolve(r.Context(), newBody) 591 591 592 - record := newComment.AsRecord() 593 - 594 592 tx, err := rp.db.Begin() 595 593 if err != nil { 596 594 l.Error("failed to start transaction", "err", err) ··· 609 607 610 608 // rkey is optional, it was introduced later 611 609 if newComment.Rkey != "" { 610 + // TODO: update correct comment 611 + 612 612 // update the record on pds 613 - ex, err := comatproto.RepoGetRecord(r.Context(), client, "", tangled.CommentNSID, newComment.Did.String(), newComment.Rkey) 613 + ex, err := comatproto.RepoGetRecord(r.Context(), client, "", newComment.Collection.String(), newComment.Did.String(), newComment.Rkey) 614 614 if err != nil { 615 615 l.Error("failed to get record", "err", err, "did", newComment.Did, "rkey", newComment.Rkey) 616 - rp.pages.Notice(w, fmt.Sprintf("comment-%s-status", commentId), "Failed to update description, no record found on PDS.") 616 + rp.pages.Notice(w, fmt.Sprintf("comment-%s-status", commentId), "Failed to update comment, no record found on PDS.") 617 617 return 618 618 } 619 619 620 620 _, err = comatproto.RepoPutRecord(r.Context(), client, &comatproto.RepoPutRecord_Input{ 621 - Collection: tangled.CommentNSID, 621 + Collection: newComment.Collection.String(), 622 622 Repo: newComment.Did.String(), 623 623 Rkey: newComment.Rkey, 624 624 SwapRecord: ex.Cid, 625 625 Record: &lexutil.LexiconTypeDecoder{ 626 - Val: &record, 626 + Val: newComment.AsRecord(), 627 627 }, 628 628 }) 629 629 if err != nil { ··· 742 742 comment := comments[0] 743 743 744 744 if comment.Did.String() != user.Active.Did { 745 - l.Error("unauthorized action", "expectedDid", comment.Did, "gotDid", user.Did) 745 + l.Error("unauthorized action", "expectedDid", comment.Did, "gotDid", user.Active.Did) 746 746 http.Error(w, "you are not the author of this comment", http.StatusUnauthorized) 747 747 return 748 748 } ··· 770 770 return 771 771 } 772 772 _, err = comatproto.RepoDeleteRecord(r.Context(), client, &comatproto.RepoDeleteRecord_Input{ 773 - Collection: tangled.CommentNSID, 774 - Repo: user.Active.Did, 773 + Collection: comment.Collection.String(), 774 + Repo: comment.Did.String(), 775 775 Rkey: comment.Rkey, 776 776 }) 777 777 if err != nil {
appview/models/issue.go

This file has not been changed.

appview/notify/db/db.go

This file has not been changed.

appview/notify/merged_notifier.go

This file has not been changed.

appview/notify/notifier.go

This file has not been changed.

appview/notify/posthog/notifier.go

This file has not been changed.

appview/pages/pages.go

This file has not been changed.

appview/pages/templates/repo/issues/fragments/commentList.html

This file has not been changed.

appview/pages/templates/repo/issues/fragments/issueCommentHeader.html

This file has not been changed.

+1 -1
appview/state/state.go
··· 117 117 tangled.SpindleNSID, 118 118 tangled.StringNSID, 119 119 tangled.RepoIssueNSID, 120 + tangled.RepoIssueCommentNSID, 120 - tangled.CommentNSID, 121 121 tangled.LabelDefinitionNSID, 122 122 tangled.LabelOpNSID, 123 123 },
appview/validator/issue.go

This file has not been changed.

History

8 rounds 1 comment
sign up or login to add to the discussion
1 commit
expand
appview: replace IssueComment to Comment
2/3 failed, 1/3 success
expand
merge conflicts detected
expand
  • appview/notify/db/db.go:260
  • appview/notify/merged_notifier.go:81
  • appview/notify/notifier.go:22
  • appview/pulls/opengraph.go:277
expand 0 comments
1 commit
expand
appview: replace IssueComment to Comment
2/3 failed, 1/3 success
expand
expand 0 comments
1 commit
expand
appview: replace IssueComment to Comment
3/3 success
expand
expand 0 comments
1 commit
expand
appview: replace IssueComment to Comment
3/3 success
expand
expand 0 comments
1 commit
expand
appview: replace IssueComment to Comment
1/3 failed, 2/3 success
expand
expand 0 comments
1 commit
expand
appview: replace IssueComment to Comment
1/3 failed, 2/3 success
expand
expand 0 comments
1 commit
expand
appview: replace IssueComment to Comment
3/3 success
expand
expand 1 comment

imo: we should still continue to ingest sh.tangled.issue.comment (and pull comments), but just try to convert to the regular lexicon. this would only be used for backfill purposes, newer appviews should ideally not create the old NSID anymore.

the way i see it, the new lexicon is just an alias for the old ones, so the ingesters should be backwards compatible.

i will do a deeper dive into the code itself shortly.

1 commit
expand
appview: replace IssueComment to Comment
3/3 success
expand
expand 0 comments