Commit graph

187 commits

Author SHA1 Message Date
Michael Kohl
02f86fedd7
Allow admins to delete users without emails (#6530) [deploy]
* Allow admins to delete users without emails

* Guard against blank email addresses
2020-03-10 22:20:36 +01:00
Vaidehi Joshi
99c87d7a17
Replace WELCOMING_USER_ID with mascot_user_id (#6484) [deploy]
Co-authored-by: Vaidehi Joshi <vaidehi.sj@gmail.com>
Co-authored-by: Julianna Tetreault <32834804+juliannatetreault@users.noreply.github.com>

Co-authored-by: Julianna Tetreault <32834804+juliannatetreault@users.noreply.github.com>
2020-03-09 08:08:53 -07:00
Andy Zhao
478d1b36a5
Hide banished users vomit confirmations and delete vomit reactions on banish (#6507) [deploy]
* Update to hide only banished users

* Refactor and move into a model method

* Delete vomits on banished users

* Add tests for banishing users
2020-03-06 15:35:30 -05:00
Molly Struve
731b89ca26
Index users into elasticsearch (#6489) [deploy] 2020-03-06 14:12:02 -05:00
Molly Struve
039ac2e856
Remove Shipping Fields from Users (#6477) [deploy] 2020-03-05 13:41:09 -05:00
Andy Zhao
a3728cfa4c
[deploy] Add EmailAuthorization model (#6335)
* Add EmailAuthorization model

* Add model file oops

* Add comment for uuid type

Co-authored-by: Ben Halpern <bendhalpern@gmail.com>
2020-03-02 12:14:24 -05:00
Michael Kohl
32e30c8844
Mailchimp resubscribe (#6256)
* Re-subscribe user to newsletter by setting MC status to pending

* Add guard clause and new spec

* Make trait name more explicit

* Fix guard clause and spec
2020-02-27 15:48:38 -05:00
Michael Kohl
ec8ee54559
Delete classified listings when deleting user (#6258) 2020-02-26 14:44:09 -05:00
rhymes
145d5e610e
Use scopes for Follow instead of where all the time (#6149) [deploy] 2020-02-25 19:29:52 -05:00
Gonzalo Ricco
0b03240e5b
Add rescue InvalidURIError in mastodon_url validation (#6174) [deploy] 2020-02-24 19:13:40 -05:00
rhymes
207621f739
Ignore User.organization_id (#6203)
* Ignore User.organization_id

* Fix specs that are still using organization_id
2020-02-21 09:51:49 -05:00
Andy Zhao
acd3b92b32
Add sink user service and specs for mass vomits (#6006)
* Add sink user service and specs for mass vomits

* Use new score calculation

* Lower articles' scores instead and make async

* Add lower score functionality to controllers

* Remove unused variable

* Use correct var and add missing arg

* Remove unused status

* Add composite index for reactable_type and ID

* Use alias instead of additional boolean

* Use medium priority for sink worker

* Log to honeybadger and not logs

* Log the error and not a string
2020-02-17 10:29:50 -05:00
Vaidehi Joshi
f71c8b16e7
Allow dynamic authoring of welcome notifications (#6045) [deploy]
* Add "Welcome" type to Broadcasts, allow dynamic "authoring" of Broadcasts

This adds a new `type_of` to the Broadcast model: "Welcome". As we begin to create a new "welcome notification" workflow, we'll categorize them by making them all of the same type.

This also adds a concept of a "welcoming user", which can be set via an ENV var. The WELCOMING_USER_ID will allow us to explicitly set (and change) which user in the database is the one that "sends" welcoming notification. In production, we plan for this to be dev.to/sloan.

* Allow WelcomeNotificationWorker to accept + send any kind of broadcast

This abstracts out the logic of deciding which broadcast to send from the woker into the calling method. This will help us send many different kinds of welcome notifications using one, resuable worker class.

* Raise if a Notification can't be created

* Add STAFF_USER_ID as an ENV var

This is in preparation for moving away from SiteConfig.staff_user_id, and replacing it with an ENV var. We will need to set this in production first, and then make a separate PR to replace all instances of staff_user_id with the newly-set ENV var.
2020-02-12 13:50:37 -08:00
Maykon Menezes
58b96f104e
create Users::EstimateDefaultLanguageWorker for Sidekiq (#5697) [deploy] 2020-02-07 13:49:02 -05:00
Sebastien
665f5aac0f
Refactor ProfileImage (#5803) 2020-02-07 08:56:16 -05:00
Andy Zhao
be6aaf750c
Add user as reactable (#5893)
* Add user as reactable

* Make title method public

* Use constants for reactable_type and status
2020-02-04 21:25:56 -06:00
rhymes
a1835ae5b9
User counters using PostgreSQL JSON (#5373) [deploy]
Co-authored-by: Ben Halpern <bendhalpern@gmail.com>
2020-02-03 10:35:08 -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
Anna Buianova
01456fe029 [deploy] Finalize deleting user associations (#5624)
* Prepare factories and associations for Users::DeleteActivity specs

* Altered user associations, delete the needed associations in Users::DeleteActivity

* Moved and refined user deletion spec

* Removed useless commented user associations

* Refactored BackupData factory

* Refactored ProfilePin factory

* Refactored Reaction factory

* Fixed specs: Keep default _type in factories or specify it in tests

* Ok, notes shouldn't be deleted on user deletion

* Fixed creating reactable for specs

* Specify commentable/commentable_type explicitly when creating data for tests

* Fixed typo in the comments spec

* Removed unnneeded space

* Added aggregate_failures for testing user associations deletion

* Keep feedback_messages while deleting user activities
2020-01-23 11:29:47 -05:00
Alex
4e5dc015b3 Move Search::IndexJob to Sidekiq (#5620) [deploy] 2020-01-22 08:24:53 -05:00
Michael Kohl
5b35370db8 Introduce BanishedUser table (#5589) [deploy] 2020-01-21 17:15:58 -05:00
Shelley Vohr
b146528aa8 feat: add per-user Open Dyslexic font setting (#5037) [deploy]
* feat: add per-user Open Dyslexic font setting

* Adjust css slightly

Co-authored-by: Ben Halpern <bendhalpern@gmail.com>
2020-01-20 18:23:57 -05:00
Maykon Menezes
ef1eb8d412 Refactor/user bust cache job (#5563)
* Refactor/user bust cache job

* Remove bust cache job old spec
2020-01-20 13:46:15 -05:00
serena
6e9539415e Move welcome notification job to worker for Sidekiq (#5465) [deploy] 2020-01-13 13:28:23 -06:00
Pablo Ifrán
bac4b7fac4 Move Users::ResaveArticlesJob to Sidekiq (#5398)
Change Resave Articles job to worker, and add missing specs on the user
model when changing the trigger attributes
2020-01-10 13:56:39 -06:00
Jenna Pederson
5c9302f5f1 Migrate subscribe to mailchimp newsletter job to sidekiq worker (#5423)
* Start migrating job to sidekiq worker
* Only check for badge jobs queued to sidekiq
2020-01-10 08:43:13 -06:00
Anna Buianova
e09e46ec99 Creating podcasts by users (#3730) [deploy]
* Create podcast as a user [WIP]

* Sample css for podcast form

* Nicer podcasts suggesting form

* Validate podcast feed_url

* Validate podcast main_color_hex

* Fix podcasts specs

* Fix form appearance

* Placeholder for podcast main_color_hex

* Provide a link to suggest a podcast

* Add a checkbox and a role for when a podcast is added by an owner

* Prettier checkbox in the podcasts form

* Added creator to podcasts

* Set the podcast creator

* Fix the /pod spec

* Added creator information to the internal podcast page

* Added cta class to the podcasts submit button

* Global notice when a podcast was suggested

Co-authored-by: Ben Halpern <bendhalpern@gmail.com>
2020-01-08 16:14:25 -05:00
Michael Kohl
728a05c476 Move from env variables to SiteConfig (#5385) [deploy]
* Move from env variables to SiteConfig

Related to #5384

This PR only deals with the first remaining part outlined in the issue, starting to use existing SiteConfig keys instead of the env variables.

* Restore Envfile to original version for now
2020-01-07 16:36:24 -05:00
Lud
df042d6b0b Refactors ActiveJob to SidekiqWorker: Follows::SendEmailNotificationWorker (#5322) [deploy]
* Refactors ActiveJob to SidekiqWorker: Follows::SendEmailNotificationWorker
* improves naming of User#receives_follower_email_notifications?
* adjust expect count for spec SendEmailNotificationWorker
2020-01-02 13:35:09 -05:00
Ben Halpern
a716cf2756
Create UX Customization tab in settings (#5307) [deploy]
* Create UX Customization tab in settings

* Add variable import

* Change from UX Customization to just UX
2019-12-31 09:35:15 -05:00
rhymes
09e5ad5c0c Remove PushNotificationSubscription (#5258) [deploy] 2019-12-27 13:45:38 -06:00
Abner Soares Alves Junior
536c62da89 Refactor all has_enough_credits to enough_credits (#5119) 2019-12-16 15:00:59 -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
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
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
Ibrahim Khan
73de48e370 Moved following_users_ids to Redis (#4708) 2019-11-04 17:04:46 -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
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
Araslanov Evgeny
02a75b6efa Remove unused methods _without_delay (#4366) [ci skip] 2019-10-16 10:35:49 -04:00