feat(Quote Replies): Add action buttons to replies in post notes
As a bit of an aside to the actual issue in question, https://github.com/AprilSylph/XKit-Rewritten/issues/1655#issuecomment-2518848059 also brought up that it's reasonable to expect Quote Replies to be usable from the replies themselves as well as the activity pane. It isn't... but we can probably do that!
As a bonus, this sidesteps #1658, since the post notes API is totally different. (No longer relevant)
Description
This implements an item in the meatball menu on certain replies in the post footer, allowing the user to activate Quote Replies directly from that location if they would have been able to from the relevant item in the activity menu/page.
Technical Details
- The meatballs util has
[register/unregister]ReplyMeatballItemmodes added to target the meatball menus in post footer replies, which should be fairly self-explanatory, as the utility was recently factored to make adding modes easier and the code is similar to the other modes. - A
notePropsObjectsutility is added, similar totimelineObjectandnotificationObject... mostly. Note the plural. Thenoteprop doesn't include enough information to correctly process threaded replies, so the utility returns both the note prop for the target reply and, if it exists, the note prop of its parent. Also, there are multiple React components in the tree withnoteprops, not all of which contain all of the fields. - The result of said util is interpreted in Quote Replies in a
determineNoteReplyTypefunction, which is used both to determine if we should be able to quote-reply a reply (i.e. if it's targeting us) and, if so, what type of reply it will be and which of our blogs is being targeted. - ~~As noted in below comments, creating
contentandtagsis mostly a copy-paste job, but following the DRY rule here makes the code pretty complicated.~~
Testing steps
todo: list testing steps
Man, I wish I had typescript and something similar to Zod. I mean, jesus.
- [x] #1710
- [x] #1712
q: why did you make a PR that would immediately completely explode when it's merged with another active PR? a: I am very smart
q: why did you make a PR that would immediately completely explode when it's merged with another active PR? a: I am very smart
Yeah, doing that "merge" took me slightly over an hour. Fun times.
(The actual issue was that I—at the time, cleverly—reused the verbiage/formatting/content code that's now part of the processReply function when quoting from the post notes. It would be possible to factor things now so that's still the case, but the processReply/processGenericReply flow is now complicated enough to understand that I think it's best to leave that on its own and live with the verbiage/formatting/content code effectively getting copy-pasted. DRY is a nice principle but it's not the be-all and end-all.)
Hm, this might be easier with the /v2/blog/[blog]/post/[post id]/replies/[reply id]/permalink?mode=replies endpoint used for replies permalinks.
Hm, this might be easier with the
/v2/blog/[blog]/post/[post id]/replies/[reply id]/permalink?mode=repliesendpoint used for replies permalinks.
yeah, I dunno, maybe... not.
- [ ] fix this on narrow posts (
notesPopover), in which the meatballs menu is apparently... completely different???