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 if err := rows.Err(); err != nil { 173 return nil, err 174 } 175 - defer rows.Close() 176 177 // collect references from each comments 178 commentAts := slices.Collect(maps.Keys(commentMap))
··· 172 if err := rows.Err(); err != nil { 173 return nil, err 174 } 175 176 // collect references from each comments 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 var replyTo *syntax.ATURI 411 replyToRaw := r.FormValue("reply-to") 412 if replyToRaw != "" { 413 - aturi, err := syntax.ParseATURI(r.FormValue("reply-to")) 414 if err != nil { 415 rp.pages.Notice(w, "issue-comment", "reply-to should be valid AT-URI") 416 return ··· 422 423 comment := models.Comment{ 424 Did: syntax.DID(user.Active.Did), 425 Rkey: tid.TID(), 426 Subject: issue.AtUri(), 427 ReplyTo: replyTo, ··· 435 rp.pages.Notice(w, "issue-comment", "Failed to create comment.") 436 return 437 } 438 - record := comment.AsRecord() 439 440 client, err := rp.oauth.AuthorizedClient(r) 441 if err != nil { ··· 446 447 // create a record first 448 resp, err := comatproto.RepoPutRecord(r.Context(), client, &comatproto.RepoPutRecord_Input{ 449 - Collection: tangled.CommentNSID, 450 Repo: comment.Did.String(), 451 Rkey: comment.Rkey, 452 Record: &lexutil.LexiconTypeDecoder{ 453 - Val: &record, 454 }, 455 }) 456 if err != nil { ··· 560 comment := comments[0] 561 562 if comment.Did.String() != user.Active.Did { 563 - l.Error("unauthorized comment edit", "expectedDid", comment.Did, "gotDid", user.Did) 564 http.Error(w, "you are not the author of this comment", http.StatusUnauthorized) 565 return 566 } ··· 589 newComment.Edited = &now 590 newComment.Mentions, newComment.References = rp.mentionsResolver.Resolve(r.Context(), newBody) 591 592 - record := newComment.AsRecord() 593 - 594 tx, err := rp.db.Begin() 595 if err != nil { 596 l.Error("failed to start transaction", "err", err) ··· 609 610 // rkey is optional, it was introduced later 611 if newComment.Rkey != "" { 612 // update the record on pds 613 - ex, err := comatproto.RepoGetRecord(r.Context(), client, "", tangled.CommentNSID, newComment.Did.String(), newComment.Rkey) 614 if err != nil { 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.") 617 return 618 } 619 620 _, err = comatproto.RepoPutRecord(r.Context(), client, &comatproto.RepoPutRecord_Input{ 621 - Collection: tangled.CommentNSID, 622 Repo: newComment.Did.String(), 623 Rkey: newComment.Rkey, 624 SwapRecord: ex.Cid, 625 Record: &lexutil.LexiconTypeDecoder{ 626 - Val: &record, 627 }, 628 }) 629 if err != nil { ··· 742 comment := comments[0] 743 744 if comment.Did.String() != user.Active.Did { 745 - l.Error("unauthorized action", "expectedDid", comment.Did, "gotDid", user.Did) 746 http.Error(w, "you are not the author of this comment", http.StatusUnauthorized) 747 return 748 } ··· 770 return 771 } 772 _, err = comatproto.RepoDeleteRecord(r.Context(), client, &comatproto.RepoDeleteRecord_Input{ 773 - Collection: tangled.CommentNSID, 774 - Repo: user.Active.Did, 775 Rkey: comment.Rkey, 776 }) 777 if err != nil {
··· 410 var replyTo *syntax.ATURI 411 replyToRaw := r.FormValue("reply-to") 412 if replyToRaw != "" { 413 + aturi, err := syntax.ParseATURI(replyToRaw) 414 if err != nil { 415 rp.pages.Notice(w, "issue-comment", "reply-to should be valid AT-URI") 416 return ··· 422 423 comment := models.Comment{ 424 Did: syntax.DID(user.Active.Did), 425 + Collection: tangled.CommentNSID, 426 Rkey: tid.TID(), 427 Subject: issue.AtUri(), 428 ReplyTo: replyTo, ··· 436 rp.pages.Notice(w, "issue-comment", "Failed to create comment.") 437 return 438 } 439 440 client, err := rp.oauth.AuthorizedClient(r) 441 if err != nil { ··· 446 447 // create a record first 448 resp, err := comatproto.RepoPutRecord(r.Context(), client, &comatproto.RepoPutRecord_Input{ 449 + Collection: comment.Collection.String(), 450 Repo: comment.Did.String(), 451 Rkey: comment.Rkey, 452 Record: &lexutil.LexiconTypeDecoder{ 453 + Val: comment.AsRecord(), 454 }, 455 }) 456 if err != nil { ··· 560 comment := comments[0] 561 562 if comment.Did.String() != user.Active.Did { 563 + l.Error("unauthorized comment edit", "expectedDid", comment.Did, "gotDid", user.Active.Did) 564 http.Error(w, "you are not the author of this comment", http.StatusUnauthorized) 565 return 566 } ··· 589 newComment.Edited = &now 590 newComment.Mentions, newComment.References = rp.mentionsResolver.Resolve(r.Context(), newBody) 591 592 tx, err := rp.db.Begin() 593 if err != nil { 594 l.Error("failed to start transaction", "err", err) ··· 607 608 // rkey is optional, it was introduced later 609 if newComment.Rkey != "" { 610 + // TODO: update correct comment 611 + 612 // update the record on pds 613 + ex, err := comatproto.RepoGetRecord(r.Context(), client, "", newComment.Collection.String(), newComment.Did.String(), newComment.Rkey) 614 if err != nil { 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 comment, no record found on PDS.") 617 return 618 } 619 620 _, err = comatproto.RepoPutRecord(r.Context(), client, &comatproto.RepoPutRecord_Input{ 621 + Collection: newComment.Collection.String(), 622 Repo: newComment.Did.String(), 623 Rkey: newComment.Rkey, 624 SwapRecord: ex.Cid, 625 Record: &lexutil.LexiconTypeDecoder{ 626 + Val: newComment.AsRecord(), 627 }, 628 }) 629 if err != nil { ··· 742 comment := comments[0] 743 744 if comment.Did.String() != user.Active.Did { 745 + l.Error("unauthorized action", "expectedDid", comment.Did, "gotDid", user.Active.Did) 746 http.Error(w, "you are not the author of this comment", http.StatusUnauthorized) 747 return 748 } ··· 770 return 771 } 772 _, err = comatproto.RepoDeleteRecord(r.Context(), client, &comatproto.RepoDeleteRecord_Input{ 773 + Collection: comment.Collection.String(), 774 + Repo: comment.Did.String(), 775 Rkey: comment.Rkey, 776 }) 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 tangled.SpindleNSID, 118 tangled.StringNSID, 119 tangled.RepoIssueNSID, 120 - tangled.CommentNSID, 121 tangled.LabelDefinitionNSID, 122 tangled.LabelOpNSID, 123 },
··· 117 tangled.SpindleNSID, 118 tangled.StringNSID, 119 tangled.RepoIssueNSID, 120 + tangled.RepoIssueCommentNSID, 121 tangled.LabelDefinitionNSID, 122 tangled.LabelOpNSID, 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