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

Comments: add single comment view #19635

Merged
merged 17 commits into from
Nov 14, 2017

Conversation

rodrigoi
Copy link
Contributor

@rodrigoi rodrigoi commented Nov 9, 2017

Closes #18321

Very much in progress, but hidden under a feature flag 😄

Depends on:

This PR adds to new view for single comments, with the capability of performing moderation actions via query string parameters.

screen shot 2017-11-09 at 11 27 48

What to expect

This PR works only with the M3 redesign feature flag and depends heavily on components that still have work in progress, so warnings and errors are expected. Also, there's a regression on the comment list that shows all panels open, until #19560 gets resolved.
Also, there's duplication of code until dependent PRs get merged.

What to test:

The main reason this view exists is to perform moderation actions from emails. That's the area that requires testing at the moment. Most design elements depends on other M3 redesign PRs and will adjust once they are merged.

How to test:

  • Start Calypso with ENABLE_FEATURES=comments/management/m3-design npm start
  • Navigate to a comment by clicking on the timestamp link.
  • With WP.com Sandbox:
    • Sandbox a WordPress.com site.
    • Verify that comments moderation is required on Settings > Discussion > Comment must be manually approved for the sandboxed site
    • Apply D8153-code on your sandbox
    • Create a new comment with non editor user
    • You should receive an email notification with and Approve, Spam and Trash
    • Clicking on any of those links should perform the corresponding action
  • Without a WP.com Sandbox
    • Navigate to a comment
    • manually add to the url the following parameters as query string:
      • action: either approve, spam, trash or delete
      • for example/comment/rodrigoidummyfreesite.wordpress.com/165?action=approve

@rodrigoi rodrigoi added [Feature] Comments Comments on posts and the admin screen for managing them. [Status] In Progress labels Nov 9, 2017
@rodrigoi rodrigoi self-assigned this Nov 9, 2017
@rodrigoi rodrigoi requested a review from a team November 9, 2017 15:16
@matticbot
Copy link
Contributor


const CommentPermailnk = ( { permaLink, translate } ) => (
<Card className="comment__comment-permalink">
<SectionHeader label={ translate( 'Comment Permalink' ) } />
Copy link

Choose a reason for hiding this comment

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

Hi! I've found a possible matching string that has already been translated 43 times:
translate( 'Permalink to this comment' ) ES Score: 8
See 1 additional suggestion in the PR translation status page

Help me improve these suggestions: react with 👎 if the suggestion doesn't make any sense, or with 👍 if it's a particularly good one (even if not implemented).

const CommentPermalink = ( { isLoading, permaLink, translate } ) =>
! isLoading && (
<Card className="comment__comment-permalink">
<SectionHeader label={ translate( 'Comment Permalink' ) } />
Copy link

Choose a reason for hiding this comment

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

Hi! I've found a possible matching string that has already been translated 43 times:
translate( 'Permalink to this comment' ) ES Score: 8
See 1 additional suggestion in the PR translation status page

Help me improve these suggestions: react with 👎 if the suggestion doesn't make any sense, or with 👍 if it's a particularly good one (even if not implemented).

@gwwar gwwar added the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Nov 9, 2017
@gwwar
Copy link
Contributor

gwwar commented Nov 9, 2017

I know technically everything is a post, but in ?action=approve&site_id=99999999999&post_id=4 is the post_id a meant to be a post or a comment?

*
* we may not have user capabilities loaded onto state.
* We trust that the API will handle user capabilities for us.
*/
Copy link
Contributor

Choose a reason for hiding this comment

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

Still much more secure than the inverse ;)

const { commentId, siteFragment } = ownProps;

const siteId = getSiteId( state, siteFragment );
// const isJetpack = isJetpackSite( state, siteId );
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need Jetpack checks? We should have the related endpoint work ready.

@gwwar
Copy link
Contributor

gwwar commented Nov 9, 2017

@drw158 did we need anything here in the header to help differentiate between the post specific view and one for a single comment?

Copy link
Contributor

@gwwar gwwar left a comment

Choose a reason for hiding this comment

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

Thanks @rodrigoi! Let's tidy some of the commented out sections and get this in. This feels like a good chunk of work already.

If we feel like this might not ship with the new changes we can add another feature flag but I don't think it's necessary right now.

Things we can address in follow up PRs:

  • timing and how much information the route needs. eg can we simplify this to only needing the action param?
  • fix the clean cache flash of not having correct permissions
  • no feedback when replying to a comment
  • a redirect when deleting a comment permanently from this view
  • hitting the endpoint with the extra params I think does perform the update, but we're not seeing a re-render
  • add an edit action once that's available in the new component.

@davewhitley
Copy link
Contributor

Because this is mainly for email, I think this design will be fine for now.

@gwwar
Copy link
Contributor

gwwar commented Nov 13, 2017

@rodrigoi can we try landing this and follow up with the other items in the next PRs?

@rodrigoi rodrigoi force-pushed the update/comments/add-single-comment-view branch from 3fa23c0 to 5d0b7d4 Compare November 14, 2017 13:27
@rodrigoi rodrigoi changed the title Comments: add single comment view [In progress] Comments: add single comment view Nov 14, 2017
@Copons
Copy link
Contributor

Copons commented Nov 14, 2017

Overall this works well, but there are a bunch of follow up PRs that we should take care soonish, other than the ones already pointed out by @gwwar:

  • The page header reuses CommentListHeader which was built with the Post View in mind.
    So, right now, the Comment View has an header that contains the post title, date, and a "View Post" link. It doesn't make sense.
    cc @drw158 we oughta change this, likely with a new lean and clean header component in /my-sites/comment.

  • Somehow the possibility to externally change a comment status made an oldie but goldie issue emerge.
    Try to mark a comment as spam via mail link or direct URL (e.g. comments/123/example.org/456?action=spam): we land on a comment; this comment has a white background, and no labels.
    In other words: we don't have any clues at all to know that our comment is spam (but the same happens for trash) and, by extension, that our action was completed successfully.
    (cc @drw158)

  • PS to the previous point: do we need to display a notice to confirm the action?

  • PPS: damn, the "undoable" Comment actions don't work in this view because they depends on the CommentList.updateLastUndo function.
    We should check for updateLastUndo === undefined before firing it in CommentActions, since we wouldn't need it in Comment View.

  • The comment permalink should word-wrap: break-word or it'll likely overflow on small screens.


With the exception of the last point, I think we can easily fix and/or discuss in follow up PRs all the other points. 👍

@rodrigoi rodrigoi merged commit a1c399a into master Nov 14, 2017
@rodrigoi rodrigoi deleted the update/comments/add-single-comment-view branch November 14, 2017 18:43
@matticbot matticbot removed the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Nov 14, 2017
rclations pushed a commit to rclations/wp-calypso that referenced this pull request Nov 15, 2017
* Comments: sidebar menu item is selected on both list and single comment view
* Comments: updates link on the author date to the single comment view
* Comments: adds moderation data component
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Comments Comments on posts and the admin screen for managing them.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Comments: comment specific view
7 participants