* Remove dead code associated with old roles
* Remove test references
* Removed from seeds
* Removed unused roles from locales
---------
Co-authored-by: lightalloy <lightallloy@gmail.com>
* feat: remove the top card color branding
* feat: update the heading
* feat: remove the rotation on the badge
* feat: remove rotation and justify-between the badge
* feat: add number_with_delimiter to the tag count
* feat: change the follow button to be 'primary'
* feat: add a flex column so that the buttons row sticks to the card bottom
* feat: add the posts to the right hand side on the header
* refactor: move the styles to teh css page
* feat: spacing
* fix: tests
* fix: test
* Exclude Page from ReservedWords checks (#19853)
* move initializeSettings to webpack (#19737)
* move initializeSettings to webpack + add tests
* add initializeSettings to InstantClick change block
* dont use classes, use modules
---------
Co-authored-by: PJ <pj@forem.com>
* Renamed leftover @hero_display_ad => @hero_billboard (#19874)
* Reorganize devDependencies & revert strong_migrations (#19870)
* ruby: Upgrade to v3.1.4 (pt. 1, base image only) (#19871)
In #19776 we discovered that basing both the base container *and* the
app container off of `.ruby-version` causes a chicken-and-egg problem
wherein upgrading Ruby versions requires a few stop-and-gos. Let's make
those stops reviewable as separate chunks instead: use a new
`.ruby-version-next` for building base images, not the `.ruby-version`,
thus allowing GitHub Actions to fire off an automated build (which, when
complete, we can take the SHA sum from and use it to open a second PR
updating the app image to use it, and `.ruby-version` can be updated to
match `.ruby-version-next`).
* feat: add the bullet unused_eager_loading query
* feta: update the seeds
* feat: add a smaller gap and make the grid-col 4 on large screens
* feat: do not let the button take the height of the container
* sway the search with the following tags
* feat: keep the description at font size 14px
* tweak elements to ensure an ideal card height of 195px
---------
Co-authored-by: Mac Siri <mac@forem.com>
Co-authored-by: zhangted <tedcbook@gmail.com>
Co-authored-by: PJ <pj@forem.com>
Co-authored-by: Anna Buianova <lightallloy@gmail.com>
Co-authored-by: Josh Klar <jklar@forem.com>
Co-authored-by: Duke Greene <dukegreene@gmail.com>
* Removed code related to tracking html_variants
* Remove code related to HtmlVariant#find_for_test
* Remove spec for HtmlVariant#success_rate
* Ignore html_variants.success_rate
* Drop tables related to HtmlVariant tracking
* feat: remove initializeSponsorshipVisibility and related code
* feat: remove sponsorships from sidebar
* feat: remove sponsorships from the admin - route, controller, view, spec
* feat: remove the admin menu item
* feat: remove the i8n for admin sponsors controller
* feat: sponsorship decorator was not being used anywhere
* feat: sponsorship slack messenger was not being used anywhere
* feat: remove the sponsorship_headline that gets configures on the admin
* feat: remove the /sponsors page
* feat: remove renedring of single_sponsor partial and associated partials
* feat: remove the navigation link rake task for sponsors
* feat: remove sponsorship from tags
* feat: remove i8n constants used
* remove sponsor references in text to the privacy page
* feat: remove the sponsorship detail from the organization page
* feat: remove the sponsors css that was used for app/views/pages/sponsors.html.erb
* feat: remove the sponsorship i8n that was used in the slack messengers
* feat: swap out the decorators to use Article as an example
* feat: remove spec to show sponsors on home page
* feat: update the specs to use Article Decorator instead of the Sponsorship Decorator
* fix: use direct and not all
* fix: remove tests for tag sponsorship
* fix: remove organization sponsorship test
* feat: remove more i8n
* remove unused css from app/views/organizations/_sidebar_additional.html.erb
* feat: remove sponsorship relationship from tag and organization
* remove seed
* feat: remove all Sponsor related specs
* feat: remove model, associated i8n and specs
* feat: remove sponsor from navbar
* feat: add a guard clause if we're unable to constantinize the purchase_type
* feat; remove sponsorship related tests
* feat: remove sponsorship relationship
* feat: remov especs related to sponsorship
* feat: remove tag sponsorship validation
* feat: remove the sponsorship factory
* Convert symbol hash keys to strings when calling .perform_async
Fixes a warning from Sidekiq 6.4.0+ about perform_async arguments
which are not equal when passed to perform (`JSON.parse(JSON.dump(arg))`
should equal arg).
This is a safety measure to prevent passing objects (like classes, or
model instances) rather than their representations (like a class name,
or a model's attributes hash).
This warning will be an error in sidekiq 7
* Turn warning into an error in non-production environments
* Use string keys for reaction notification and article fetched
Missed these two on the first pass
* Update example argument hashes for #enqueues_on_correct_queue
Since this calls perform_async under the hood we need to pass json
safe hashes in the test cases as well.
https://github.com/forem/forem/blob/main/spec/workers/shared_examples/enqueues_on_correct_queue.rb
* Convert keys from FollowData#to_h to string before perform_async
I'm not sure enough where else (outside of notification) to_h is being
called, so I'm converting here when building args, rather than in
FollowData#to_h, which might be my next step.
* Let FollowData#to_h return a hash with string keys
Update spec to use string keys as well.
* Make to_h return string keys for ReactionData
Like FollowData, the #to_h method is only used to call
notifications (this is used to enqueue sidekiq jobs).
* Remove a key that was in the hash
Since reaction_data calls to_h, it gets string and not symbol,
keys. Call Hash#except with a key that was actually there.
This change restores setting usernames to something less obnoxious.
Prior to this commit, I would on occassion get the following error in
seeds:
```shell
❯ bin/rails db:seed
Seeding with multiplication factor: 1
1. Creating Organizations.
2. Creating 10 Users.
rake aborted!
ActiveRecord::RecordInvalid: Validation failed: Username is too long (maximum is 30 characters)
./forem/db/seeds.rb:67:in `block (2 levels) in <main>'
./forem/db/seeds.rb:60:in `times'
./forem/db/seeds.rb:60:in `block in <main>'
./forem/app/lib/seeder.rb:30:in `create_if_none'
./forem/db/seeds.rb:57:in `<main>'
<internal:~/.rbenv/versions/3.0.2/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
<internal:~/.rbenv/versions/3.0.2/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
-e:1:in `<main>'
Tasks: TOP => db:seed
(See full trace by running task with --trace)
```
Related to work done in #16067
Prior to this commit, we were somewhat naively rendering Hash style data
attributes in our ERB templates. By rendering each hash attribute
separately, we were rendering characters that could break the
javascript (e.g. double hack or backslash `"` or `\`).
By moving to this view_object rendering, we leverage Rails's `to_json`
behavior to ensure properly escaped values. As part of this exercise, I
generalized the method to allow for other places to benefit from this
behavior.
This generalization also helps ensure that we have a more conformant
rendering (e.g. we should always have an :id, :className, and :name
value in our data-info hash).
_Note: I've updated the user's names for Cypress tests as they are more
likely to catch the particular issue than anything else. I assume that
I'm going to break some cypress tests and will need some help fixing
them._
Closes#15916, #14704
Supersedes #15983
How to test locally:
Assuming you have seeded database (e.g. `rails db:seed`), checkout the
"main" branch. Then in `rails console` find a user that's written articles:
```ruby
user = Article.last.user
user.update(name: "\\: #{user.name}")
user.articles.each(&:save)
```
Now, again on the "main" branch, start your application (e.g.,
`bin/startup`).
Then get a logged in and a logged out browser session going. Open your
web inspector and open console. Then go to the local instances homepage
(e.g., http://localhost:3000) and look for JS errors.
On the main branch, you should see an exception around
`JSON.parse(button.data.info)` (assuming that the `user`'s article is
rendered on the homepage).
Then go to the user's page (e.g. https://localhost:3000/:user-slug) and
look for JS parse errors.
On this PR's branch (e.g.,
`jeremyf/take-two-at-resolving-gh-15916`)
you shouldn't see those console errors.
More importantly, the Follow buttons should work.
* Generator output
Add your logic here!
* replicate the logic from the forem connect migration
* Add data update script
This will generate the expected broadcast message to fix#16059
* Add apple connect to seeds file
* Remove Connect
* Remove more Connect specs
* Remove a lot more Connect code
* 🚮
* It all has to go
* Explicitly add httpclient
* Update application layout
* Remove messages association from User
* Start fixing specs
* reintroduce util function and refactor references
* Remove Connect Cypress test
* Fix more specs
* Remove Connect from listings
* Ignore contact_via_connect column on listings
* Remove contact_via_connect usages
* Ignore mod_chat_channel_id on tags
* Drop Connect tables
* Remove email_connect_messages from user notification settings
* Re-add httpclient 2.8.3
This was mistakenly removed as a merge conflict
* Don't need to exclude removed chat channel file
* Remove unneeded style for chat channels
* Remove unneeded channel list prop type
* Remove chat channels index/connect-link from getPageEntries
* Re-add comment from httpclient in Gemfile
* Remove connect references from mailers
Tag Moderators no longer have a chat channel
No longer will users be notified about new messages (there won't be
any)
No longer will users be notified about channel invites (you can't
invite anyone anymore)
* Don't configure Pusher and remove PUSHER_* from .env_sample
since it's removed from gemfile, the Pusher constant will not resolve, if this is
configured in the environment variables we'll fail to boot.
Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
Co-authored-by: Dan Uber <dan@forem.com>
* Add one reaction to each article when seeding the database
* Add reaction to article when created
and sync reactions count.
There's still a gap where the redis-cached reaction count could be
present but not cleared during seeder runs (redis is disconnected for
caching and rails cache is set to the null store). Since we are able
to enqueue sidekiq jobs redis is live - but it's a bad idea to use
sidekiq's connection to flush keys in redis.
* Make the reaction count update script a no-op
* Remove unused data update script and limit user id queries
Pull all user ids into an array before you start creating articles,
and sample from the array rather than repeatedly asking for the first
user from a random ordered db result.
* fail if we can't create reaction
thanks @jgaskins
Co-authored-by: Jamie Gaskins <jamie@forem.com>
* Revert "fail if we can't create reaction"
This reverts commit c35f6d47d2e8956a240133b9e6ad0d144f1b4722.
There is a uniqueness constraint on (user, reactable, category) that
could be triggered when seeding due to random selection. It's better
to skip creation when a validation error occurs than to break the seed
completely.
There are expected to be 0-9 reactions per article, we don't require a
set number on each article, and likely won't notice any specific
problem if the random number is one lower than it would have been
because some reactions were skipped due to uniqueness violations.
Co-authored-by: Jamie Gaskins <jamie@forem.com>
* Fix and clean up podcast pages
* Adjust tests
* Fix a test
* Fix missing i18n
* Fix tests
* Fix tests
* Fiddle with test
* Sure up css and tests
* Add featured as allowed param
* Fix a couple tests
* xit out test
* Update app/views/podcast_episodes/index.html.erb
* Update app/views/podcast_episodes/index.html.erb
Co-authored-by: ludwiczakpawel <ludwiczakpawel@gmail.com>
Co-authored-by: ludwiczakpawel <ludwiczakpawel@gmail.com>
* When calling Faker::Markdown, avoid "sandwich" method
Since random can also be selected by random (without the exclude
list), avoid calling sandwich occassionally from random's call to
random.
This avoids generating body_markdown exceeding 12 newlines (which is
validated in Listing and prevents save, breaking the seeds process).
* just take 10 lines, don't be clever
Co-authored-by: Jamie Gaskins <jamie@forem.com>
Co-authored-by: Jamie Gaskins <jamie@forem.com>
* schema file undelete description
* feat: v1 of the script
* Flesh out remaining enums under their categories
* complete UsersSettings data update script
* complete DUS for relevant attributes in users and profiles tables
* complete DUS for users_notification_settings
* alphabetize user_settings sql file
* safeguard against null values for "null: false" settings
* Set up actual UsersSettings DUS and specs files
* fix broken DUS script
* complete specs for UsersSetting DUS
* Address QA of specs
* complete specs for users_notification_settings DUS
* fix the typos (thanks Julianna!)
* begin implementation
* still building
* add missing attribute "email_membership_newsletter"
* complete sync code (except race condition for user profile)
* complete implementation, remains tests
* Address PR review and fix Travis fails
* remove superfluous Profile.new
* fix travis fails
* feat: update the users_notification_setting attributes from the user model
* feat: use the config fonts enums to display the fonts
* feat: loop through the keys
* fix profile = nil blowing up; add specs for notification_setting model
* remove unneeded spec
* remove feed validation until after sync code removed; fixes feed_import spec failures
* remove spec associated with feed_url validation in user_setting model
* fix failing spec 😅
* add TODO
* feat: set the user settings in the user controller and use it in the customization form
* feat: move some update logic to the users settings controller thats being used from customization
* feat: show the updated values form the users_settingd and not the user instance
* Generalize redirect back to current tab
* still trying to reflect changed theme upon refresh
* customizations take effect on refresh
* remove 'with_feed' scope from user model
Co-authored-by: Jamie Gaskins <jamie@forem.com>
* start with takeover for fields previously in profiles table
* Takeover code for `publishing_from_rss` section in Settings (#13914)
* implement takeover code part 1
* implement takeover code
* fix feed fetch
* need rhymes help
* complete implementation; specs pending
* fix STUPID omission that caused so many headaches 😫
* implement profile fields pointing to users_settings 🎉
* run migrations
* implement inbox type & guidelines takeover code; specs pending (#13911)
* Point changes in notification settings to `users_notification_settings` table (#13910)
* implement takeover code; remains specs
* address PR feedback; remove related sync code
* address PR review feedback
* need help with routing and specs
* address pr review
* addressing pr review
* Treat implementation edge cases and omissions 😅
* fix uncommented comment
* fixing implementation cases
* address more PR review feedback
* fixing notifications use-cases
* refactor settings controller
* more pr review changes
* solving bugs
* fix broken onboarding
* handle eperience_level calls
* more fixes
* remove unneeded mappings
* add To-dos for quety updates
* remove done TODO
* purge done TODOs
* update notification_settings-related queries
* start fixing specs
* fixing specs
* fix notification and lrg_forem specs
* fixing broken specs
* still fixing
* fix line dif and remove reloads from user.rb
* run specs
* silence bullet and other fixes
* remove setting migration scripts and specs, fix more settings for specs
* handle missing user for article builder and fix notification specs
* fix some final controller specs and re-add incorrectly removed specs
* remove deprecated data update scripts and related workers, put travis back
* refactor admin tags mods controller, write/move specs for users notifications settings controller
* schema cleanup and other small refactors for consistency
* set field we can invalidate in spec via active record instead of at the db level
* remove I think an uneccessary hook call from subscribe_to_mailchimp_newsletter
* use bnefore_create to setup settings, please dont blow up the test suite
* mailchimp bot fix
* remove decorator in favor of single model method
Co-authored-by: Arit Amana <msarit@gmail.com>
Co-authored-by: Ridhwana <ridhwana.khan16@gmail.com>
Co-authored-by: Arit Amana <32520970+msarit@users.noreply.github.com>
Co-authored-by: Jamie Gaskins <jamie@forem.com>
* Rename SiteConfig
* More renaming
* Update spec
* Update mandatory settings mapping
* More renaming
* e2e test fixes
* You have a rename, and you have a rename
* Spec fix
* More changes
* Temporarily disable specs
* After-merge update
* Undo rename for migration
* undo rename of DUS
* Fix DUS
* Fix merge problem
* Remove redundant DUS
* Fix specs
* Remove unused code
* Change wrong class name
* More cleanup
* Re-add missing values to constant
* Fix constant
* Fix spec
* Remove obsolete fields
* Add accidentally removed field
* Update spec
* Move methods from Settings::General to ForemInstance
* Remove unneeded model
* Change mentions of 'site config'
* Added custom seed task
* Added a test for the initial login for the intial admin of a forem instance.
* Renamed admin login seed data file.
* Pulled functions out of main Cypress plugin file and import them now.
* Added some comments.
* Added a comment about Cypress tasks requiring a return value to be considered successful.
* Moved admin_login_setup seed file to spec folder.
* Made change requests in regards to rake task.
* Fixed reference to SiteConfig
* Created the seeder class to be shared for all seed files.
* Added a missing param to function comment.
* Fixed seeder require in e2e test seed file.
* Fixed seeder require in seeds.rb. Why is Rails.root required?
* Added an environment guard for not being production in the e2e seed task.
* Made seeder require relative.
* Trying something for the Elastic Search issue in CI.
* Revert "Trying something for the Elastic Search issue in CI."
This reverts commit 7cb2a963c8ac1f9242c612a1b9fe8ff814605df6.
* Search indices are now removed via bundle exec rake search:destroy
* Now rake search:destroy is used in the Cypress task for resetting data as well.
* Moved Seeder class to app/lib
* Added cypress-rails
* Got two flows working with db rollbacks.
* Trimmed down the e2e dataset for now.
* Added a custom Cypress command to encompass test setup.
* removed unused e2e rake task
* added some user login/password e2e tests.
* Added a note about Cypress not cleaning cookies, so we do for the moment.
* Removed code no longer required.
* Removed comment in test that is no longer pertinent to the test suite.
* Removed data cleaning plugins as cypress rails gem handles it now.
* Added @citizen428's recommendation got raising an error if trying to seed production.
* Temporarily have paralleziation of e2e tests disabled to figure out cypres-rails/knapsack pro integration.
* Doh! Forgot a semi-colon in the Travis config.
* Added a comment about not integrating cypress-rails/knapsack pro right now.
* Removed knapsack pro npm package for now as we aren't using it.
* Reworded comment about cypress-rails/kanpsackpro.
* Removed seeding for tags to follow for onboarding in e2e seed data.
* Made pree2e script e2e:setup so it only runs explicitly when needed.
* Renamed bin/e2e to bin/e2e-ci.
* Created a new script for local e2e testing.
* Removed RAILS_ENV as it's in the e2e-ci script already.
* Fixed an auto corrected command.
* Fixed wording in e2e script prompt.
* Removed bundle exec rake data_updates:run that I had added. Doesn't appear to be necessary.
* Added missing new lines.
* Renamed e2e seed file and only use that one now. THere are no others.
* Some script cleanup.
* Added a check for the E2E environment so as to not pollute system tests.
* Now e2e test server cleanup occurs when the server shuts down.
* Put puts as this is really just for testing.
* Put environment variable in the proper place for runnning bundle exec.
* Added a check to only run for E2E tests.
* Some bash script formatting.
* Removed copy paste irrelevant comments.
* Updated e2e server shutdown message.
* Now a data-testid attribute is used for finding the user account errors panel.
* Made test selectors ignore casing of text.
* Removed prod paranoia check in e2e seed file.
* Refactored spec to use new cy.loginUser(user) command.
* Update app/lib/seeder.rb
Co-authored-by: Michael Kohl <citizen428@dev.to>
* Fixed flakiness that @aitchiss was experiencing.
* Rubocop fix.
* Due to a Cypress issue, fixing cookie clearing with another tweak.
* Bumped the wait time to 500ms if cookies don't clear.
* Added a 'bundle check' to the bin/e2e script as suggested by @katiedavis.
* Removed some white space
Co-authored-by: Michael Kohl <citizen428@dev.to>
* Render left sidebar attributes on profile
* Display header profile fields
* Make changes to protect DEV data
* Don't render DEV header fields twice
* Wrap profile UI changes in a FeatureFlag
* Add spec to test mulitple display areas
* Use select over reject
Co-authored-by: Michael Kohl <me@citizen428.net>
* Move comment for documentation generators
* Update dev profile fields csv data
Co-authored-by: Michael Kohl <me@citizen428.net>
Co-authored-by: Ben Halpern <bendhalpern@gmail.com>
* 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>