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

feat(Postblock): Make options UI items links if possible

Open marcustyphoon opened this issue 3 years ago • 7 comments

User-facing changes

  • Postblock's options UI links to posts you have blocked, so you can tell what they actually are if you want to unblock them. Posts that have not been seen since this upgrade won't have links, since we didn't store the required information previously.
  • When viewing a single blocked post in /blog/view, there is a visual indicator with an unhide and unblock button instead of, you know, nothing.

Technical explanation

A map* of post ID -> blog UUID entries is stored as a separate storage entry, rather than migrating the blocked posts list to e.g. an array of [id, ?uuid]. You could definitely do the latter, but that kind of thing requires a bit of thinking to ensure you correctly migrate old entries and don't have race conditions.

*I unapologetically call POJO records "maps." Sue me.

Issues this closes

discussion #402

Testing steps

  • Load a saved set of preference data with blocked posts. Confirm that they function correctly but are not links in the options UI.
  • Block a post. Confirm that it is a link in the options UI, and that the link opens the post in question when clicked.
  • Confirm that blocked posts have a new UI when viewed alone, that the new UI looks correct both with and without the "use blog colors when viewing blogs" option, and that its buttons function.
  • Navigate to a post that was blocked before switching to this code. Confirm that it becomes a link.

marcustyphoon avatar Aug 22 '22 19:08 marcustyphoon

Uhhhhhhh. Is this impossible now? Can you no longer go to a post on a blog given the blog UUID and post ID?

marcustyphoon avatar Dec 02 '22 04:12 marcustyphoon

Yeah, it looks to me like you can go to https://www.tumblr.com/@t:UUIDGOESHERE and https://www.tumblr.com/blog/view/t:UUIDGOESHERE/, but cannot append /POSTID or /post/POSTID to either one.

marcustyphoon avatar Dec 08 '22 02:12 marcustyphoon

Shit, really? What happens if you do? (Mainly want to see if it ends up on a Redpop 404 page; if it does, my redirection code handling this is busted but can probably be fixed.)

AprilSylph avatar Dec 08 '22 20:12 AprilSylph

does work (post, name): Blog network: https://april.tumblr.com/post/661324787743948800/ Blog view (new): https://www.tumblr.com/april/661324787743948800/, https://tumblr.com/april/661324787743948800/ Blog view (new, @): https://www.tumblr.com/@april/661324787743948800/, https://tumblr.com/@april/661324787743948800/ Blog view (old): https://www.tumblr.com/blog/view/april/661324787743948800/, https://tumblr.com/blog/view/april/661324787743948800/ Branch.io: https://at.tumblr.com/april/im-april-im-a-web-developer-who-makes-things/sso2gjczjg24 Shared from iOS with api2.branch.io blocked: (long link)

does work (blog, uuid): Blog view (new, @): https://www.tumblr.com/@t:Fft_7iTGnBlHdl-UtlllwQ, https://tumblr.com/@t:Fft_7iTGnBlHdl-UtlllwQ Blog view (old): https://www.tumblr.com/blog/view/t:Fft_7iTGnBlHdl-UtlllwQ, https://tumblr.com/blog/view/t:Fft_7iTGnBlHdl-UtlllwQ

doesn't work (blog, uuid): Blog view (new): https://www.tumblr.com/t:Fft_7iTGnBlHdl-UtlllwQ

doesn't work (post, uuid): Blog view (new, @): https://www.tumblr.com/@t:Fft_7iTGnBlHdl-UtlllwQ/661324787743948800, https://tumblr.com/@t:Fft_7iTGnBlHdl-UtlllwQ/661324787743948800 Blog view (old): https://www.tumblr.com/blog/view/t:Fft_7iTGnBlHdl-UtlllwQ/661324787743948800, https://tumblr.com/blog/view/t:Fft_7iTGnBlHdl-UtlllwQ/661324787743948800

doesn't work: blog/view/@username, anything with /post/

marcustyphoon avatar Dec 08 '22 21:12 marcustyphoon

Oh, I guess that's a silly reason to abandon this; it can just look up the blog name via an API request before navigation. Well, not "just," actually, since we can't access apiFetch from a settings panel. But it's solvable.

marcustyphoon avatar Feb 16 '23 00:02 marcustyphoon