-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Refactor common HTML methods into HtmlHelper #4174
Conversation
- prefix_all_images(html, width) - giphy_img?(source) - allowed_image_host?(src) Offenders: - app/labor/markdown_parser.rb - app/models/html_variant.rb
18fcc96
to
c244dbf
Compare
Hi @filalex77, thanks a lot for your contribution! Although you managed to lower duplication stats I'm not completely comfortable with this refactoring because at the end of the day the result is a generic (the classic "utility" module hintend by its name For experience, generic sounding modules will end up becoming a repository of methods that we don't know where to put instinctively. I think you're on a good path with the idea but the naming and placing need to be improved. The The helpers situation right now in the code base is not great, theoretically helpers should help view rendering, but we also have decorators and actual view objects so I can see why that's not very clear. In this case I'm not 100% sure yet where and how this code should get refactored into and i'm open for a discussion, I'm not convinced this is the best way though. @lightalloy what do you think? |
@rhymes Thanks! My thoughts exactly. I put it as a helper for now to make discussion easier, but I was also mixed about where it should belong. And thanks for I'll wait on more input. |
@rhymes, I agree, I'm not comfortable with the refactoring using helpers in this case too. I try to avoid adding more code to helpers unless it's a small change or a small method to use in the templates.
This is not an ideal solution, of course, just a step to deduplicate. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm going to put this placeholder for other reviewers, check the discussion for details
Hey @filalex77! Thanks so much for the PR. With that said, we are in the process of going through and cleaning up some of our PR history to help us better prioritize what we need to be focusing on. We have decided unfortunately not to move forward with this PR so I am going to close it. Thanks so much for being an awesome contributor! Ping us anytime if you have questions! |
What type of PR is this? (check all applicable)
Description
prefix_all_images(html, width)
giphy_img?(source)
allowed_image_host?(src)
Offenders:
app/labor/markdown_parser.rb
app/models/html_variant.rb
Added to documentation?
This change is