Commit graph

64 commits

Author SHA1 Message Date
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
Sebastien
665f5aac0f
Refactor ProfileImage (#5803) 2020-02-07 08:56:16 -05:00
Michael Kohl
52759c9427
Allow deleting comments if article has already been deleted (#5889) [deploy] 2020-02-05 17:10:19 -05:00
Michael Kohl
96ac213614 Add comment explaing catch + reraise (#5782) 2020-01-28 08:36:40 -05:00
Sun-Li Beatteay
385a831d8f comment_controller: add skip_auth to rescue error block (#5728) 2020-01-27 14:35:53 -05:00
Maja Komel
3412af977f Don't raise StandardError for invalid liquid tags when updating comment (#5694)
* Don't raise StandardError for invalid liquid tags when updating comment

* remove text-align styling for alert error
2020-01-24 11:26:55 -05:00
Spencer
49474d516e Allow comments from deleted articles to be viewed (#5199) [deploy] 2020-01-24 11:06:52 -05:00
rhymes
ff7532b3db Handle liquid tag errors in comments form (#5485) [deploy]
* Handle liquid tag errors in comments form
* Do not hide Pundit::NotAuthorizedError errors
2020-01-14 14:10:05 -05:00
Michael Kohl
92b5f113be Return 429 Too Many Requests instead of raising (#5504) 2020-01-14 11:53:33 -05:00
Keith Bennett
3c980e7b83 Fix long line lints (#5062) 2019-12-26 13:24:24 -05:00
Anna Buianova
dcfa6d29b8 Fix Rubocop lints (#5155) 2019-12-19 10:09:37 -05: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
Andy Zhao
e6809d8e23 Fix logic error with creating comment block (#4566)
* Fix logic error with creating comment block

* Add additional test for more exercising
2019-10-23 18:32:37 -04:00
Jacob Herrington
59e7c104f2 Remove commented code and tests (#3989) [ci skip] 2019-09-09 14:51:02 -04:00
Mac Siri
5e75bf3aaa
Update PingAdmins to show triggering event (#3853) 2019-09-03 10:23:25 -04:00
Feruz Oripov
0ccc62ffa3 Refactoring possible unprotected redirect. (#3825)
* Refactoring possible unprotected redirect.

* Security refactoring tag_adjustments_controller.rb.

* Security refactoring tag_adjustments_controller.rb.

* Security refactoring articles_controller.rb.

* Security refactoring internal/welcome_controller.rb

* Security refactoring tags_controller.rb.

* Security refactoring comments_controller.rb.

* Security refactoring stories_controller.rb.
2019-08-27 10:13:38 -04:00
Ben Halpern
85e3be1f48
Create comments notification subscription upon creation (#3167)
* Create comments notification subscription upon creation

* Fix test
2019-06-14 20:11:58 -04:00
Andy Zhao
b953f17d0c New Feature: Subscribe to posts! (#3149)
* Add MVP of notification subscriptions

* Add rate limiting for notification subscriptions

* Show modal for logged out users on subscribe click

* Add enter key functionality for checkbox

* Add relationships for notification subscriptions

* Add model test for notification subscription

* Deprecated article mutes in favor of notification subscriptions

* Deprecated comment mutes in favor of notification subscriptions

* Move comment muting tests and logic over

* Merge comment and article muting into subscriptions

* Remove redundant check

* Use database to check for rate limit instead of cache

* Test for subscriptions handling notifications properly

* Fix notification model spec for subscriptions

* Fix tests for subscriptions

* Remove rate limiting

* Properly handle logged out users getting subscription status

* Fix test for new pattern

* Update reserved words

* Add config column to notification subscriptions

* Add logic for top level config and move tests

* Test for top level subscribers getting notified

* Fix logic mistake oops

* Add index and refactor comment_user_ids
2019-06-14 12:03:43 -04:00
Anna Buianova
0ecb937875 Added rubocop-rails (#3059)
* Added rubocop-rails

* Update rubocop version in the CodeClimate config
2019-06-06 09:47:57 -04:00
rhymes
6a626e819d Refactor: fix issues raised by bullet (#2965)
* Preload organization, not user

* Preload users only when needed

* Pre-load podcasts for podcast episodes in API

* Avoid eager loading error by loading rating votes separately

* Preload associations for moderation

* Preload user comments in trees

* Preload organization for non org dashboard and cleanup queries

* Optimize ArticleSuggester to only load N articles at need

* Remove eager loading and pass variables to partials for easier debug

* Reorganize tags validation code and ignore actsastaggableon eager loading issues

* Remove unused eager loading and bring up comments relation

* Preload podcasts when loading podcast episodes

* Fix views specs

* Make sure ArticleSuggester never returns duplicates

* Remove commented code

* Re-trigger build

* Move suggested articles back to view to respect fragment caching
2019-05-28 17:32:53 -04:00
Andy Zhao
8ef611f879 Remove Honeycomb from the app (#2366)
* Remove Honeycomb related gems

* Remove Honeycomb related code from controllers

* Remove Honeycomb from RSS Reader

* Remove Honeycomb related files

* Remove Honeycomb related tests

* Remove leftover Honeycomb methods
2019-04-11 10:49:35 -04:00
Abraham Williams
9cb40e546b Enables Rails cops (#2186)
* Enable Rails cops

* Fix Rails/DynamicFindBy

* Fix Rails/HttpStatus

* Fix Rails/Blank

* Fix Rails/RequestReferer

* Fix Rails/ActiveRecordAliases

* Fix Rails/FindBy

* Fix Rails/Presence

* Fix Rails/Delegate

* Fix Rails/Validation

* Fix Rails/PluralizationGrammar

* Fix Rails/Present

* Fix Rails/Output

* Fix Rails/Blank

* Fix Rails/FilePath

* Fix Rails/InverseOf

* Fix Rails/LexicallyScopedActionFilter

* Add Rails/OutputSafety to TODO

* Add Rails/HasManyOrHasOneDependent to TODO

* Add Rails/SkipsModelValidations to TODO
2019-03-25 09:25:55 -04:00
Tim Lange
3494264404 Enabled rubocop/lint (#2130)
* WIP: Enabled rubocop/lint

* FIX: Fixed failing test

* FIX: Small change to return

* FIX: Changed indent
2019-03-21 10:53:44 -04:00
Keshav Biswa
8d57d45ecc Rubocop Style cops enabled (#2056)
* Rubocop enabled style/alias

* Enabled Style/ArrayJoin Cop

* Enabled Style/Attr

* Enabled Case Equality

* Enabled CharacterLiteral

*  Enabled ColonMethodCall Cop

* Enabled CommentAnnotation cop

* Enabled PreferredHashMethods Cop

*  Enabled DoubleNegation Cop

* Enabled EachWithObject Cop

* Enabled EmptyLiteral Cop

* Enabled EvenOdd Cop

* Enabled IfWithSemicolon Cop

* Enabled Lambda and LambdaCall Cop

* Enabled LineEndConcatenation Cop

* Enabled ModuleFunction Cop;

* Enable NegatedIf and NegatedWhile Cop

* Enabled NilComparison Cop

* Enabled Not Cop

* Enabled NumericLiterals Cop

* Enabled OneLineConditional Cop

* Enabled PercentLiteralDelimiters Cop

* Excluded internal/users_controller from negated_if cop

* Reverted the double negation change from github_issue_tag and github_issue.rb"

* Enabled PerlBackrefs Cop

* Changed Regexp.last_match(1) to Regexp.last_match(0)

* Enabled proc cop

* Enabled RaiseArgs Cop

* Reverted Regexp.last_match(0) to Regexp.last_match(1)

* Enabled SelfAssignment Cop

* Enabled SingleLineMethods Cop

* Enabled SpecialGlobalVars Cop

* Enabled VariableInterpolation Cop

* Enabled WhenThen Cop

* Enabled WhileUntilModifier Cop

* Enabled WordArray Cop

* Enabled IfUnlessModifier Cop

* Enabled GuardClause Cop
2019-03-15 18:33:54 -04:00
rhymes
3c6a7d4574 Display comment published timestamp according to user's locale (#1970) 2019-03-08 15:19:37 -05:00
Andy Zhao
c4677071a7 Mute notifications for a comment thread (#1636)
* Use idempotent update instead of toggle

* Update editor guide with new comment instructions

* Render the settings button on page load

* Add settings button to comment dropdown

* Update styles to properly render

* Add comment mute function and settings page

* Clean up erb spacing

* Remove unneccessary user_id param

* Add receive_notifications for policy spec

* Update name for accuracy

* Add request spec for comments_mute

* Remove unused permitted attributes

* Add actually used permitted attributes
2019-01-24 17:20:38 -05:00