Skip to content

Conversation

dvdchr
Copy link
Contributor

@dvdchr dvdchr commented Sep 13, 2021

Refs #17087

This PR configures the visibility of several components in Comment Detail.

  • The web address view should be hidden if the author URL is empty, or an invalid URL.
  • The email and IP address fields are only visible for moderator roles, i.e. Editor and Administrator.
  • In the content cell, the reaction bar (containing Reply and Likes button) is only visible when the site is either self hosted, OR the site is either dot com or Atomic and the comment is approved.
    • In short, the reaction bar is only disabled when the site is dotcom or Atomic AND the comment is not approved AND the user viewing the comment doesn't have a moderating role.
  • Lastly, the accessory button is only enabled when the comment is approved.

To Test

Ensure that the New Comment Detail feature flag is enabled.

Web address visibility

  • Go to My Site > Comments, and select a Comment where the author URL is present.
  • Verify that the Web address field is visible.
  • Select another comment where the author URL is not present.
  • Verify that the Web address field is hidden.

Accessory button visibility

  • Select any approved comment, and verify that the accessory button is visible.
  • Select a spam or pending comment, and verify that the accessory button is hidden.

With a dotcom site, using an account that CANNOT moderate the site:

  • Select any approved comment.
  • Verify that the email address and the IP address field is hidden.
  • Verify that the Edit button is NOT visible.
  • Verify that the Reply and Like button is visible.

With a dotcom site, using an account that can moderate the site (Administrator or Editor):

  • Select any approved comment.
  • Verify that the email address and IP address field is visible.
  • Verify that the Edit button is visible.
  • Verify that the Reply and Like button is visible.

With a self-hosted site:

  • Select any approved comment.
  • Verify that the email address and IP address field is visible.
  • Verify that the Reply and Likes button is visible.

Regression Notes

  1. Potential unintended areas of impact
    n/a. Feature is hidden behind a feature flag.

  2. What I did to test those areas of impact (or what existing automated tests I relied on)
    n/a. Feature is hidden behind a feature flag.

  3. What automated tests I added (or what prevented me from doing so)
    n/a. Feature is hidden behind a feature flag.

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 Sep 13, 2021

You can trigger an installable build for these changes by visiting CircleCI here.

@peril-wordpress-mobile
Copy link

peril-wordpress-mobile bot commented Sep 13, 2021

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

@ScoutHarris
Copy link
Contributor

Hey @dvdchr .

The app crashes when saving an edited comment. Cancelling a comment edit works fine.

  • On iPad or iPhone.
  • Edit a comment.
  • Made a change.
  • Select Done.
  • The app crashes with: Fatal error: Unexpectedly found nil while implicitly unwrapping an Optional value: file WordPress/CommentContentTableViewCell.swift, line 74

Screen Shot 2021-09-13 at 2 03 34 PM

@ScoutHarris
Copy link
Contributor

ScoutHarris commented Sep 13, 2021

Hey @dvdchr .

I noticed that the Email address field is displayed when there is no email. I would expect it to be hidden like the Web address is when it's empty. AFAIK, it is perfectly valid not to have an email address. You can see this by 1) the Edit Comment view allowing it to be cleared, and 2) the web displays a specific label in this scenario.

Screen Shot 2021-09-13 at 2 40 49 PM

I will admit, I'm not sure how you can reply without an email address, but I do recall @aerych mentioning something about replying anonymously, which results in no email.

@ScoutHarris ScoutHarris modified the milestones: 18.3, 18.4 Sep 16, 2021
@ScoutHarris
Copy link
Contributor

This is probably unrelated to this PR, but I just noticed this warning:

Screen Shot 2021-09-22 at 12 12 40 PM

@dvdchr
Copy link
Contributor Author

dvdchr commented Sep 24, 2021

I noticed that the Email address field is displayed when there is no email. I would expect it to be hidden like the Web address is when it's empty.
I do recall @aerych mentioning something about replying anonymously, which results in no email.

Oh, TIL! I'll adjust this soon.

@dvdchr
Copy link
Contributor Author

dvdchr commented Sep 24, 2021

This is probably unrelated to this PR, but I just noticed this warning:

Good catch! Since this icon is not available in Gridicons, I'll backport this for iOS 13 by adding this specific icon to our assets.

@dvdchr
Copy link
Contributor Author

dvdchr commented Sep 24, 2021

Hey @ScoutHarris, this should be ready for your n-th round of review. 😅 Thank you for the reviews!! Here's a gist of the update:

  • Used stack view to stack the comment content subviews. Also verified that the crash you've found no longer happens after switching this to stack view.
  • Updated the conditionals for isCommentLikesEnabled to be more clear.
  • Addressing your comment, empty email field is now hidden!
  • Backported the arrowshape.turn.up.backward SFSymbols to iOS 13.

@dvdchr dvdchr requested a review from ScoutHarris September 24, 2021 14:45
@dvdchr
Copy link
Contributor Author

dvdchr commented Sep 24, 2021

It looks like I might've left the Jetpack target unchecked, which may cause the CI jobs to fail. I'll fix this tomorrow!

@ScoutHarris ScoutHarris removed the request for review from aerych September 24, 2021 18:45
Copy link
Contributor

@ScoutHarris ScoutHarris left a comment

Choose a reason for hiding this comment

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

Looking good!

:shipit:

@dvdchr dvdchr merged commit 7c3cdbc into develop Sep 27, 2021
@dvdchr dvdchr deleted the issue/17087-comment-detail-check-permission branch September 27, 2021 15:32
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.

2 participants