Commit graph

183 commits

Author SHA1 Message Date
Ben Halpern
ed4843ef4c
Change digest rake to new schedule (#20884) 2024-04-23 10:09:20 -04:00
Mac Siri
b4a4b30153
Add Staging specific seed file (#19434) 2023-05-10 16:10:19 -04:00
Ridhwana
9361d2426f
✂️✂️✂️ Part 1: Remove Sponsorship (#18512)
* 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
2022-10-03 16:26:32 +02:00
Suzanne Aitchison
f1df37f431
Add "only display when logged out" as an option on Navigation Links (#18275)
* add new column with enum value

* refactor to use display_to column

* add some more specs to application_helper

* test for the backfill DUS

* fix line length

* refactor
2022-08-08 10:55:24 +01:00
Mac Siri
678dda8cf4
Routine Rubopcop lint fixes (#17844)
* Routine Rubopcop lint fixes

* Undo app_secrets_spec changes

* Fix broken spec
2022-06-07 10:17:16 -04:00
Suzanne Aitchison
0dd77bcf52
Fixes for home nav link positioning (#16381)
* Add new DUS to fix home nav link positioning

* fix bug in local db seeding
2022-02-01 14:06:51 +00:00
Suzanne Aitchison
f1864847e7
Make home link an admin-customisable navigation link (#16268)
* move home link to a customisable navlink

* add trailing slash for path

* update specs

* replace positions, set home link to -1

* add update script for adding home navigation link

* update data update script
2022-02-01 09:27:09 +00:00
Jeremy Friesen
0484c550c5
Create/update by NavigationLink identity (#16312)
Prior to this commit, we were treating all NavigationLink attributes as
unique.  So, were we to change a position of one of the NavigationLinks
during the add_navigation_links rake task, we would have created a new
NavigationLink (and the only one would have remained).

With this commit, we're introducing the concept of the NavigationLink's
surrogate identity, that is to say if we have two NavigationLink objects
with the same `url` and `name` we should consider them the same
NavigationLink.  This allows us to update properties of those
NavigationLinks (via the rake task) without the risk of creating new
entries.

This unblocks PR #16268 which addresses #16076.
2022-01-27 13:51:41 -05:00
Michael Kohl
38f7957e3a
Clear app cache during bin/setup (#16267) 2022-01-26 13:10:36 +07:00
Jeremy Friesen
711f1bb0cd
Let override of ToS and CoC show in onboarding (#16217)
* Let override of ToS and CoC show in onboarding

Prior to this commit any changes to the terms or code of conduct were
not reflected in the onboarding links.

With this commit, I'm leveraging a newly created method that first
checks if there's a page for the given slug.  If there is, use that
page's copy.

To test:

- Overwrite default /terms page on a Forem
- Navigate to /onboarding or sign up as a new user
- Click on Terms of Use link text
- Review Terms of Use

Closes #15296

* Adding spec around not passing a block
2022-01-20 19:45:39 -05:00
Jeremy Friesen
e1a88d6f81
Allow for skipping navigation link creation (#16112)
* Allow for skipping navigation link creation

This commit provides a possible solution for preventing the re-creation
of a navigation link deleted by a Forem creator.

What I need is a discussion around the life-cycle of the application
installation and updates.

In particular, does this provide a robust enough mechanism for resolving
the issue at hand?

_Note: it pains me to ask about a user's role, but this is provided as a
point of discussion and possible implementationi to address the
underlying issue.  But I'm referencing a constant in the Rake task so
hopefully that will help future refactors.  Also, it's one reason I
needed to remove the `private_constant` declaration._

If we accept this code change, a future task is to document the ENV and
behavior.

Closes #15960

**Further considerations**:

- How might we refine this to not be as "role" reliant?
- Could we have a Site::Setting that we enable/disable
  regarding the navigation links?

Regarding QA:

- Start from an empty database
- Run setup
- Verify Navigation Link exists
- Delete Navigation Link
- Run setup again
- Verify Navigation Link exists (because we don't have a user)
- Run seeds
- Delete Navigation Link
- Run setup again
- Verify Navigation Link exists (because we don't have a user)

```shell
$ cd ./path/to/forem/repo

$ rails db:drop db:create db:schema:load

$ bin/setup

$ bin/rails runner "puts NavigationLink.where(url: '/readinglist').exists?"
  => true

$ bin/rails runner "NavigationLink.where(url: '/readinglist').delete_all"

$ bin/rails runner "puts NavigationLink.where(url: '/readinglist').exists?"
  => false

$ bin/setup

$ bin/rails runner "puts NavigationLink.where(url: '/readinglist').exists?"
  => true

$ bin/rails db:seed

$ bin/rails runner "NavigationLink.where(url: '/readinglist').delete_all"

$ bin/rails runner "puts NavigationLink.where(url: '/readinglist').exists?"
  => false

$ bin/setup

$ bin/rails runner "puts NavigationLink.where(url: '/readinglist').exists?"c
  => false
```

* Bump for travis
2022-01-17 17:22:24 -05:00
Peter Frank
16478a1b9c
Modify capitalization of default navigation link (#14849)
Changing `Terms of use` to `Terms of Use`

This has been bothering for me a while, and it's now consistent with `Code of Conduct` (which is not `Code of conduct` ) capitalization-wise
2021-10-01 09:42:17 -04:00
Arit Amana
812bfa2bbf
Create Default Nav Links In New Forem (RFC #237) (#14345)
* schema file undelete description

* update with main

* update with origin

* update

* create rake task for new-forem nav links

* remove debugger

* create rake task for new-forem nav links

* remove debugger

* incorporate review feedback

* DRY image paths up

Co-authored-by: Jamie Gaskins <jgaskins@hey.com>
2021-08-02 12:52:36 -04:00
Ridhwana
e827b8bab9
Minimal Seed Data for Admin Onboarding (#14385)
* minimal seeded flows

* fix: remove mistake

* refactor: rename the files appropriately

* feat: change some text

* fix: typo

* chore: new commit to rebuild
2021-07-29 17:08:41 +02:00
Arit Amana
3adfe7ace3
Static Sections for Site Navigation - Pt1 (#14213)
* schema file undelete description

* update with main

* update with origin

* Add "section" enum to navlink model

* create migration for section column

* create migration and data-update script

* update related rake tasks

* add scopes for default_links and other_links

* update E2E seeds

* ran migration; correct enum reference

* fix requests and model specs

* write DUS spec; fix factory and DUS

* yarn install

* address PR review comments

* fix migration; add null: false

* Remove yarn.lock from commit

* remove yarn.lock changes from commit

* sync yarn.lock with main

* newline
2021-07-14 11:01:56 -04:00
Molly Struve
4d77e7c1e9
Delay DUS scripts via WORKERS_DATA_UPDATE_DELAY_SECONDS in rake otherwise default run them immediately (#14166)
* Allow DATA_UPDATE_WORKER_DELAY to be set otherwise run DataUpdateScripts immediately in the background

* update var name and comment

* set a heroku friendly default

* Update ENV variable name
2021-07-09 13:26:58 -05:00
Michael Kohl
23fe4dd9de
Clean up forem:setup task (#13998) 2021-06-18 09:34:18 +07:00
Jamie Gaskins
6c6f24fdfa
Clear asset and vendor caches on deploy (#13631)
* Clear asset and vendor caches on deploy

We don't need these inside deployment artifacts

* Don't remove cached gem package files

Apparently Bundler uses this to determine whether the gems it needs are
installed. :-\
2021-06-02 13:14:59 -04:00
Michael Kohl
6dfabd578f
Rename SiteConfig to Settings::General (#13573)
* 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'
2021-05-21 14:45:37 +02:00
Michael Kohl
4b62bb75d4
[15 minute fix] Add data_updates:status rake task (#13653)
* Add data_updates:status rake task

* Disable AR logging
2021-05-06 10:06:32 +07:00
Alex
393ba00221
Remove Elasticsearch ✂️ ✂️ ✂️ ✂️ ✂️ ✂️ ✂️ ✂️ ✂️ ✂️ ✂️ ✂️ ✂️ ✂️ (#13606)
* Attempt number 1

* Fix rack_attack specs

* Fix users_searches_users spec

* Fix display_users_search_spec

* Fix comment typo

* Remove search:destroy task from cypress

* Remove port 9300 from gitpod

* Stub response in attack_spec
2021-05-03 11:09:45 -04:00
Mac Siri
2e4a4f82a5
Add auto-remove .o native extension rake task (#13563) 2021-04-28 13:02:56 -04:00
rhymes
456fecc043
Make sure columns in the schema file stay alphabetized after bin/setup (#13410) 2021-04-15 19:28:52 +02:00
Vaidehi Joshi
a5f014f576
[15 Min Fix]: Fix incorrect scope used by metrics:overview rake task (#13138)
* Fix incorrect scope used by metrics:overview rake task

* Add spec for metrics:overview rake task

* Add guard clause to metrics:overview rake task
2021-03-25 17:31:10 -07:00
Jacob Herrington
03465e8882
Add rake task to collect admin overview metrics (#13023)
* Add rake task to collect admin overview metrics

* Print the Forem Instance domain
2021-03-24 14:16:46 -05:00
Nick Taylor
7c1343be9e
Revert "Revert "Removed service worker (#12974)" (#13014)" (#13015)
This reverts commit 2416387fb4.
2021-03-17 10:57:56 -04:00
Molly Struve
2416387fb4
Revert "Removed service worker (#12974)" (#13014)
This reverts commit 4fb6230606.
2021-03-16 18:10:01 -05:00
Nick Taylor
4fb6230606
Removed service worker (#12974) 2021-03-16 15:55:31 -04:00
Ben Halpern
73125c0795
Reduce service worker functionality to minimal offline page (#12834)
* Reduce service worker functionality to minimal offline page

* Update docs for service workers

* Add comment to fix test

* Include incrementable static cache

* Add TODO comments about removal

* Fix trailing whitespace
2021-03-01 19:29:26 -05:00
Molly Struve
5a9235ed81
Remove Hacktoberfest Badge Rake Task (#12495) 2021-02-01 09:59:29 -06:00
Nick Taylor
a7da74b993
Cleaning Test Runs for End to End (E2E) Tests (#12143)
* 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>
2021-01-29 13:34:01 +01:00
Mac Siri
a63e7ef367
Expand slugignore & Add auto remove node_module rake task (#12372) 2021-01-22 07:24:26 -05:00
rhymes
e7f9735354
Remove RssReader (#12169)
* Add script to remove feature flag

* Remove :feeds_import feature flag and RssReader and related classes

* Change Feeds::ImportArticlesWorker signature to support Sidekiq Cron serialization

* Replace RssReader::Assembler with Feeds::AssembleArticleMarkdown

* Removing Assembler
2021-01-08 11:45:15 -05:00
rhymes
4aaeb3e955
Feeds::Import: only import feeds that haven't been recently updated (#12126)
* Add earlier_than to Feeds::Import

* Ignore feeds that have been imported in the last 4 hours

* Make earlier_than mandatory in Feeds::ImportArticlesWorker
2021-01-06 16:58:42 +01:00
Michael Kohl
63cf95d811
Split BadgeRewarder into multiple services (#11902) 2020-12-23 09:55:06 -05:00
rhymes
3dae3ff797
Upgrade rubocop* packages to the latest version and fix violations (#11972)
* Update erb_lint to track newer Rubocop versions

* Update rubocop-rspec to 2.1

* Fix Rails/WhereEquals and Style/RedundantParentheses

* Upgrade rubocop to 1.1.0

* Enable Rubocop 1.1 cops

* Upgrade rubocop to 1.2.0

* Enable Rubocop 1.2 cops

* Upgrade rubocop to 1.3.0

* Enable Rubocop 1.3 cops

* Enable Rubocop 1.4 cops

* Enable Rubocop 1.5 cops

* Upgrade rubocop to 1.6.x

* Restore previous .reject

* Fork the PR to make sure we don't inject unwanted code accidentally
2020-12-21 18:29:43 +01:00
Ridhwana
bae2571ad6
Replace the "setup onboarding profile fields" temp rake task with a data update script (#11800)
* feat: replace the temp rake task with a data update script

* oops we need a user
2020-12-08 17:50:43 +02:00
Ridhwana
19a048ecec
Deployment Task: Update onboarding fields prior to #11629 (#11704) 2020-12-07 14:57:18 -05:00
Molly Struve
8d3a13bc7d
Temp Feature: Award Hacktoberfest Badges Rake Task (#11464)
* Feature:Award Hacktoberfest Badges Rake Task

* Update to use subscriptions to hand out badges

* some script tweaks to detect successful completes and handle failures
2020-12-03 14:19:11 -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
Ben Halpern
a7ac6a2c3a
Bust caches at different intervals on restart (#11369) 2020-11-11 11:27:53 -05: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
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
Ridhwana
c1896bd664
chore: remove comment (#11038) 2020-10-23 17:53:07 +02:00
Molly Struve
70725665ac
Bug Fix:Fail Release Phase if a Migration Fails (#10968) 2020-10-20 17:41:25 -04:00
Ridhwana
66b14fc0bf
[deploy] Dynamic frontend for the sidebar navigation Items (#10754)
* feat: configure the frontend for sidebar nav links

* chore: add a comment

* changes to the admin interface

* feat: move the temporary task to be in the rake tasks and use it in the dev seeds

* feat: use the task in the rake seeds

* refactor: reuse the form across two modals

* refactor: use the form partial

* feat: change the modal to be large

* fix: naming

* Update db/seeds.rb

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

* chore: make the file readable

* chore: removed the if else as the rake task was run on all forems + i sent out a message to new communities

* oops

* refactor: add a scope

* chore: oops removed this

* feat: add navigation links specs

* spec: fix two failing ones

Co-authored-by: Michael Kohl <me@citizen428.net>
2020-10-12 16:05:47 -04:00
Michael Kohl
a2b55f889c
Remove Twitch integration (#10732)
* Remove Twitch integration

* Ignore columns
2020-10-08 12:44:10 +00:00
Ridhwana
19c78d6072
[deploy] Prepare the database for the configurable navigation items (#10662)
* feat: add the order of the navigational items to the database + admin interface

* refactor: rename :display_when_signed_in to :display_only_when_signed_in

* chore: rename all instances of display_when_signed_in to display_only_when_signed_in

* feat: add a data script that will setup the base urls

* feat: add a temporary rake file that will allow us to seed prod db's

* chore: oops rename file

* chore: remove the index for now

* chore: remove validation

* feat: change the order field to position and add an index o the name and url

* feat: update everything that uses order to position

* refactor: order by name as a secondary attr
2020-10-07 11:20:32 -04:00
Molly Struve
cc15266238
[deploy] Feature:Rake Task to Return Health Check Token (#10436) 2020-09-25 12:17:44 -05:00
Molly Struve
cc694146e6
Optimization:Move Initialization CacheBust to Background Worker (#10311)
* Optimization:Move Initilization CacheBust to Background Worker

* lower cache bust to 5 min and then bust shell version last

* moving back to 10 min after looking at recent deploy data
2020-09-18 11:30:47 -04:00