NotificationBlock: UI to show blocked posts#1071
Closed
marcustyphoon wants to merge 20 commits into
Closed
Conversation
Co-Authored-By: April Sylph <28949509+AprilSylph@users.noreply.github.com>
Collaborator
Author
|
Some updates: for simplicity, the next commits remove the blog names dictionary (removing the ability to display the user blog each post is from in the preference pane) and performs the UUID lookup when the user clicks the link. This ensures that lookups will work correctly if the same XKit Rewritten profile is logged into multiple blogs. This relegates the on-extension-load lookup to be an optimization that will be run one time for each post the first time the user loads a page with this PR merged. |
me big stupid
pretty unlikely but reduced API spam good
Collaborator
Author
|
See #1582. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Okay, so, this is currently a catastrophe, but.
Description
This implements a UI for NotificationBlock's preference pane similar to PostBlock's, including additions in #719. That is, it displays a list of posts that one has blocked notifications for, including the ability to click to navigate to the posts in question so that one can migrate to the upcoming native "notification muting" feature instead.
This requires looking up which blog each notification-blocked post is from, since we didn't previously record that. This performs said lookup by trying to load every unknown post on every one of the user's blogs as a background task in
main(), settingfalseif all lookups fail.This means that a post whose notifications are blocked that is on a blog the user is not currently logged into will never get a link created for it, which kind of sucks, but the alternative (API spam on every page load or keeping track in storage of every UUID which has been tested for each unknown post ID) are messy.This currently adds an additional dictionary matching blog UUIDs to blog names so that the preference UI can show which blog a notification-blocked post is on, but I'll probably remove that as it's quite complex and not really necessary.Edit: In the case where a user has blocked notifications from a root post that they did not create before the creation of this PR, this will always fail. I can't currently think of a way around this: Tumblr intentionally does not expose looking up arbitrary posts by ID, correct?
Testing steps
Oof. There is a lot of logic to test here, including importing blocked posts from before this PR as well as blocking posts with this PR merged, and being/not being logged into an account with access to the blocked post in question when clicking a linked post in the preference pane.