* fast follow controller and spec refactor, handle downthread blocked commenters
* update only one column in spec, avoid recursion when traversing comments
While reviewing the authorization system, I saw a curious instance
variable and wanted to know more about it. Turns out, it's no longer
referenced.
`$ rg "on_comments_page"` exits status 1 (e.g. no matches)
* Add a failing test for comments index of deleted article
After https://github.com/forem/forem/pull/15052 removed the (also
broken) deleted commentable template and the redirect, requests for
comments from deleted articles raise no method errors (initially
trying to set the page title to "Comments for commentable.title" but
the assumption that @commentable is non-nil is present in several
other places.
This test currently fails (by design). Either we want to update the
controller so that comments from deleted articles are no longer
viewable (returning not found, as we did prior to
https://github.com/forem/forem/pull/5199 or making the view safe for
the case where @commentable is nil and no @root_comment is present.
These requests are happening quite frequently (@maestromac and I
suspect the sitemap may contain these pages and crawlers are visiting
the site from a published link), as evidenced by
https://app.honeybadger.io/projects/66984/faults/81994265
* Add request spec for deleted article scenario
Additionally, relabel the legacy spec (updated during #15052) to
clarify we do not render the deleted_commentable_comment view (this is
testing the comment.path, rather than the article.path/comments index
The scenario with comment.path sets `@root_comment` in the controller,
so does not trigger errors on the `@commentable` method calls.
* Update view
pass 1: get the errors to stop (need to check the rendered page is
also usable, the comment tree is not shown when commentable is nil and
this might be a huge usability/correctness issue).
* extract logic from comments index to methods and update tests
We no longer expect deleted article's comments index to render (should
return 404), only direct links to comments of deleted articles.
Only assign @article in the index for the view if it is in fact an
article (not a podcast episode, it's possible `@root_comment` was for
a podcast episode).
* remove unneeded (and soon to be incorrect spec)
No longer want or need to test for the case where root comment is nil
and so is commentable. This was an exploratory spec (scaffolding) and
can be removed.
* Undo nil safety changes to comments index
and fix typo in comments spec
* When a user is blocked from commenting on an article, show correct error message
* Created new error type ModerationUnauthorizedError and changed error text for it
* add user friendly error message when a comment is made on a deleted post
* add validation message when commentable is empty
* Update app/models/comment.rb
Co-authored-by: Michael Kohl <me@citizen428.net>
* Update spec/models/comment_spec.rb
Co-authored-by: rhymes <github@rhymes.dev>
* Update spec/models/comment_spec.rb
Co-authored-by: rhymes <github@rhymes.dev>
Co-authored-by: Michael Kohl <me@citizen428.net>
Co-authored-by: rhymes <github@rhymes.dev>
* Rename SiteConfig
* More renaming
* Update spec
* Update mandatory settings mapping
* More renaming
* e2e test fixes
* You have a rename, and you have a rename
* Spec fix
* More changes
* Temporarily disable specs
* After-merge update
* Undo rename for migration
* undo rename of DUS
* Fix DUS
* Fix merge problem
* Remove redundant DUS
* Fix specs
* Remove unused code
* Change wrong class name
* More cleanup
* Re-add missing values to constant
* Fix constant
* Fix spec
* Remove obsolete fields
* Add accidentally removed field
* Update spec
* Move methods from Settings::General to ForemInstance
* Remove unneeded model
* Change mentions of 'site config'
* Make definition of new user configurable
* Add new user configuration to config admin
* Only decorate on-demand
* Adapt new user logic
* Update app/lib/constants/site_config.rb
Co-authored-by: Vaidehi Joshi <vaidehi.sj@gmail.com>
Co-authored-by: Vaidehi Joshi <vaidehi.sj@gmail.com>
* Create new MarkdownProcessor::Fixer services
* Remove old MarkdownFixer
* Code cleanup
* Capitalize Base in code comments
* Remove comments related to inheritance
* Add fix_methods method to hold METHDOS constant
* Enable new Lint/ cops and run rubocop -a
* Fixing last remaining things with rubocop -a
* Enable and fix Style/ExplicitBlockArgument and Style/GlobalStdStream
* Forgot parenthesis
* Make liquid tags adhere to context and permission
* Undo updates to all liquid tags and update error
* ACTUALLY update errors this time
* Typo
* Refactor error handling and add support for Comment
* Fix specs
* Code cleanup
* Prettify error message
* Add comment clarifying error
* parsed --> parse
* Use a policy for validating roles
* Fix pretty error message
* Return early if valid source
* Get rid of duplicate current_user
* Add comment to Pundit.authorize
* LiquidTagPolicy specs
* Update liquid tag docs
* Update docs
* Use parse_context argument for clarity
* Remove duplicate guard clause for VALID_ROLES
* Update docs
* Do not render or link to empty rss feeds
* s
* Move calculation to worker
* remove xit test
* Also allow implicit rating votes in comments
* Fix alignment issue
* Remove comment logic