Skip to content
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

Notifications > Comment Details: show new details view for cached comment #17850

Merged
merged 3 commits into from
Feb 1, 2022

Conversation

ScoutHarris
Copy link
Contributor

@ScoutHarris ScoutHarris commented Feb 1, 2022

Ref: #17790

This is the first step in showing the new Comment Details view for a Comment Notification. Specifically, when a comment notification is selected, if the comment is already cached, it will be displayed with the new view.

Technical details: because CommentDetailViewController requires a Comment object, the Comment must first be loaded with information from the Notification. NotificationCommentDetailCoordinator has been added to facilitate comment loading, as well as other Notification specific functionality that will be added later.

Of course since this is the first step in showing this view, there are a number of outstanding tasks, which are listed in the referenced issue.

To test:

  • Enable the notificationCommentDetails feature.
  • To cache comments, go to My Site > Comments. Pick a site that corresponds to the Notifications you'll be testing.
  • Go to Notifications > Comments.
  • Select a notification.
  • If the comment is cached, the new view will be displayed.
  • If the comment is not cached, the old view will be displayed. This is temporary. Fetching non-cached comments will be added later.
  • All the functionality in this view should work as expected (Moderation, Edit, Reply, Like, etc.), just like from My Site > Comments > comment details.
Cached / New Not cached / Old
new old

Regression Notes

  1. Potential unintended areas of impact
    N/A. Feature is incomplete and disabled.

  2. What I did to test those areas of impact (or what existing automated tests I relied on)
    N/A. Feature is incomplete and disabled.

  3. What automated tests I added (or what prevented me from doing so)
    N/A. Feature is incomplete and disabled.

PR submission checklist:

  • I have completed the Regression Notes.
  • I have considered adding unit tests for my changes.
  • I have considered adding accessibility improvements for my changes.
  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

@peril-wordpress-mobile
Copy link

peril-wordpress-mobile bot commented Feb 1, 2022

You can trigger optional UI/connected tests for these changes by visiting CircleCI here.

Copy link
Contributor

@frosty frosty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Just one very minor comment, otherwise :shipit:

Comment on lines +729 to +741
let notificationCommentDetailCoordinator = NotificationCommentDetailCoordinator(notification: note)

// For now, NotificationCommentDetailCoordinator only loads the Comment if it is cached.
// If the comment is not cached, fall back to showing the old comment view.
// This is temporary until NotificationCommentDetailCoordinator can fetch the comment from the endpoint.

if let commentDetailViewController = notificationCommentDetailCoordinator.viewController {
commentDetailViewController.navigationItem.largeTitleDisplayMode = .never
self.showDetailViewController(commentDetailViewController, sender: nil)
} else {
// TODO: remove when NotificationCommentDetailCoordinator updated to fetch comment.
self.performSegue(withIdentifier: NotificationDetailsViewController.classNameWithoutNamespaces(), sender: note)
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick, but as this method is already pretty long, could we extract these into a presentCommentDetail(for: note) method or something?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. I'll do it in the next PR.

@ScoutHarris
Copy link
Contributor Author

Thanks @frosty !

@ScoutHarris ScoutHarris enabled auto-merge February 1, 2022 17:50
@jkmassel
Copy link
Contributor

jkmassel commented Feb 1, 2022

You can test the WordPress changes on this Pull Request by downloading it from AppCenter here with build number: pr17850-47f97e7. IPA is available here. If you need access to this, you can ask a maintainer to add you.

@ScoutHarris ScoutHarris merged commit f39e0d0 into trunk Feb 1, 2022
@ScoutHarris ScoutHarris deleted the feature/17790-show_cached_comment branch February 1, 2022 18:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants