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

When a user is blocked from commenting on an article, show correct error message #15009

Merged
merged 2 commits into from Oct 14, 2021

Conversation

vishaldeepak
Copy link
Contributor

@vishaldeepak vishaldeepak commented Oct 11, 2021

What type of PR is this? (check all applicable)

  • Bug Fix

Description

Instead of letting Pundit handle this policy, I moved the logic to the controller method. This way all other pundit validations will continue to work as before. The controller will raise an UnauthorizedError which will be handled by the controller to return a proper error message.

Related Tickets & Documents

Closes #14642
And perhaps a similar issue #14502

Probable Changes

QA Instructions, Screenshots, Recordings

Recreation can be found here -#14642 (comment)

Screenshot 2021-10-11 at 9 21 39 PM

Added/updated tests?

  • Yes

@pr-triage pr-triage bot added the PR: draft bot applied label for PR's that are a work in progress label Oct 11, 2021
@github-actions
Copy link
Contributor

Thank you for opening this PR! We appreciate you!

For all pull requests coming from third-party forks we will need to
review the PR before we can process it through our CI pipelines.

A Forem Team member will review this contribution and get back to
you as soon as possible!

@vishaldeepak vishaldeepak marked this pull request as ready for review October 11, 2021 15:55
@pr-triage pr-triage bot added PR: unreviewed bot applied label for PR's with no review and removed PR: draft bot applied label for PR's that are a work in progress labels Oct 11, 2021
Copy link
Contributor

@fdocr fdocr left a comment

Choose a reason for hiding this comment

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

Thanks for the PR @vishaldeepak!

app/controllers/comments_controller.rb Outdated Show resolved Hide resolved
app/controllers/comments_controller.rb Outdated Show resolved Hide resolved
Copy link
Contributor

@citizen428 citizen428 left a comment

Choose a reason for hiding this comment

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

Thanks @vishaldeepak

@pr-triage pr-triage bot added PR: partially-approved bot applied label for PR's where a single reviewer approves changes and removed PR: unreviewed bot applied label for PR's with no review labels Oct 14, 2021
Copy link
Contributor

@fdocr fdocr left a comment

Choose a reason for hiding this comment

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

LGTM

@pr-triage pr-triage bot added PR: reviewed-approved bot applied label for PR's where reviewer approves changes and removed PR: partially-approved bot applied label for PR's where a single reviewer approves changes labels Oct 14, 2021
@fdocr fdocr merged commit 3964bd7 into forem:main Oct 14, 2021
@pr-triage pr-triage bot added PR: merged bot applied label for PR's that are merged and removed PR: reviewed-approved bot applied label for PR's where reviewer approves changes labels Oct 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: merged bot applied label for PR's that are merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Misleading error message when commenting on a Post when blocked by author
3 participants