Commit graph

616 commits

Author SHA1 Message Date
Michael Kohl
8f5cfa2c0f
Drop profile columns from user (#10707)
* Prepare to drop profile columns from user

* Update code and factory

* Also remove unused constant

* Move validation from user to profile

* Remove Profiles::ExtractData service object

* Add more comments

* Simplify sameAs attribute generation

* Obey me machine, I am your master

* Fix condition order in guard clause

* Temporarily disable callback

* Fix specs

* Reduce usage of Profile#refresh_attributes!

* Remove leftover comment

* Handle social media links differently

* More spec fixes

* Fix specs for admin profile fields controller

* Fix specs after merge

* Fix remaining specs

* Update user show request spec

* Add comment for follow_hiring_tag

* Only save profile when user is valid

* Fix seeds.rb for profile fields

* Switch from before_save to after_save

* Undo unrelated formattin change

* Update spec/fixtures/files/profile_fields.csv

Co-authored-by: Molly Struve <mollylbs@gmail.com>

* Remove data update script and spec

* Fix spec

* Fix typo in comment

* Fix typo in comment

* Move article resave logic to service object

* Move profile field creation to before(:suite)

* Refactor error handling in Profiles::Update

* Fix Profiles::Update specs and refactor

* Temporarily disable spec

* Add ProfileValidator

* Clean up

* Move DB ready check into app/lib

* Refresh attributes after importing from CSV

* Fix specs

* Remove unused file

* A girl has no name. A profile neither.

* Fix specs

* Add responds_to? check

* Spec fix

* Add name to user fields in profile settings page

Co-authored-by: Molly Struve <mollylbs@gmail.com>
2020-12-03 08:14:38 +07:00
Fernando Valverde
b02262c563
Split ReCaptcha service and use verbs instead of pronouns (#11706)
* Split ReCaptcha service and use verbs instead of pronouns

* Inline comment rewrite for clarify

* after? > >

* Use explicit role check for the user instead of .auditable?
2020-12-02 16:50:42 -06:00
Alex
7ee8523ba3
Refactor EdgeCache (#11684)
* Refactor EdgeCache

* Update specs

* Add bust comment spec

* Fix more specs

* Use const_get

* Make methods private

* Add .discussion? decorator to Article

* Change variable name to article for clarity
2020-12-02 14:20:22 -05:00
Fernando Valverde
494af84e83
Refactor reCaptcha code and bypass in report abuse for trustworthy users only (#10502)
* Bypass recaptcha for authenticated users abuse reports

* Moves bypass_recaptcha? to helper method to have one definition of the criteria for this

* User must be 1 month old at least in order to bypass_recaptcha?

* Fixes test

* Better spec message

* Bypasses auditable users

* Adds better test coverage over recaptcha bypass cases

* include Helper removed from FeedbackMessagesController

* Adds some inline comments for clarity and banned check
2020-12-02 08:55:47 -06:00
Michael Kohl
c5a29826e8
Move app/labor/error_message_cleaner.rb to service (#11679) 2020-12-02 11:05:36 +07:00
Michael Kohl
195e228307
Move GeneratedImage to Images::GenerateSocialmage (#11691) 2020-12-02 11:03:14 +07:00
Michael Kohl
5185de4c91
Move app/labor/follow_checker.rb to service (#11613)
* Move app/labor/follow_checker.rb to service

* Move to Follows:: namespace
2020-12-01 14:14:36 +07:00
Michael Kohl
06fd95f93f
Move LogWorkerQueueStats from labor to services (#11642) 2020-11-30 09:31:15 +07:00
Michael Kohl
1ce8a762b7
Move HtmlCleaner from app/labor into service (#11609)
* Move HtmlCleaner from app/labor into service

* Move to Feeds:: namespace
2020-11-27 08:21:57 +07:00
Michael Kohl
82108ea8b5
Remove app/labor/random_gif.rb (#11611) 2020-11-25 14:58:32 +00: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
Molly Struve
dc7d9d5843
Refactor/Optimization:Use more_comments_minimal_weight_randomized_at_end for Signed In Feed (#11604) 2020-11-24 15:36:55 -06:00
rhymes
1741e52e83
Add missing features to new feed importer (#11501)
* Add explanatory comment to how RssReaderFetchUserWorker works

* Add Feeds::ImportWorker worker

* Enable Feeds::Import for single user feed fetching behind a feature flag

* Add Feeds::ValidateUrl service

* Add feature flag to user's validate feed URL feature

* Remove todo notices

* Add feature flag to fetch_all_rss task

* Add feature flag to RssReaderWorker

* Bring back short-circuit for Articles::RssReaderWorker
2020-11-24 18:11:13 +01:00
Mac Siri
c4fdeeb944
Make Images::Optimizer nil-safe (#11584) 2020-11-24 09:39:34 -05:00
Molly Struve
abbc29dafe
Bug Fix:User >= when filtering by SiteConfig.home_feed_minimum_score (#11567) 2020-11-23 09:13:03 -06:00
Andy Zhao
827c9aa77c
Fix Facebook Login profile image download failure (#11478)
* Send a new request and use link in response for profile img

* Use fallback option and make method private

* Refactor and use constant template string

* Stub image_url method for tests

* Fix tests and mock response object properly

* Fix tests and mock response object properly

* Stub response for tests

* Refactor a bit and move into helper method

* Undo everything I did. today I will watch facebook burn.

* Use more foolproof string to gsub
2020-11-19 16:18:09 -05:00
Jacob Herrington
77a35b378f
Fix seed values for ProfileFields (#11481)
These were all defaulting to "left_sidebar" which interfered with my
work some and doesn't really reflect how these will probably be used.
2020-11-19 09:13:49 -06:00
Molly Struve
fd8f83dc7d
Feature:Backend Username Search Endpoint for Mention Completion (#11479)
* Feature:Backend Username Search Endpoint for Mention Completion

* ensure user is authenticated to use usernames endpoint

* update spec with authaa
2020-11-18 16:43:59 -06:00
rhymes
cbc461a850
Refactor RssReader and Feeds::Import common parts: take 1 (#11412)
* Extract Feeds::CheckMediumReplyItem service

* Extract Feeds::CheckItemPreviouslyImported

* Clarified comment on Feeds::CheckItemMediumReply (thanks @maestromac)

* Refactor a bit to be more Rubeyeyey
2020-11-18 14:17:53 +01:00
Molly Struve
cf619caf70
Refactor: Remove more_tag_weight_more_random_experiment (#11447) 2020-11-16 15:48:45 -06:00
rhymes
910f79e04e
Remove wrong datadog metric in Feeds::Import (#11405) 2020-11-13 16:11:02 -05:00
Jacob Herrington
94fe355dae
Add system spec for profile fields (#11398)
* Add system spec for profile fields

* Use FeatureFlag wrapper over Flipper
2020-11-13 14:51:42 -06:00
Alex
99c3fb276d
Auto generate mascot accounts (#11380)
* Auto generate mascot accounts

* Refactor to remove extra query

* Update registration specs

* Fix search query spec

* Fix reaction specs

* Create with bang and raise error
2020-11-12 16:33:16 -05:00
Molly Struve
40ecfd6f0f
Refactor:Replace Production Check with Average Metrics (#11096) 2020-11-12 10:03:10 -06:00
rhymes
1bb53651b0
Replace calls to Flipper with FeatureFlag (#11386) 2020-11-12 14:15:33 +01:00
Michael Kohl
b46323d0b2
Move ArticleSuggester to Articles::Suggest service (#11370) 2020-11-11 13:06:33 -05:00
Molly Struve
a0c174fcb7
Refactor:Remove more_experience_level_weight_experiment From Feed Tests (#11340) 2020-11-09 13:59:59 -06:00
rhymes
1db388510e
Add custom instrumentation to Feeds::Import (#11297)
* Add custom instrumentation to Feeds::Import

* Remove superfluous logging instructions
2020-11-09 17:12:01 +01:00
Michael Kohl
d64943958d
Prepare for profile column drop (#11246)
* Add new display area for settings only fields

* Update CSV importer

* Prepare for dropping profile columns from user

* Update spec

* Don't migrate nil values

* Update spec

* Update forem:setup task
2020-11-09 10:17:39 +07:00
Vaidehi Joshi
97d5bc47b6
Use OPENRESTY_URL over protocol + domain (#11289)
* Use OPENRESTY_URL over protocol + domain

* Prefer OpenResty over Openresty
2020-11-06 08:58:59 -08:00
rhymes
47624ddfcd
Add users param to Feeds::Import (#11234)
* Add users param to Feeds::Import

* Fix init and specs

* Replace explicit nil check

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

Co-authored-by: Michael Kohl <me@citizen428.net>
2020-11-03 07:02:17 -06:00
rhymes
51a4a35448
Add Feeds::Import service class (#10998)
* Add the parallel gem

* Add prototype version of Feeds::Import with parallel URL fetching and parsing

* Tune Feeds::Import and add rake task for local tests

* Add rough measurer tool

* Add specs

* Apply suggestions by @citizen428

* Replace silence with silent

* No need for eager loading

* Add temporary Articles::DevFeedsImportWorker

* Remove temporary rake task

* Add basic error handling, copied from RssReader

* Fix error handling

* Remove temporary measuring rake task

* Remove logging added for development purposes

* Add info and error logging on error level
2020-10-30 15:01:44 +01:00
Molly Struve
ea156a201d
[deploy] Optimization:Remove more_tag_weight_experiment From Feed Tests (#11089) 2020-10-27 16:36:53 -05:00
Molly Struve
9af35bed0a
[deploy] Optimization:Limit Tags Searched For Follow Suggestions (#11095) 2020-10-27 11:58:54 -05:00
Andy Zhao
b80dae1436
Update data exporter to handle admin send (#10274)
* Update data exporter to handle admin send

* Match button with everything else

* Use proper redirect path

* Stub SiteConfig definition instead of setting it

Co-authored-by: Mac Siri <krairit.siri@gmail.com>

* Removed if statement by accident oops

* Remove non-functional boolean param and pass email directly

* Use refinement to conv to boolean instead of JSON.parse

* Rename to StringToBoolean

* Use 'using' in proper scope (not in method)

* Rename to_bool to to_boolean

* Refactor if statement, thanks rhymes!

* Fix small bugs in tests

* Remove tracking for export_email b/c no @user

Co-authored-by: Mac Siri <krairit.siri@gmail.com>
2020-10-26 18:00:56 -04:00
Mac Siri
c817737748
Expand cropping options for Imgproxy (#11044) 2020-10-26 14:25:21 -04:00
Molly Struve
f54549cca3
[deploy] Optimization:Remove 2 Feed Experiments (#11007) 2020-10-22 11:22:00 -05:00
Michael Kohl
87c89d8915
Make profile fields without user columns work (#10978) 2020-10-21 08:17:35 -04:00
benhalpern
3126e508f7 Make basic posts query rely on SitConfig value 2020-10-21 08:11:54 -04:00
Michael Kohl
9377eee4f5
[deploy] /profile/settings page rendering (Ridhwana/Michael) (#10733)
* chore: update the profile to be more dynamic. Maps out the group + field name   + value for field

* feat: add the correct input type to the form tying it to the correct method to update

* feat: update the value and the label

* feat: update the profile with a submit

* refactor: ensure we dont show empty groups on the settings/profile

* fix: this shoudl be dribbble

* fix: use attributes! to refresh the cache to ensure that we font run into the case where Profile.attributes is []

* feat: show group description only when it exists

* chore: add some classes

* feat: use the profile update service to update the relevant user information

* chore: rename variable

* chore: use a scope to not return empty groups

* fix: only update user if the profile sync is update is successful. Also capture errors

* feat: style the crayons field checkbox

* refactor: rename the attribute to user instead of profile

* refactor: service object

* Fix CodeClimate warning and rearrange code

* Fix service object, add missing attribute

* Fix flash and add redirect

* Fix service object + spec

* Fix user edits profile spec

* Disable spec

* Fix more specs

* Undo vim fail

* Add data update scripts

* Update where clause in data update script

* Rename method

* Make sync_to_user conditional

* Add after update actions and Honeycomb

* feat: handle checkbox allow chcekbox to check

* Don't set experience cookie in ProfilesController

* Clean up Profiles::Update object

* Fix spec

* Remove Twitch integration (#10732)

* Remove Twitch integration

* Ignore columns

* Change admin password in docs (#10735)

Update default admin password in documentation

* Do not require meta_keywords to be set (#10721)

* Remove extra character from meta_keywords in /listings/index.html.erb

* Remove meta_keywords from MANDATORY_CONFIGS

* Add and use meta_keywords_tag helper

* Use modern tag syntax instead of deprecated syntax

* Add and use meta_keywords_default helper

* Add and use meta_keywords_article helper

* Remove * from meta_keywords_field.label

* Update meta_keyword specs to account for no keywords being set

* Generalizes Connect welcome message and settings nav tab and refactors tests (#10741) [deploy]

* [deploy] fix: Clear chat input after Enter key submit (#10487)

* fix: Clear chat input after Enter key submit

* fix: Rename Composer component

* test: Add integration tests for input value

* After pressing Enter
* After clicking Send
* After clicking Save edit
* After clicking Close edit

* Remove tabindex of -1 on upload image input in the write a post editor (#10543)

* Remove tabindex of -1 on upload image input in the write a post editor

* Remove negative tabindex on image uploader's outer button

* Give tabindex of -1 to outer button on image uploader

* Update buttons.scss

* [deploy] Add recaptcha keys to as site-configurable keys (#10736)

* Add recaptcha keys to as site-configurable keys

* Add recaptcha to site config view

* Use site config key

* Make ReCAPTCHA tag optional if keys are blank

* Use proper capitalization of recaptcha

Co-authored-by: Julianna Tetreault <32834804+juliannatetreault@users.noreply.github.com>

* Refactor logic for readability

* Use proper capitalization of recaptcha

Co-authored-by: Julianna Tetreault <32834804+juliannatetreault@users.noreply.github.com>

* Use proper capitalization of recaptcha

Co-authored-by: Julianna Tetreault <32834804+juliannatetreault@users.noreply.github.com>

* Use proper capitalization of recaptcha

Co-authored-by: Julianna Tetreault <32834804+juliannatetreault@users.noreply.github.com>

Co-authored-by: Julianna Tetreault <32834804+juliannatetreault@users.noreply.github.com>

* Add Section for Series/Collections (#10719)

* Add Section for Series/Collections

I added a small section in this area of the docs to share some information about collections/ series. 

There is not much information in the documentation about collections or series and I felt like this would be beneficial to others looking to help with the Series feature of the website.

* Updated wording of collections section.

* Articles API: filtering by tags (#3654) (#10614)

* Articles API: filtering by tags (#3654)

* Address CR comments (#3654)

* Add test case
* Move tests
* Update docs

* Use _any_ option for querying by tags (#3654)

* Move Imgproxy endpoint config to Images::Optimizer (#10742)

* Link Email Account creation UI to existing Create Account UI (#10746) [deploy]

* Conditional button to link to email accout creation

* Rename email signup state param

* Test for email account creation button scenarios

* Add forem meta tags (#10747)

* Add forem meta tags

* Add docs

* Update docs/technical-overview/compatibility.md

Co-authored-by: Jacob Herrington <jacobherringtondeveloper@gmail.com>

* Update docs/technical-overview/compatibility.md

Co-authored-by: Jacob Herrington <jacobherringtondeveloper@gmail.com>

* Update docs/technical-overview/compatibility.md

Co-authored-by: Jacob Herrington <jacobherringtondeveloper@gmail.com>

* Update docs/technical-overview/compatibility.md

Co-authored-by: Jacob Herrington <jacobherringtondeveloper@gmail.com>

* Remove Twitch-related columns from users table (#10750)

* [deploy] Long text goes outside cards (#10740)

* Add word-break to crayons-card

Add word-break to crayons-card this will allow words to be broken if the word is too long but will wrap normally otherwise.

* Use overflow-wrap: anywhere;

`break-word` is deprecated though `anywhere` does not work in IE

* Removes superfluous sign_in from users_onboarding_spec.rb (#10757) [deploy]

* [deploy] Allow glitch id starting with ~ (#10544)

* [deploy] crayons prep (#10737)

* Add DEV special case for following hiring tag

* Move image validation to Profiles::Update object

* spec: move over the tests for validating images

* Move follow_hiring_tag into the service object

Co-authored-by: Ridhwana <ridhwana.khan16@gmail.com>
Co-authored-by: Andrew Bone <AndrewB05@gmail.com>
Co-authored-by: Vaidehi Joshi <vaidehi.sj@gmail.com>
Co-authored-by: Julianna Tetreault <32834804+juliannatetreault@users.noreply.github.com>
Co-authored-by: Robin Gagnon <me@reobin.dev>
Co-authored-by: Manaswini <58681405+Manaswini1832@users.noreply.github.com>
Co-authored-by: Andy Zhao <17884966+Zhao-Andy@users.noreply.github.com>
Co-authored-by: Christopher Wray <53663762+cwray-tech@users.noreply.github.com>
Co-authored-by: Rafal Trojanowski <rt.trojanowski@gmail.com>
Co-authored-by: Mac Siri <mac@dev.to>
Co-authored-by: Josh Puetz <josh@dev.to>
Co-authored-by: Ben Halpern <bendhalpern@gmail.com>
Co-authored-by: Jacob Herrington <jacobherringtondeveloper@gmail.com>
Co-authored-by: irmela <irmela@berlin-coding.de>
Co-authored-by: ludwiczakpawel <ludwiczakpawel@gmail.com>
2020-10-20 09:18:13 -04:00
Mac Siri
ef6c3838d4
Ignore relative url in Images::Optimizer (#10925)
* Ignore relative url in Images::Optimizer

* Add spec

* Create DUS
2020-10-19 16:50:43 -04:00
Mac Siri
c45080c737
[deploy] Account for missing feed_url in RssReader (#10844) 2020-10-16 14:29:35 -04:00
Mac Siri
30fa3b79a3
Default to Imgproxy on Forem-cloud (#10819) 2020-10-14 12:54:59 -04:00
Jacob Herrington
c37b283865
Allow Forem admins to enable an invite only mode. (#10758)
* Add invite only mode field to SiteConfig

* Add UI elements for invite only mode
2020-10-12 11:27:22 -04:00
Michael Kohl
f95acef2bc
Profile generalization tidbits (#10631)
* Load all profile fields on app start

This time without breaking bin/setup (hopefully)

* A SiteConfig.dev_to? for special case logic

* Update BanishUser#remove_profile_info

* Continue clearing data from users table for now

* Add specs for SiteConfig#dev.to?

* Use correct attribute list

* Update spec/models/site_config_spec.rb

Co-authored-by: Michael Currin <18750745+MichaelCurrin@users.noreply.github.com>

Co-authored-by: Michael Currin <18750745+MichaelCurrin@users.noreply.github.com>
2020-10-12 10:01:27 +07:00
Mac Siri
e7c1b3e993
Move Imgproxy endpoint config to Images::Optimizer (#10742) 2020-10-09 10:50:30 -04:00
Rafal Trojanowski
2a488a19f8
Articles API: filtering by tags (#3654) (#10614)
* Articles API: filtering by tags (#3654)

* Address CR comments (#3654)

* Add test case
* Move tests
* Update docs

* Use _any_ option for querying by tags (#3654)
2020-10-09 12:49:34 +02:00
Michael Kohl
a2b55f889c
Remove Twitch integration (#10732)
* Remove Twitch integration

* Ignore columns
2020-10-08 12:44:10 +00:00
Ben Halpern
36b1edb3e2
[deploy] Ensure podcast episodes are created with processed_html (#10715) 2020-10-07 12:09:36 -04:00
Ben Halpern
0ed408a409
Fix feed order for basic (#10717)
* Fix feed order for basic

* Fix spec
2020-10-07 11:26:32 -04:00