XKit-Rewritten icon indicating copy to clipboard operation
XKit-Rewritten copied to clipboard

feat(Quote Replies): Add action buttons to replies in post notes

Open marcustyphoon opened this issue 1 year ago • 7 comments

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]ReplyMeatballItem modes 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 notePropsObjects utility is added, similar to timelineObject and notificationObject... mostly. Note the plural. The note prop 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 with note props, not all of which contain all of the fields.
  • The result of said util is interpreted in Quote Replies in a determineNoteReplyType function, 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 content and tags is mostly a copy-paste job, but following the DRY rule here makes the code pretty complicated.~~

Testing steps

todo: list testing steps

marcustyphoon avatar Dec 10 '24 12:12 marcustyphoon

Man, I wish I had typescript and something similar to Zod. I mean, jesus.

marcustyphoon avatar Jan 06 '25 10:01 marcustyphoon

  • [x] #1710
  • [x] #1712

marcustyphoon avatar Feb 07 '25 10:02 marcustyphoon

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

marcustyphoon avatar Feb 10 '25 14:02 marcustyphoon

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.)

marcustyphoon avatar Apr 28 '25 06:04 marcustyphoon

Hm, this might be easier with the /v2/blog/[blog]/post/[post id]/replies/[reply id]/permalink?mode=replies endpoint used for replies permalinks.

marcustyphoon avatar May 23 '25 20:05 marcustyphoon

Hm, this might be easier with the /v2/blog/[blog]/post/[post id]/replies/[reply id]/permalink?mode=replies endpoint used for replies permalinks.

yeah, I dunno, maybe... not.

marcustyphoon avatar Aug 08 '25 00:08 marcustyphoon

  • [ ] fix this on narrow posts (notesPopover), in which the meatballs menu is apparently... completely different???

marcustyphoon avatar Oct 25 '25 03:10 marcustyphoon