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

Handle Missing Root Comment in Deleted Comment View #5716

Merged
merged 1 commit into from
Jan 27, 2020

Conversation

mstruve
Copy link
Contributor

@mstruve mstruve commented Jan 24, 2020

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

  • Bug Fix

Description

Saw this error come through Honeybadger where the root comment was missing for a view so I added a blank check to the view to handle this situation.

ActionView::Template::Error: undefined method `deleted' for nil:NilClass
deleted_commentable_comment.html.erb  6 _app_views_comments_deleted_commentable_comment_html_erb___245802387296255488_73890320(...)
[PROJECT_ROOT]/app/views/comments/deleted_commentable_comment.html.erb:6:in `_app_views_comments_deleted_commentable_comment_html_erb___245802387296255488_73890320'
4   <div class="single-comment-node root">
5     <% @user ||= @root_comment.user %>
6     <% if @root_comment.deleted %>
7       <div class="inner-comment">
8         <div class="body">

Added to documentation?

  • no documentation needed

[optional] What gif best describes this PR or how it makes you feel?

alt_text

@pr-triage pr-triage bot added the PR: unreviewed bot applied label for PR's with no review label Jan 24, 2020
Copy link
Contributor

@atsmith813 atsmith813 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: unreviewed bot applied label for PR's with no review labels Jan 24, 2020
Copy link
Contributor

@rhymes rhymes left a comment

Choose a reason for hiding this comment

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

Would it be possible to add a test for this? :)

It can also be done in a separate PR but still, I think we should get into the habit of testing code that can possibly become a regression, especially if it's a bug that ends up in HB. This way we create a habit and less future alerts in HB ;)

@mstruve
Copy link
Contributor Author

mstruve commented Jan 27, 2020

Since I got the reviews and this is a small change, I'm going to push it out as is but I do agree with you @rhymes

@mstruve mstruve merged commit ebf4320 into master Jan 27, 2020
@pr-triage pr-triage bot removed the PR: reviewed-approved bot applied label for PR's where reviewer approves changes label Jan 27, 2020
@mstruve mstruve deleted the mstruve/root-comment-view branch January 27, 2020 13:44
@pr-triage pr-triage bot added the PR: merged bot applied label for PR's that are merged label Jan 27, 2020
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.

None yet

4 participants