Commit graph

71 commits

Author SHA1 Message Date
Jacob Herrington
a5b2d109d5
Rename banned and comment_banned roles (#12270)
* Rename banned and comment_banned roles

* Add data update script to rename roles containing 'ban'

* Add named error for Suspended users

* Update unidiomatic method names

* Rename misc banned to suspended

* Apply suggestions from code review

Co-authored-by: Michael Kohl <me@citizen428.net>

* Add unit tests for suspended methods

This commit also adds TODO comments for removing banned and
comment_banned from the codebase after data update scripts have
successfully run on all of our Forems.

Co-authored-by: Michael Kohl <me@citizen428.net>
2021-04-06 10:12:14 -05:00
Vaidehi Joshi
484c97fc8d
Limit mentions in posts (#13259)
* Limit mentions in articles

* Bump MAX_USER_MENTION_LIVE_AT to April 7th, 2021 UTC time

* Use stubbed constants in article and comment specs

* Add TODOs around extracting MAX_USER_MENTIONS into constant
2021-04-05 18:19:46 -07:00
Vaidehi Joshi
68831039d1
Limit mentions in comments (#12923)
* Limit number of mentions in a single comment

Ensure that no more than 6 users can be mentioned in a single comment

* Extract max user mentions into constant

* Check mentions but don't process them unnecessarily

* Add error message check to comment spec

* Add MAX_USER_MENTION_LIVE_AT to comments, plus specs

* Bump MAX_USER_MENTIONS to 7 for DEV Top Seven posts

* Add some clarifying comments around MAX_USER_MENTION limit

* Update app/models/comment.rb to use activesupport helper!

Co-authored-by: Michael Kohl <citizen428@dev.to>
2021-03-10 11:23:11 -08:00
Arit Amana
845e00797b
[EOY 2020] Replace "ban" with "suspend" in Admin (#11581)
* Implement changes

* display "Suspended" if user role.name is banned

* Correct equality symbol

Co-authored-by: Michael Kohl <me@citizen428.net>

Co-authored-by: Michael Kohl <me@citizen428.net>
2020-11-25 09:15:07 -05:00
Ben Halpern
c77a13c0d0
[deploy] Auto-suspend multiple-spammers (#10679)
* Auto-ban multiple-spammers

* Fix xit
2020-10-06 18:07:48 -04:00
Ben Halpern
eefbe25bd3
[deploy] Add ability for admin to add anti-spam terms (#10615)
* Add ability for admin to add anti-spam terms

* Fix specs

* Fix tests

* Fix typo

* Fix test
2020-10-06 10:10:30 -04:00
rhymes
10efa25c0a
Add missing presence validators to models (#10495)
* Add missing presence validator for Tag

* Add missing presence validators to Follow

* Add missing presence validators to ProfileField

* Add missing presence validators to Comment

* Add missing presence validators to Profile

* Add missing presence validators to Organization

* Add missing presence validators to Badge

* Add missing presence validators to Webhook::Endpoint

* Add missing presence validators to NotificationSubscription

* Add missing presence validators to PodcastEpisode

* Add missing presence validators to Sponsorship

* Add missing presence validators to PollOption

* Add missing presence validators to Poll

* Add missing presence validators to Article

* Add missing presence validators to EmailAuthorization

* Add missing presence validators to AuditLog

* Add missing presence validators to DataUpdateScript

* Add missing presence validators to User

* Add missing presence validators to SiteConfig

* Fix specs
2020-10-01 16:15:32 +02: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
rhymes
c9e401758a
[deploy] Add dependent clauses to Article and fix Comment validation (#9990)
* Add dependent clauses to Article model

* Comment should be valid without a commentable

* Add cleanup scripts

* Cache the comments ids before destroying the article

* Add dependent clause to Article.user_subscriptions as well

* Fix specs
2020-08-28 18:24:28 +02:00
Molly Struve
f84f88f9bf
Flaky Spec Fix:Remove let_it_be usage from Comment Model Spec (#9529) 2020-07-26 17:22:51 -05:00
rhymes
ffc96db209
Rubocop: fix additional violations in todo file (#9218) 2020-07-09 10:25:44 -04:00
rhymes
5b62811c98
[deploy] Rubocop: fix violations of Layout/LineLength (#9197) 2020-07-08 08:36:36 -05:00
Molly Struve
5d22e71ad6
nothing to see here....except maybe reverting a push to master (#8308)
🙈
2020-06-05 20:34:21 -05:00
mstruve
533cab50d6 synchronous roles 2020-06-05 20:02:41 -05:00
Molly Struve
a4cc606291
[deploy] Remove Elasticsearch from Index Worker Names (#7594) 2020-04-29 12:12:29 -05:00
rhymes
f5a6ff32cc
Finalize Slack messengers refactoring (#7484)
* Remove dead code

* Rename SlackBotPingWorker to Slack::Messengers::Worker

* Remove useless Slack mock

* Fix specs
2020-04-24 21:15:10 +02:00
Josh Puetz
98365c878e
Parse comment html as fragments instead of docs (#7419) 2020-04-21 15:01:44 -05:00
Molly Struve
817f12c788
no need to use search_id for indexing worker (#7304) 2020-04-15 15:35:12 -04:00
Molly Struve
be3a259b8e
[deploy] Make root_exists Method Public and Use In Other Callbacks (#7101) 2020-04-06 14:48:41 -05:00
rhymes
f2b0be2043
Add Slack messengers: part 2 (#6916)
* Add Slack::Messengers::ArticlePublished

* Add Slack::Messengers::ReactionVomit

* Add Slack::Messengers::CommentUserWarned

* Add missing URL helpers

* Add Slack::Messengers::ArticleFetchedFeed

* Remove callback condition

* Build, don't create
2020-04-03 17:00:06 +02:00
rhymes
118762ca9b
Some RSpec fixes (#6757)
* Fix spec/uploaders/profile_image_uploader_spec.rb

* Additional ordering based fixes

* Fix spec/requests/comments_spec.rb

* Fix spec
2020-03-24 13:16:19 -04:00
Molly Struve
3087d3d4d8
Index comments into FeedContent index (#6791) [deploy] 2020-03-24 09:24:20 -05:00
rhymes
20fd8cdb92
Replace observers with callbacks and remove rails-observers (#6675)
* Add test for vomit reactions ping

* Remove reaction observer

* Add tests for new published article ping

* Remove reaction observer

* Remove comment observer

* Fix specs

* Remove rails-observer gem
2020-03-18 09:58:36 +01:00
Alex
35651b26e5
Remove Algolia from Comments (#6464) [deploy]
* Remove Algolia from comments

* Remove more references to ordered_comments index

* Remove more references to Comments Algolia index

* Fix index_worker_spec
2020-03-05 11:30:25 -08:00
Spencer
010c61a44a
Allow comments without a commentable to be edited and destroyed (#5945) 2020-02-25 13:45:50 -05:00
Matej Minárik
89dd843a50
Fix Flaky Comment Spec (#6250) 2020-02-24 18:48:45 -05:00
Lucas Hiago
d5a5c53419 Change Notifications::UpdateJob to Notifications::UpdateWorker and move to sidekiq (#5689) [deploy] 2020-01-28 12:43:50 -05:00
Alex
f6c2f46fbb
Move Search::RemoveFromIndexJob to Sidekiq (#5637) [deploy]
* Create RemoveFromIndexWorker

* Create spec for RemoveFromIndexWorker

* Update RemoveFromIndexJob to RemoveFromIndexWorker

- Update references from the job to the new worker
- Update specs to use the new worker
- Fix spec in comment_spec that causes linter/RuboCop violation

* Remove unnecessary argument nil check

* Update spec for missing data
2020-01-23 11:27:28 -08:00
Alex
4e5dc015b3 Move Search::IndexJob to Sidekiq (#5620) [deploy] 2020-01-22 08:24:53 -05:00
Asha Balasubramaniam
81ead4935a Migrate Comments::BustCacheJob to Comments::BustCacheWorker and move to Sidekiq (#5502) 2020-01-16 10:20:13 -05:00
Lucas Hiago
74f9decc56 Change Notifications::RemoveAllJob to Notifications::RemoveAllWorker and move to sidekiq (#5451) 2020-01-15 12:34:12 -05:00
Asha Balasubramaniam
e5960810cc Migrate Comments::SendEmailNotificationJob to Sidekiq (#5427)
* Add sidekiq version of the corresponding delayed job
* Switch the invocation of the delayed job from `after_create` to
`after_create_commit` to avoid the race condition where the worker can
be executed before the comment is persisted. Added covering spec
for this change.
2020-01-10 13:59:12 -06:00
Pablo Ifrán
f5d3593d4f Change the way that id_code was created (#5348) [deploy]
The column id_code was created with a job in an after create callback,
that was replaced by an inline creation of the attribute
2020-01-08 16:21:39 -05:00
Asha Balasubramaniam
1003f71c8f Migrate delayed job that calculates comment score to sidekiq (#5382) 2020-01-08 14:11:31 -05:00
Molly Struve
a572a96921
Remove comments user_touch job and do it inline when comment is created (#5378) [deploy] 2020-01-06 15:52:59 -05:00
Pablo Ifrán
783d43b737 Change create first reaction job to worker (#5327) [deploy] 2020-01-02 13:06:53 -05:00
Keith Bennett
70e1ffbbc3 Fix rubocop Rails.root.path complaints (#5114) 2019-12-16 12:13:15 -05:00
Anna Buianova
bbc5f95d86 Fix Algolia deserialization errors by indexing by record_type and id rather than AR object (#5063) [deploy] 2019-12-11 11:49:35 -06:00
Andy Zhao
71157c993e Hide comment feature (#4944)
* Add MVP of hide comment feature

* Slight copy adjustments

* Remove unused file oops

* Fix strange styling issues

* Add hide/unhide comment specs

* Authenticate user for hide/unhide

* Add tests for hide/unhide functionality

* Remove opacity CSS for hidden comments

* Fix hidden comment explanation logic

* Fix some styling issues

* Fix hiding top level comment logic

* Show only hidden comments in permalink and not thread

* Hide subtree properly if hidden comment

* Fix weird CSS issue

* Properly hide comments for permalink view

* Show children comments in permalink view

* Add tests for comment hiding visibility

* Remove superfluous code and adjust copy

* Remove some more logical duplication

* Add dedicated article column for any comments hidden

* Add reload in test
2019-12-10 15:09:47 -05:00
rhymes
9c05e618db Improve speed of model tests by around 50/60 seconds (#5016) 2019-12-09 16:33:48 -05:00
rhymes
e461f0d799 Routine rubocop fixes after gem update (#4309)
* Regenerate rubocop todo

* Fix outstanding problems

* Fix Style/FormatStringToken

* Final update to rubocop todo file

* Set RSpec/ExampleLength to max 10 and regenerate todo file
2019-10-10 17:27:01 -04:00
Andy Zhao
3b0f6f2834 Refactor remove_all and remove_each notifications and fix orphaned notifications (#3570) 2019-09-25 15:31:56 -04:00
cyrillefr
369aeb9130 Fix comment deletion bug (#3732)
Fix bug where deleted comment still appears on user's profile
2019-08-27 17:07:09 -04:00
rhymes
816c062ea0 Upgrade Rubocop related gems and fix new violations (#3581) [ci skip] 2019-07-30 14:29:05 -04:00
Anna Buianova
f5709ce2d8 Fix failing algolia jobs (#3578)
* Fix algolia sync when destroying comments

* Fix algolia jobs when destroying a user
2019-07-30 08:47:40 -04:00
cyrillefr
fb1915c1be Move delayed algoliasearch tasks to Active Jobs (#3486)
- refactor calls to use built-in algolia Active Job
  - add spec
2019-07-29 08:58:27 -04:00
Ben Halpern
26af371ebd
Fix comment title encoding issue (#3311)
* Fix comment title encoding issue

* Remove puts statements

* Fix flaky test

* Change flaky test

* Add & fix
2019-06-26 15:24:05 -04:00
Bolarinwa Balogun
dbc4abc587 Add rel="nofollow" to links in comments (#3304)
* Add rel="nofollow" to links in comments

* Improve code quality and Add tests
2019-06-26 09:02:11 -04:00
rhymes
6cdc604333 Rubocop: disable style rule and fix some issues (#3278) [ci skip] 2019-06-24 12:20:29 -04:00
Ben Halpern
d48ad63aea
Add comment context for notifications and comment pages (#3262)
* Add comment context for notifications and comment pages

* Fix comment spec and adjust css
2019-06-22 14:50:15 -04:00