-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Xpost Notifications: show Follow conversation by email
on original post
#17159
Conversation
…st's info to display reader detail.
You can trigger an installable build for these changes by visiting CircleCI here. |
You can trigger optional UI/connected tests for these changes by visiting CircleCI here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hola @ScoutHarris 👋
Works great! :)
Tested as described (thanks for the tip on how to get the notification) and everything worked as expected. I just had a couple of nitpicky comments. :)
// If the user tapped the link to the original post, use the original post's info to display reader detail. | ||
// The API endpoint used by controllerWithPostID returns subscription flags for the post. | ||
// The API endpoint used by controllerWithPostURL does return this information. | ||
// These flags needed to display the `Follow conversation by email` option. | ||
// So if we can call controllerWithPostID, do so. Otherwise, fallback to controllerWithPostURL. | ||
// Ref: https://github.com/wordpress-mobile/WordPress-iOS/issues/17158 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we preface this comment with something making it clear it's regarding cross posts?
We might be missing a word or two in these comments.
Should The API endpoint used by controllerWithPostURL does return this information
read does not
?
Should These flags needed to display the
Follow conversation by email option
say These flags are
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What? You got the gist right? 😉 Thank you, I'll fix it.
let readerDetail: ReaderDetailViewController = { | ||
if let post = post, | ||
selectedUrlIsCrossPost(url) { | ||
return ReaderDetailViewController.controllerWithPostID(post.crossPostMeta.postID, siteID: post.crossPostMeta.siteID) | ||
} | ||
|
||
return ReaderDetailViewController.controllerWithPostURL(url) | ||
}() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nifty!
viewController?.navigationController?.pushViewController(readerDetail, animated: true) | ||
} | ||
|
||
private func selectedUrlIsCrossPost(_ url: URL) -> Bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll be "that guy" and ask if we should add a unit test for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh I suppose we could. 😄 I can do that in a follow up PR if you don't mind.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wfm!
Hey @aerych . I updated the comments. I'll do a follow up PR for the unit test, and I'll fix the merge conflict when I merge my WPKit change. Back to you please! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
with great 🚢 ing!
Thanks @aerych ! |
Fixes #17158
WPKit PR: wordpress-mobile/WordPressKit-iOS#446
When viewing the original post from an xpost Notification, the
Follow conversation by email
button now appears in the Comments header.When the link is tapped in the Notification body, it now compares the
post.crossPostMeta.postURL
with the tapped URL. If they are the same, the linked post is shown using the IDs frompost.crossPostMeta
(i.e. the original post). This allows the endpoint to be called that returnssubscribe
information for the original post, thus having the necessary information to display the follow button.Bonus: fixed issues that were causing
Implicit conversion from enumeration type 'enum UIStackViewAlignment' to different enumeration type 'UIStackViewDistribution' (aka 'enum UIStackViewDistribution')
warnings inReaderPostHeaderView
.To test:
Follow(ing) conversation by email
button appears in the header and shows the correct state.Regression Notes
Potential unintended areas of impact
N/A
What I did to test those areas of impact (or what existing automated tests I relied on)
Tested different Notification types to ensure posts are loaded correctly.
What automated tests I added (or what prevented me from doing so)
N/A
PR submission checklist:
RELEASE-NOTES.txt
if necessary.