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 P2] Commen Moderation: Pending #23134

Conversation

alpavanoglu
Copy link
Contributor

@alpavanoglu alpavanoglu commented May 1, 2024

Fixes #https://github.com/Automattic/wordpress-mobile/issues/33

Description

This PR adds the new Moderation View UI to the Comment Detail Screen. The functionality will follow with other PRs.

Acceptance Criteria

If the comment has the "Pending" moderation status, a moderation panel is displayed at the bottom of the comment details screen. There is a separator between the content and the panel.
1‍⃣ There is a label indicating the moderation state with a dedicated icon.
2‍⃣ Approve comment CTA button with an icon is visible but not actionable.
3‍⃣ More options CTA button opens a bottom sheet dialog containing all the available moderation options.
4‍⃣ The bottom sheet dialog presents "Approved," "Pending," "Thrash," and "Spam" options that are not actionable.

Testing Steps

  1. Install and Login on Jetpack App
  2. Go to Notifications
  3. Select a comment notification that has "pending" state (the moderation can be set from web if no comment is in pending state.
  4. ✅ Expect the new moderation component to appear instead of the old one.
  5. ✅ Verify if tapping on "More options" show the moderation options sheet.

Test in dark and light mode and with different dynamic font sizes.

Screenshot Reference

Header Header
Simulator Screenshot - iPhone 15 - 2024-05-09 at 20 03 32 Simulator Screenshot - iPhone 15 - 2024-05-09 at 20 02 45

Regression Notes

  1. Potential unintended areas of impact

  2. What I did to test those areas of impact (or what existing automated tests I relied on)

  3. What automated tests I added (or what prevented me from doing so)

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.

Testing checklist:

  • WordPress.com sites and self-hosted Jetpack sites.
  • Portrait and landscape orientations.
  • Light and dark modes.
  • Fonts: Larger, smaller and bold text.
  • High contrast.
  • VoiceOver.
  • Languages with large words or with letters/accents not frequently used in English.
  • Right-to-left languages. (Even if translation isn’t complete, formatting should still respect the right-to-left layout)
  • iPhone and iPad.
  • Multi-tasking: Split view and Slide over. (iPad)

@alpavanoglu alpavanoglu changed the base branch from feature/notifications-p2_comment-moderation-sheet to feature/notifications-p2_comment_moderation_view May 1, 2024 15:20
@wpmobilebot
Copy link
Contributor

wpmobilebot commented May 8, 2024

WordPress Alpha📲 You can test the changes from this Pull Request in WordPress Alpha by scanning the QR code below to install the corresponding build.
App NameWordPress Alpha WordPress Alpha
ConfigurationRelease-Alpha
Build Numberpr23134-e0cec11
Version24.8
Bundle IDorg.wordpress.alpha
Commite0cec11
App Center BuildWPiOS - One-Offs #9873
Automatticians: You can use our internal self-serve MC tool to give yourself access to App Center if needed.

@wpmobilebot
Copy link
Contributor

wpmobilebot commented May 8, 2024

Jetpack Alpha📲 You can test the changes from this Pull Request in Jetpack Alpha by scanning the QR code below to install the corresponding build.
App NameJetpack Alpha Jetpack Alpha
ConfigurationRelease-Alpha
Build Numberpr23134-e0cec11
Version24.8
Bundle IDcom.jetpack.alpha
Commite0cec11
App Center Buildjetpack-installable-builds #8921
Automatticians: You can use our internal self-serve MC tool to give yourself access to App Center if needed.

…ss-mobile/WordPress-iOS into feature/notifications-p2_comment-approval

# Conflicts:
#	Modules/Sources/DesignSystem/Foundation/IconName.swift
…ss-mobile/WordPress-iOS into feature/notifications-p2_comment-approval
Base automatically changed from feature/notifications-p2_comment_moderation_view to feature/notifications_refresh_p2 May 9, 2024 16:19
…ss-mobile/WordPress-iOS into feature/notifications-p2_comment-approval

# Conflicts:
#	Modules/Sources/DesignSystem/Foundation/IconName.swift
#	WordPress/Classes/ViewRelated/Notifications/Comment Moderation/CommentModerationView.swift
#	WordPress/Classes/ViewRelated/Notifications/Comment Moderation/CommentModerationViewModel.swift
@alpavanoglu alpavanoglu marked this pull request as ready for review May 9, 2024 18:05
Comment on lines +41 to +53
// isNotificationComment ? WPAppAnalytics.track(.notificationsCommentApproved,
// withProperties: Constants.notificationDetailSource,
// withBlogID: notification?.metaSiteID) :
// CommentAnalytics.trackCommentApproved(comment: comment)
//
commentService.approve(comment, success: { [weak self] in
self?.state = .approved(liked: false)
// self?.showActionableNotice(title: ModerationMessages.approveSuccess)
// self?.refreshData()
}, failure: { /* [weak self] */ error in
// self?.displayNotice(title: ModerationMessages.approveFail)
// self?.commentStatus = CommentStatusType.typeForStatus(self?.comment.status)
})
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I left these as a reminder to not miss the existing functionality. Will be removed once the actions are implemented.

)
let hostingController = UIHostingController(rootView: commentModerationView)
containerStackView.addArrangedSubview(hostingController.view)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Hey @alpavanoglu, the moderation doesn't show up in my case even though comment.allowsModeration is true and comment status is pending.

After investigating the issue, I discovered that CommentModerationState(comment: comment) was returning nil because the comment.status for a pending comment is set to hold, not pending.

Suggestion: I think It would be more reliable to use the CommentDetailViewController.commentStatus property, which is of type CommentStatusType. This property was used in the outdated moderation view.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That type seem to have draft as an option. I don't think it is relevant in Notifications context. We would need to handle the draft case. I've updated the value to hold now. Lmk if you have other concerns regarding that.

@salimbraksa salimbraksa self-requested a review May 10, 2024 13:04
Copy link
Contributor

@salimbraksa salimbraksa left a comment

Choose a reason for hiding this comment

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

LGTM! 🚀

@alpavanoglu alpavanoglu merged commit 9a98fa3 into feature/notifications_refresh_p2 May 13, 2024
24 checks passed
@alpavanoglu alpavanoglu deleted the feature/notifications-p2_comment-approval branch May 13, 2024 10:11
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.

None yet

3 participants