Commit graph

89 commits

Author SHA1 Message Date
Anna Buianova
7125a62db0
Changed logic for hiding and displaying low-quality marker for comments based on their score (#20581)
* Specs for revised comments thresholds

* Changed thresholds for low quality comments

* Added specs for comments page

* Fixed /comments and related specs

* Reorganized code for comments trees

* Specs for podcasts episodes comments

* Refactored Comments::Tree

* Refactored Comments::Tree + added specs

* Made build_sort_query private
2024-02-05 09:27:24 -05:00
Anna Buianova
58bd07d729
Render 404 when root comment has low score and no children (#20560) 2024-01-26 17:21:18 +00:00
Anna Buianova
41ab84a25d
Remove feature flag and use consistent rendering by default (#20305) 2023-11-03 11:42:12 -04:00
Joshua Wehner
8216700858
Trusted user _can_ use moderator comment (#20158)
* Trusted user _can_ use moderator comment

* Update spec to confirm cannot create

* Trusted user is trusted

* Better mod template access
2023-09-26 10:24:37 -04:00
Joshua Wehner
dfe71c15a1
Record feed event for article comments (#20087) 2023-09-13 11:14:27 -04:00
Duke Greene
945587b75d
fast follow refactor, handle downthread blocked commenters (#19910)
* fast follow controller and spec refactor, handle downthread blocked commenters

* update only one column in spec, avoid recursion when traversing comments
2023-08-15 10:49:56 -04:00
Duke Greene
e5c1a2d7ba
prevent replies to a blocking user on a third party's article (#19898) 2023-08-08 09:53:33 -04:00
Anna Buianova
2c759ca4dc
Consistent rendering on preview: comments and articles (#19361)
* Consistent rendering for previews (Articles, Comments)

* Rubocop fix

* Added preview comments specs when consistent rendering disabled

* Added specs for preview articles and comments + a couple of fixes
2023-04-27 14:08:15 +03:00
Anna Buianova
6698c1dc28
Set flash[:error] when markdown has invalid liquid tags on comment update (#19353)
* Added a spec for invalid gist (ContentRenderer)

* Added flash errors when comment validation fails
2023-04-20 15:48:30 +03:00
Joshua Wehner
2b24167fba
Try fixing comment like count bugs (#18438)
* Try fixing comment like count bugs

* Tests for the CommentCreator
2022-09-12 10:12:46 +02:00
Ridhwana
7f25a25fe1
Update the error message when a user with role "comment_suspended" tries to comment (#18367) 2022-08-26 10:23:52 -05:00
thejwuscript
9bc0d83130
Fix reply button visibility on locked discussion (#18023)
* Add specs for unlocked discussion

* Add specs for locked discussion

* Edit wording for discussion lock specs

* Set instance variable on CommentsController

* Fix legacy comments index view

* Empty commit - Trigger CI

* Modify test assertions

* Add data-testid attribute to reply button

* Add cypress custom command createComment

* Add cypress specs for locked discussion

* Add cypress specs for unlocked discussion

Co-authored-by: Fernando Valverde <fernando@fdo.cr>
2022-07-27 09:29:55 +01:00
Takuya N
1c9bc2d1ef
Replace links to the repo with newer URLs (#17319)
Signed-off-by: Takuya Noguchi <takninnovationresearch@gmail.com>
2022-04-18 22:11:31 -04:00
Jeremy Friesen
3e3ca36d0f
Removing unused instance_variable (#17088)
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)
2022-04-04 08:47:25 -04:00
yheuhtozr
c4778d832e
app/controllers & decorators i18n (#16126)
* app/controllers (& decorators) i18n etc

* tidy key names

* update keys

* delete ja.yml

* delete an involved ja.yml

* fix for PR review

* fix for spec

* delete ja.yml
2022-02-03 13:35:56 -05:00
Josh Soref
5324eb1477
Spelling fixes to live code (#15670)
Co-authored-by: Josh Soref <jsoref@users.noreply.github.com>
2021-12-06 12:11:25 +02:00
Anna Buianova
4cab190285
Hiding comments: an option to hide or keep children (#15178)
* Optional hiding child comments (start)

* Changed confirm button in comments hide form

* Hide children comments if hide_children was passed

* Added a spec for hidden child comment notifications

* Hide only explicitly hidden comments

* Hide comment modal on article page

* Prevent default behaviour for hide comment link

* Improved hide comments modal looks

* Improved hide comments modal looks

* Removed unused code

* Send hide comment form via fetch

* Hide comment descendants when hide_children was passed

* Don't hide hidden comments descendants on permalink

* Removed unnecesary span

* Improved hide comments modal styling

* Removed unused styles and js, improved styling

* Clickable label

Co-authored-by: ludwiczakpawel <ludwiczakpawel@gmail.com>

* Fixed showing hidden comments spoiler for article author

* Fixed hideArticleComments.spec.js

* Fixed displaying hidden comments text for artice author, added specs

* Target hide comments modal inside the modal when adding a listener

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>

* Replaced hide comment link with a button

* Refactored adding hide_children url param

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>

* Fixed cypress hide comments test

* Removed aria-label for submit on the hide comments modal

* Fixed formatting

Co-authored-by: ludwiczakpawel <ludwiczakpawel@gmail.com>
Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
2021-11-18 11:57:40 +03:00
Daniel Uber
14caad86a7
handle deleted article's comments page with a 404 response (#15351)
* 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
2021-11-11 12:56:14 -06:00
yheuhtozr
44bddb5a94
views/videos i18n (#15022)
* views/videos i18n

* remove ja.yml
2021-10-14 16:08:11 -06:00
VISHAL DEEPAK
3964bd7983
When a user is blocked from commenting on an article, show correct error message (#15009)
* 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
2021-10-14 07:42:08 -06:00
Ben Halpern
b900c8de92
Remove legacy "deleted commentable" view (#15052)
* Remove unneeded extra page

* Update app/views/comments/index.html.erb

Co-authored-by: Michael Kohl <citizen428@forem.com>

* Update app/views/comments/index.html.erb

Co-authored-by: Michael Kohl <citizen428@forem.com>
2021-10-13 10:23:25 -04:00
Michael Kohl
1b87cc7626
Profile generalization cleanup phase 2 (#14555)
* Remove ignored profile columns

* Update test.rb

* Remove dev profile fields CSV

* Fix first round of specs

* Add additional .includes

* More spec fixes

* Preload user in more locations

* Fix typo

* Spec/preloading fixes

* Specy McSpecFace

* Update e2e seeds

* Update e2e sees with correct display area

* Remove unused eager loading

* Update test.rb

* Add another entry to Bullet.safe_list

* Fix e2e seeds
2021-08-27 09:17:26 +07:00
Saroj Sasamal
e6e99e902b
add user friendly error message when a comment is made on a deleted post (#13721)
* 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>
2021-06-03 10:17:26 +07:00
Michael Kohl
6dfabd578f
Rename SiteConfig to Settings::General (#13573)
* 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'
2021-05-21 14:45:37 +02:00
Michael Kohl
111b7316d9
Remove mascot footer image (#13642)
* Remove footer mascot image

* Move remaining mascot settings back to SiteConfig

* Add data update script

* Update usages

* Fix path

* Remove dead route

* Update tests

* Fix view and spec

* Fix e2e test

* Fix DUS
2021-05-11 13:55:18 +02:00
Michael Kohl
f2f5e911cf
Add Settings::Mascot (#13451)
* Add Settings::Mascot

* Add DUS

* Update usage

* Fix e2e test and controller

* Fix specs

* Fix remaining spec
2021-04-26 11:39:19 +07:00
Mac Siri
aed41c3238
Fix Ruby 2.7 kwargs' warnings & misc spec warnings (#13256) 2021-04-06 16:57:59 -04:00
Michael Kohl
2c1e8443e1
Make definition of new user configurable (#12999)
* 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>
2021-03-23 14:13:06 +07:00
Michael Kohl
2513de92fb
Add rate limit for new user comments (#12925)
* Add rate limit for new user comments

* Rename limit, add check to controller

* Add spec

* Fix specs
2021-03-16 08:39:31 +07:00
Alex
31689fd76a
Break MarkdownFixer into MarkdownProcessor::Fixer services (#12241)
* 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
2021-01-14 10:26:46 -05:00
Alex
a5e6f7942c
Rename MarkdownParser to MarkdownProcessor::Parser (#12248)
* Rename MarkdownParser to MarkdownProcessor::Parse

* Wake up, Travis

* Fix typo
2021-01-13 10:39:13 -05:00
Guilherme Garnier
e35f97cf37
Fix "possible unprotected redirect" warning (#10511)
* Fix "possible unprotected redirect" warning

* Fix 'line too long' warning
2020-12-29 14:54:34 -05:00
Alex
1fbd20087a
[deploy] Remove redirect on comments#update (#10337)
* Remove redirect on comments#update

* Delete unecessary view

* Refactor to account for orgs and podcasts

* Code cleanup

* Add specs

* Fix podcast comment update

* Add more safe navigation operators

* Update safe nav operators again

* Update comment to explain more
2020-09-29 15:33:51 -04:00
Rafi
84012d400d
Deleting hidden comment notification using after_update (#9823)
* Deleting comment notification using after_update

* Using conditional callback to delete notification

* Adding tests for notification deletion
2020-08-31 11:01:25 +02:00
Arit Amana
df900cfd98
[Admin Tooling] Log comment deletion (#9968)
* Log comment deletion

* Fix my STUPID mistake!
2020-08-24 10:30:16 -04:00
Arit Amana
c1fe6a6488
[deploy] [Moderation] Allow admins to delete comments (#9628)
* Styling of Delete Comment

* Start hooking DELETE action up

* Add new route

* Add new action

* Update comment_policy.rb

* Update specs for comment_policy.rb

* Some more specs

* Update api call

* Building delete functionality

* Still building...

* Complete implementation

* Changes from PR review

* Fix failing spec; rework admin_delete method

* Protect redirect

* Improve admin_delete method

* Protect redirect

* Refactor JS file and admin_delete method

* Fix flash messages issues

* Fix confirm dialog

* Final QA changes
2020-08-13 10:15:48 -04:00
rhymes
cc8bfcb5c0
Enable Rubocop 0.89 cops and fix Lint/ violations (#9709)
* 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
2020-08-10 16:57:12 +02:00
Molly Struve
a16fc46f84
[deploy] Revert "Async Handle Notifications for Comments When Saved (#9680)" (#9686)
This reverts commit 852223dd86.
2020-08-08 20:16:27 -05:00
Molly Struve
852223dd86
[deploy] Async Handle Notifications for Comments When Saved (#9680) 2020-08-08 17:59:17 -05:00
Brunno Souza
b5de27f1a6
Refactoring comments_controller#create reducing lines (#9162) 2020-07-10 17:24:36 +02:00
Molly Struve
074fe8626d
Refactor: Report Pusher Errors to Honeybadger, Remove Comment Error Logging (#9208) 2020-07-09 08:49:48 +02:00
rhymes
5b62811c98
[deploy] Rubocop: fix violations of Layout/LineLength (#9197) 2020-07-08 08:36:36 -05:00
Rafi
8e3ef448e5
[deploy] Removing notification of hidden message (#8881) 2020-07-05 14:51:28 -05:00
Alex
347a4bbc75
[deploy] Add contexts and permissions to liquid tags (#8917)
* 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
2020-06-30 14:53:18 -04:00
Dmitry Maksyoma
17a9335680
Duplicate notifications, when replying to and mentioning the same user (#8156)
* Refactor Mentions::CreateAll

* Update app/services/mentions/create_all.rb

Co-authored-by: Vaidehi Joshi <vaidehi.sj@gmail.com>

* Refactor for readability

* Try writing tests for duplicate notifications

* Skip Bullet warning, essentially for #current_user

* Fix duplicate notification, when mentioning comment author

* Improve spec readability

* Refactor specs and fix duplicate notificaation for moderator comments

* Refactor spec

* Remove obsolete code and refactor specs

* Remove obsolete spec

* Update spec/requests/comments_create_spec.rb

Co-authored-by: Vaidehi Joshi <vaidehi.sj@gmail.com>

* Get rid of #json_response

* Remove Bullet skipping

* Change #where -> #exists?

Co-authored-by: Vaidehi Joshi <vaidehi.sj@gmail.com>
2020-06-17 08:47:31 -04:00
Michael Kohl
b06e9901d5
Add ApplicationRecord#errors_as_sentence (#8265)
* Add ApplicationRecord#errors_as_sentence

* Refactor existing uses

* Use errors as sentence more consistently
2020-06-04 16:02:41 +02:00
Molly Struve
ba0ebbafa8
[deploy] RateLimit Refactor: Consolidate Logic for Checking a Limit and Raising an Error (#7636) 2020-05-01 13:31:44 -05:00
rhymes
d87c3dbb18
[deploy] Improve comment posting error handling (#7519)
* Improve comment posting error handling

* Incorporate PR suggestions
2020-04-27 16:54:59 +02:00
Andy Zhao
f5ec83653c
[deploy] Finalize and add response templates feature (#7068) 2020-04-16 15:53:29 -04:00
Ben Halpern
0817e2ac9e
Create implicit experience level rating vote upon creating of readinglist reaction (#6522) [deploy]
* 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
2020-03-10 10:59:49 -04:00