Commit graph

538 commits

Author SHA1 Message Date
Ben Halpern
4349843c05
Frontend bug fixes (#5158) [deploy]
* Frontend bug fixes

* One line fix
2019-12-17 10:56:51 -05:00
Abner Soares Alves Junior
536c62da89 Refactor all has_enough_credits to enough_credits (#5119) 2019-12-16 15:00:59 -05:00
Molly Struve
9912bbcdb8
Asynchronously Update Algolia after a PageView Update (#5076) [deploy] 2019-12-13 14:07:33 -06:00
Spencer
82f5bb9cdd Mod tooling: add tags via /mod refactor (#5017)
* mod view form changes

* add error validation for removal tag

* add error validation to tag_list count

* re-render tag_adjustment form errors

* refactor admin delete adjusted tags form

* add prompt to tag adjustment form select

* front end validations to add/remove tag_adjustment

* allow tag_mod to undo own tag adjustment

* update/add specs

* update send spec

* update tag adjustment spec
2019-12-13 13:02:45 -05:00
Bolarinwa Balogun
8c6adac7ba Remove special characters in tags for articles created via API (#4239) [deploy] 2019-12-13 11:29:02 -05:00
Anna Buianova
05fe308f5b Removed old user indexing code (#5102) 2019-12-13 10:44:12 -05:00
Jacob Herrington
145db47a3a Add single resource admin concept (#5069) [deploy]
* Add a trait for single_resource_admins to users factory

* Add single_resource_admin authrization for Growth view

* Expand GrowthController test coverage

* Add single resource admin workaround to models

* Add single resource admin to additional views
2019-12-11 13:17:55 -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
Molly Struve
7c650dcb1c
Remove RedisRailsCache and replace with Rails.cache (#5059) [deploy] 2019-12-10 13:11:08 -06:00
rhymes
9c05e618db Improve speed of model tests by around 50/60 seconds (#5016) 2019-12-09 16:33:48 -05:00
rhymes
87116dcc56 Increase efficiency in models/article_spec.rb (#4882) [deploy]
* Add test sampler

* Use let! and let_it_be for article_spec.rb

* Regroup and restructure expectations and tests

* Move private methods in private

* Decrease the needed objects in .seo_boostable test

* Re-use the user

* Newlined
2019-11-26 10:32:39 -05:00
Molly Struve
091392cf1f Remove webpush gem and code (#4883) 2019-11-22 16:46:11 -05:00
Spencer
e5ee2f9013 Mod tooling: add tags via /mod (#4750) [deploy]
* added tests to specs

* added view logic

* added controller/model functionality

* minor tweak to tagadjustment view

* adjusted mod view to reduce query

* added instance variables to controller

* show already adjusted tags in mod view

* removed unnecessary ifs from mods controller

* catch and display errors to tag adjustment forms

* update specs and refactor
2019-11-21 16:32:32 -05:00
rhymes
b0eec90b24 Add additional keys to site configuration (#4861) [deploy]
* Add rate_limit_follow_count_daily to SiteConfig

* Add favicon_url to SiteConfig

* Add logo_svg to SiteConfig

* Add staff_user_id to SiteConfig

* Add default_site_email to SiteConfig

* Add social_networks_handle to SiteConfig

* Add ga_view_id and ga_fetch_rate to SiteConfig

* Add mailchimp newsletters IDs to SiteConfig

* Add periodic_email_digest_max, periodic_email_digest_min to SiteConfig
2019-11-20 10:58:10 -05:00
rhymes
c1aaf53a40 Add SiteConfig to internal and enable "main_social_image" (#4831) [deploy]
* Redirect /internal to /internal/articles avoiding annoying 404

* Set the navbar on two rows

* Add :main_social_image to SiteConfig and to the internal view

* Add simple tests

* Ameliorate the UI
2019-11-18 18:19:20 -05:00
jeffin sam
e92b005d02 Move caching of reaction to rediscache (#4819) 2019-11-15 13:38:46 -05:00
jeffin sam
fbbb02e241 Move bufferized tags to RedisCache (#4817) 2019-11-14 17:37:20 -05:00
Molly Struve
d1b82dfdaf Move cached_followed_tag_names to Redis (#4812)
* Move cached_followed_tag_names to Redis and change key to use following_tags_count rather than updated_at

* use last_followed_at for cache key as well

* format last_followed_at with rfc3339
2019-11-14 09:57:33 -05:00
Michael Kohl
b57ced5466 CacheBuster refactoring (#4766)
* Turn CacheBuster into a module

This class used no internal state, so repeatedly creating short-lived objects seems wasteful.

* Consistently use string interpolation and parenthesis

* Destructure arrays into meaningful names, formatting

* Fix request spec for internal classified listings controller

Interestingly this works when asserting directly on the module, but not on a double.
Asserting directly in the module seems sufficient for this test so the indirection
was removed.

* Turn CacheBuster into a module

This class used no internal state, so repeatedly creating short-lived objects seems wasteful.

* Fix specs after rebasing
2019-11-13 10:51:23 -05:00
Molly Struve
57250ade63
Expire Frequently Updated Cache Keys Sooner (#4793) [deploy] 2019-11-12 13:39:50 -06:00
Andy Zhao
b2e18aeb72 Use Redis for session storage (#4004) [deploy]
* WIP use redis-session-store for sessions

* Use Redis as session storage

* Add redis-server to Travis

* Use integer for SESSION_EXPIRY_SECONDS env variable

Co-Authored-By: rhymes <rhymesete@gmail.com>

* Remove sessions b/c no custom sessions logic

* Use ApplicationConfig instead

* Rename default value

* Remove rememberable module

* Persist the user for the test

* Remove remember_me related tests

* Revert 'undo remember_me' commits

* Add redis to procfile

* Cleanup devise configuration

* Move REDIS configuration in the basic configuration section

* Make sure the expiration time can't zero

* Restore old order and remove useless comment line

* Delete legacy session cookie after login

Once deployed the server will start using the new session cookie, this makes sure the legacy one is deleted on the user's browser

* Remove redis from Procfile

* Add signed, secure and httponly to the Redis session cookie
2019-11-12 10:10:34 -06:00
rhymes
bb28f301e9 Add site config and remove sail (#4729)
* Add SiteConfig model based on rails-settings-cached

* Remove sail
2019-11-08 13:27:44 -05:00
rhymes
40155812bd Comments API: simplify controller code, add tests (#4731) [deploy]
* Use ancestry in the index and add test

* Add tests for show action
2019-11-07 11:37:58 -05:00
Colby Melvin
4531679c23 fix tag input swallowing numeric keycodes [deploy] (#4283)
* fix tag input swallowing numeric keycodes

* add AR validation for Tags class

* allow whitespace in Tag.name

* fix specs

* whitespace

* reformat
2019-11-05 16:20:34 -05:00
Ibrahim Khan
73de48e370 Moved following_users_ids to Redis (#4708) 2019-11-04 17:04:46 -05:00
rhymes
027dbb027b Return 401 instead of 500 when a channel is blocked (#4721) 2019-11-04 10:39:18 -05:00
tariq-abughofa
33a1330033 Move count_for_reactable-* keys to redis (#4695) 2019-11-04 10:11:47 -05:00
tariq-abughofa
267ec36460 Move users' has_trusted_role keys to redis (#4697) [deploy] 2019-11-04 13:12:19 +00:00
Aurelio
c7e0ce0275 move has-pro-membership cache to redis (#4691) 2019-11-02 08:59:15 -04:00
Molly Struve
78f1eb2b11 Move moderator_for_tags Cache Key to Redis (#4690)
* Move moderator_for_tags cache key to Redis

* move delete commands for tag moderator list to Redis as well
2019-11-02 08:57:28 -04:00
Molly Struve
fd11d17973 Remove cacheing for preferred_languages_array (#4689) 2019-11-01 16:15:59 -04:00
Molly Struve
ee99b2e613 Move cached_following_organizations_ids to Redis (#4685) 2019-11-01 14:31:28 -04:00
Molly Struve
760bae49c5 Move cached_following_podcasts_ids to Redis (#4684) 2019-11-01 13:45:00 -04:00
Mohab Abd El-Dayem
2c80e9da42 Make The Default Email An Enviroment Variable. (#4677)
* Make the default email an enviroment variable

* Added spaces in Envfile for readability
2019-11-01 09:03:06 -04:00
Brad Pauly
b59aba415d ArticlesController#feed refactor (#4498)
* Move query details into model.
Reorganize filtering initial results by params.

* Fixups from feedback.
2019-10-30 12:35:53 -04:00
Omar Bahareth
41463a7264 Deduplicate giphy_img? function and add tests (#4590)
* De-duplicate giphy_img? function in favor of a tested service.
Add a tested `GiphyService` and move `giphy_img?` function to it.
Make `labor/markdown_parser.rb` and `models/html_variant.rb` use the service version of the function.

* Refactor GiphyService into Giphy::Image class
Based on comments from @rhymes, I've changed this into a `Giphy::Image` class sincethe repo is currently being moved away from `XYZService` objects for namespacing and organization purposes.

* Fix typo

Update describe case to mention the current method name.
2019-10-30 11:40:17 -04:00
rhymes
36d1df7f49 Routine rubocop lint fixes (#4638) [ci skip] 2019-10-30 10:46:57 -04:00
Ben Halpern
4ea7b03727
Add new font and theme config, plus new navbar config option (#4462)
* Initial changes for some new themes/fonts/etc.

* Add basic navbar config

* Finalize navbar config

* Make config_navbar non nullable

* Add dark_theme? to user decorator
2019-10-24 08:38:46 -04:00
Andy Zhao
73caa9a864 New Feature: Block Users (#4411)
* Prevent need for eager loading

* Add initial implementation of user block

* Remove debugger oops

* Add index and foreign keys for user_block table

* Use private method instead of exists

* Move channel handling logic to service object

* Update styling a bit

* Use profileDropdown file for future proofing

* Remove commented out code

* Render json: { result } for all endpoints

* Add statuses for sad paths

* Add better sad path handling in the JS

* Remove accidentally committed spec file

* Don't wait for DOM to load block button

* Use equality for accuracy in slug query

* Add status code for unauthorized requests

* Add missing comma sigh
2019-10-23 17:14:28 -04:00
Branko Arnaudovski
efbb108061 Implement Moderators audit logs (#3449) 2019-10-23 10:30:45 -04:00
Mac Siri
d976eb7ab6 Create InternalPolicy (#4380)
* Ensure verify_authorized in internal

* Create internal_policy

* Replace ArticlePolicy usage with InternalPolicy

* Replace BufferUpdate&CommentPolicy with InternalPolicy

* Remove verbose authorize_admin

* Forgot to remove coresponding specs

* Create specs for InternalPolicy

* Expand policy access on internal's broadcast

* Refactor

* Create shared spec

* Create request specs

* Add additional test cases
2019-10-17 14:21:43 -04:00
Araslanov Evgeny
02a75b6efa Remove unused methods _without_delay (#4366) [ci skip] 2019-10-16 10:35:49 -04:00
Araslanov Evgeny
7de692156c Add ChatChannels::IndexingJob (#4317) [ci skip] 2019-10-15 16:13:10 -04:00
Ben Halpern
0a60faec8c
Add tag rules to article v2 editor (#4339)
* Add tag rules to article v2 editor

* Add bottom phrase to tag dropdown

* Remove console logs

* Remove empty space in css

* Remove commented code and clean up css

* Add type='button' for a11y
2019-10-10 20:19:12 -04:00
Michael Kohl
fddb06f053 Refactor classified_listings.rb (#4351) [ci skip] 2019-10-10 14:03:11 -04:00
Arun Kumar Mohan
08f397b36b Delete messages without instantiating ActiveRecord objects (#4183) 2019-10-08 17:29:38 -04:00
Mac Siri
56bdf6f846
Create scoped policy for internal/comment (#4311) 2019-10-08 12:33:59 -04:00
rhymes
757b1a8b57 Prepend before_destroy(s) in models with destroy dependents (#4191) 2019-10-02 11:25:24 -04:00
Mac Siri
dd391d5e34
Validates Article's published_at (#4140) 2019-10-01 15:57:36 -04:00