feat(Postblock): Make options UI items links if possible
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.
Uhhhhhhh. Is this impossible now? Can you no longer go to a post on a blog given the blog UUID and post ID?
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.
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.)
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/
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.