Commit graph

72 commits

Author SHA1 Message Date
Angel Barros
bb8b32bdf2
Zappat0n/add rate limit model everywhere 11500 (#14609)
* Create showModalAfterError function

* Show modal when comments rate limit is reached

* Show modal when article reaction rate limit is reached

* Show modal when follow user rate limit is reached

* Show form error when listing creation rate limit is reached

* Show form error when feedback messages rate limit is reached

* Rename functions for listings rate limit checks

* Show modal when notifications reaction rate limit is reached

* Show modal when picture upload rate limit reached

* Show modal for reactable objects when rate limit reached

* Add and modify tests

* empty commit

* Match modal messages to tests

* Fix error updating Modals

Co-authored-by: Dan Uber <dan@forem.com>
2021-09-23 10:49:19 +01:00
Andy Zhao
3b81172c56
Remove docs from repo ✂✂✂ (#14579)
* Remove docs ✂✂✂✂

* Remove all references to docs and gitdocs

* Update docs.forem.com to developers.forem.com

* Remove .gitdocs_build/

* Update yarn.lock
2021-08-23 17:23:42 -04:00
dependabot[bot]
f0093c5338
Bump rubocop from 1.18.4 to 1.19.0 (#14489)
* Bump rubocop from 1.18.4 to 1.19.0

Bumps [rubocop](https://github.com/rubocop/rubocop) from 1.18.4 to 1.19.0.
- [Release notes](https://github.com/rubocop/rubocop/releases)
- [Changelog](https://github.com/rubocop/rubocop/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rubocop/rubocop/compare/v1.18.4...v1.19.0)

---
updated-dependencies:
- dependency-name: rubocop
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Rubocop autofixes

* Manually fix some Rubocop warnings/errors

* How about another coffee, Michael?

* Maybe Rubocop needs a coffee too

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Michael Kohl <citizen428@forem.com>
2021-08-13 13:14:59 +07:00
Michael Kohl
dcf942e3a2
Add Admin:Settings controllers (#13851)
* Add Admin:Settings::BaseController and refactor

* Further simplify controllers

* Add comments, more cleanup

* Update mandatory settings controller

* Update spec

* Update service object and spec

* Update controller

* Update app/services/settings/general/upsert.rb

Co-authored-by: Jamie Gaskins <jamie@forem.com>

Co-authored-by: Jamie Gaskins <jamie@forem.com>
2021-06-08 10:13:55 +07: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
3837c3a221
Refactor handling of mandatory settings (#13553)
* Refactor handling of mandatory settings

* Add e2e test

* Rename controller
2021-04-29 09:25:16 +07:00
Michael Kohl
1c7de11bef
Split Settings::UserExperience (#13495)
* Add Settings::UserExperience

* Add DUS

* Update usage

* Add controller

* Add e2e test

* Fix specs
2021-04-28 13:29:25 +07:00
Michael Kohl
610f6151e6
Split Settings::Community from SiteConfig (#13403)
* Add settings_community_contents model

* Add settings_communities model

* Update usage

* Add controller and update code

* Add e2e test

* Add data update script

* Update schema.rb

* Fix specs

* PR feedback

* Remove experience_* from Settings::Community

* Update spec

* Fix spec
2021-04-26 10:46:35 +02:00
Jacob Herrington
5afb4d9a24
[15-Minute Fix] Refactor code smells (#13347)
* Remove duplicate method calls

* DRY up duplicated code

* Address code smells in concerns

* Update based on PR feedback
2021-04-21 14:52:32 -05:00
Michael Kohl
dc16b94f83
15 minute fix: Add default argument to JsonApiSortParam (#13369)
* Add default argument to JsonApiSortParam

* Update usage
2021-04-14 10:32:07 +07:00
Michael Kohl
d1c3380161
Update GET /followers API endpoint (#13287)
* Add created_at to API followers controller

* Add sorting

* Update API docs

* Update app/controllers/api/v0/followers_controller.rb

Co-authored-by: Jamie Gaskins <jgaskins@gmail.com>

* Update app/controllers/api/v0/followers_controller.rb

Co-authored-by: Jamie Gaskins <jgaskins@gmail.com>

* Use correct date format

* Update API docs

* Add JsonApiSortParams concern

* Update controller to use concern

* Rename and add docs

* Update API docs

* Remove leftover file

* Undo gem changes

* Consistently use field vs param

* Reset vendor/cache for git dependencies

Co-authored-by: Jamie Gaskins <jgaskins@gmail.com>
2021-04-13 10:12:42 +07:00
Michael Kohl
5406b0576e
Split Settings::Authentication from SiteConfig (#13095)
* Split Settings::Authentication from SiteConfig

* Move specs

* Sort fields

* Update settings usages

* Update recaptcha usages

* Add data update script

* Update spec

* Rename SiteConfigParams concern

* Fixes, new route, new controller

* Controller and service refactoring

* More controller and service updates

* Spec updates

* More spec fixes

* Move file

* Fix FeedbackMessagesController

* Update admin/configs_spec

* Fix remaining specs in admin/configs_spec

* Fix configs API

* Formatting

* Clean up old service object

* Various fixes

* Update DUS

* Add model argument to admin_config_label

* Fix key name

* Fix specs

* Add distinct request caches for settings classes

* Fix e2e tests

* Fix remaining system spec

* Make DUS idempotent

* Move routes block

* Cleanup

* Switch to ActiveSupport::CurrentAttributes

* Pinned rails-settings-cached

* Update e2e test

* Update lib/data_update_scripts/20210316091354_move_authentication_settings.rb

Co-authored-by: rhymes <rhymes@hey.com>

* Add guard to DUS

* Temporarily re-add two SiteConfig fields

* Fix config show view

Co-authored-by: rhymes <rhymes@hey.com>
2021-04-12 09:41:09 +02:00
Michael Kohl
0af8fc1866
Prevent suspended users from self-deleting and returning (#12503)
* Add new table and model

* Store banned user username hash on delete

* Prevent previously banned user from signing up again

* Update method name

* Refactor code and add more specs

* Test improvements

* Don't override existing global flash

* Fix typo

* Update spec description

* Update schema.rb

* More schema.rb fixes

* Simplify spec

* Update migration

* Clean up migration

* Rename method

* Add DataDog counter

* Revisit error handling

* Remove spurious empty line

* Make model name more explicit
2021-02-11 09:28:59 +07:00
Ben Halpern
68867e9384
Add config post route for admin api (#11698)
* Add config post route for admin api

* Fix params

* Extract config_params to concern

* Remove print statement

* Some changes

* A couple changes

* Change controller method name and refactor upsert

* Fix tests and method names

* Fix routes and class stuff

* Fix styles

* Fix config params

* Fix styles

* Move regex to constant

* Remove single-use after action callbacks

* Expose success? method

* Fix syntax error

* Fix success? return

* Switch to guard clause

* Final clean ups?
2020-12-22 15:50:34 -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
Anna Buianova
87a99a28ae
Fix Rails/OutputSafety violations (#11945)
* Avoid Rails/OutputSafety violation in setup checks

* Avoid Rails/OutputSafety violation in admin config labels

* Added parentheses for tag.span
2020-12-17 20:30:15 +03: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
Ben Halpern
badefcabeb
Developer experience/security: Make dev/test blow up if current_user is used erroneously (#11237)
* Let dev/test blow up if current_user is used erroneously

* Fix logic

* Fix click-to-edit permissions

* Change test to check for new behavior

* linting

* Edit tests

* Change test

* Clean up implementation

* Update comment

* Fix instance vars

* Update app/controllers/concerns/caching_headers.rb

* Merge origin and add request_store gem
2020-11-12 11:54:23 -05:00
Alex
cb6781740f
[deploy] Update site config defaults (#11172)
* Update site config defaultss with specs

* Add missing .freeze

* Fix specs
2020-10-30 13:40:09 -04:00
Alex
94cd9e246f
[deploy] Add default for main_social_image (#11126)
* Add default for main_social_image

* Fix image URL and add spec

* Fix spec

* Move image_url helper into image module

* Fix typo in comment

Co-authored-by: Vaidehi Joshi <vaidehi.sj@gmail.com>

* Change URL helper logic

* Try something else

* Use ApplicationConfig

* Refactor

* Try again

* Try again with another approach

* Add specs for URL.local_image

Co-authored-by: Vaidehi Joshi <vaidehi.sj@gmail.com>
2020-10-29 10:07:14 -04:00
Ben Halpern
bc248f17e7
Skip edge caching for private forems (#10817)
* Skip edge caching for private forems

* Add test

* Update spec/requests/stories_index_spec.rb

* Adjust comment

* Also check other cache-related headers
2020-10-13 13:36:20 -04:00
Molly Struve
ea969748e9
Feature:Notify Devs when Sidekiq is Not Running in Development (#10541) 2020-10-13 12:13:47 -05:00
Vaidehi Joshi
c4efee10bf
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
2020-10-08 10:51:25 -04:00
Jacob Herrington
1a8fa3b182
Add logo_svg to mandatory config fields (#10671) 2020-10-07 08:29:13 +02:00
Vaidehi Joshi
f83062a9dd
Remove community_action from SiteConfig (#10678) 2020-10-06 15:46:04 -04:00
Vaidehi Joshi
3d169b5e6f
Do not require SiteConfig.tagline (#10623) [deploy]
* Fix incorrect formatting in admin/configs/show.html.erb

* Only render SiteConfig.tagline if it exists

* Fix typo in _signup_modal.html.erb

* Remove tagline from VerifySetupCompleted::MANDATORY_CONFIGS

* Improve signup_modal tagline specs

* Tiny fixes to address @citizen428's comments
2020-10-06 10:34:34 -07:00
Anna Buianova
aa40d5ffdb
Improve setup not completed notification (#10411) 2020-09-22 10:26:50 +07:00
Rafi
d570edcf07
Showing date in listing tile (#10217)
* Showing date in listing tile

* Displaying date in listing tile

1. Sending created_at in listing search API
2. Global util functions for short and long date formatting
3. New date util functions extend timestampToLocalDateTime
4. Converting div to time tag
5. Adding title attribute for date

* originally_published_at column

* Displaying originally_published_at date

* Fixing test in modal

* Fixing all listing test

* Fixing casing of dateTime

* Adding tests for originally_published_at

* Reverting to bumped_at

* Backfilling only published listing

* Removing ReIndexListingWithOriginallyPublishedAt
2020-09-21 10:14:26 +02:00
Anna Buianova
fec947ce45
More detailed notification when setup is not completed (#10375) 2020-09-18 09:24:49 -04:00
Ben Halpern
dba151915b
[deploy] Allow initial user to sign up and configure app (#10073)
* Allow initial user to sign up and configure app

* Fix added value unneeded

* Make siteconfig public in tests

* Remove deprecated method and adjust seed default

* Add new controllers not to redirect for public

* Modify tests

* Edit test defaults

* Fix linting

* Add starter mode to seed file
2020-08-31 12:54:22 -04:00
Ben Halpern
6c71369df5
[deploy] Add community_name to site config (#9864)
* Add community_name to site config

* Fix a spec

* Remove SiteConfig from constants

* Change subjects to method

* Fix subjects method

* Fix linting
2020-08-19 14:54:40 -04:00
Vaidehi Joshi
63816035bb
Add X-Accel-Expires header to support Nginx caching (#9655) [deploy]
* Replace  in Cache-Control header to support Nginx caching

* Add 'X-Accel-Expires' header for Nginx caching

* Remove max-age directive from remaining specs

* Update caching header specs to test against x-accel-expires header
2020-08-13 14:24:50 -07:00
Josh Puetz
1c566e0ec4
[deploy] Move /internal to `/admin (#9639)
* First draft - all the big changes

* Changing some more references to 'internal'

* Relocate internal request tests to admin

* Relocate internal system tests to admin

* Fix trailing space

* Test fix

* Move queries from internal to admin

* Docs updates

* Rename internal stimuls controllers to admin (plus docs)

* Rename admin layout

* Fix routing after rebase

* Fixes for latest added admin interfaces

* Serviceworker ignore paths
2020-08-07 10:36:26 -04:00
Vaidehi Joshi
df990afadc
Conditionally remove no-cache from Fastly headers (#9631) [deploy]
* Rename FastlyHeaders to CachingHeaders, conditionally experiment with removing no-cache

We suspect that it is safe to remove `no-cache` entirely from the Cache-Control headers that are sent
along to Fastly, but there is no great way to confirm this hypothesis. We're testing this by experimenting
on one single article. We will conditionally default to the same headers that we send to Nginx, and send
those headers to Fastly (by removing `no-cache` and adding in `max-age`, which should be ignored since Fastly
also has Surrogate-Control headers added to it, which include a `max-age`, which Fastly should prioritize
over any other `max-age`.

Once we've confirmed that this doesn't cause issues on the Fastly side, we can remove this check and use
the same Cache-Control headers for both Fastly and Nginx.

* Add check for request.env[REQUEST_PATH].present?
2020-08-05 12:34:12 -07:00
rhymes
0b4ad49cf8
Rubocop: Enable and fix Style/OptionHash (#9430)
* Enable and fix Style/OptionHash

* Add 10 seconds default timeout to DB statements
2020-07-25 10:41:21 +02:00
Michael Kohl
8425c847c3
Update CODEOWNERS and team names in TODO comments (#9460)
* Update CODEOWNERS

* Update teams in TODO comments

* Remove mentions of team cool
2020-07-24 12:17:20 +07:00
rhymes
88f0a0e58a
Rubocop: re-activate Style/RegexpLiteral and fix violations (#9418)
* Rubocop: re-activate Style/RegexpLiteral and fix violations

* Add 10 seconds default timeout to DB statements
2020-07-22 16:28:27 +02:00
Ridhwana
4359d5b09a
[deploy] Site Config: Get Started Section and Show Required Fields (#9289)
* chore: spike

* fix: update doesnt get to symbol

* spelling

* chore: some suggestions

* chore: change name

* chore: content tag and safe join

* chore: keep this open for now

* chore: code climate

* more code climate stuff

* chore: remove commas

* fix: tests

* feat: update the descriptions and placeholders

* chore: update all the variables

* chore: update lines

* feat: update ""

* chore: length line

* feat: content_tag

* chore: disable rubocop:disable Rails/OutputSafety

* feat: collapse the get started section if everything is filled out

* chore: comment

* some cleanup

* codeclimate :(
2020-07-20 08:20:15 -04:00
rhymes
5b62811c98
[deploy] Rubocop: fix violations of Layout/LineLength (#9197) 2020-07-08 08:36:36 -05:00
Michael Kohl
fb27f52ed0
[deploy] Display banner if site hasn't been configured (PRE DEPLOYMENT TASKS) (#8435) 2020-07-07 07:37:04 -05:00
rhymes
4ab6d02d2f
Routine rubocop fixes (#8346)
* rubocop -a

* rubocop --auto-gen-config
2020-06-08 17:37:25 +02:00
Michael Kohl
7f75f99560
[deploy] Rename classified listings (#7910)
* Change models and related files

* Update controllers and specs

* More renaming

* Seek and destroy, I mean search and replace

* Round up the stragglers

* Ground control to Major Travis...

* More fixes

* PR feedback

* Various fixes

* Rename view

* Fix list query builder

* Unify request specs

* Fix some API spec errors

* Fix remaining API specs

* Make spec conform to API

* Fix leftover problems

* Fix JS tests

* Fix column name in select

* Fix API specs

* Fix search specs

* Paging Mr. Travis
2020-05-27 13:35:09 +00:00
rhymes
0976132425
[deploy] RSS feed: add article tags as categories (#8046) 2020-05-26 15:51:33 -04:00
Michael Kohl
c23850f795
[deploy] Credit refactoring (#7841)
* Simplify Credit model

* Use enough_credits? method
2020-05-14 18:04:26 -04:00
Alex
004dbba500
[deploy] Remove logging of image data to Datadog (#7829) 2020-05-13 16:23:42 -04:00
Michael Kohl
79f1f5f0c8
Change string concatenation to interpolation (#7680)
* Change string concatenation to interpolation

* Replace more concatenation with interpolation

* Add forgotten interpolation
2020-05-06 17:13:10 +02:00
Molly Struve
caadf27288
[deploy] Rate Limit Classified Listing Creation (#7684) 2020-05-05 12:01:27 -05:00
Alex
5060652939
Validate images are files (#7639)
* Validate images are files

* Skip image validation if there aren't any images
2020-05-01 10:39:20 -04:00
Michael Kohl
46f94b135d
[deploy] Classified listings refactor part 3 (#7498)
* Ignore category column

* Move view oriented class methods to helper

* Start refactoring ClassifiedListingsToolkit

* Add attr_accessor instead of category

* Replace old category column with association

* More cleanup

* Trigger Travis

* Don't rename associations, category_slug -> category

* Indiana Kohl and the missing newline

* More refactoring and spec fixes

* Add dashboard for classified listing categories

* Remove TODO comment

Co-authored-by: rhymes <rhymesete@gmail.com>
2020-04-30 18:57:01 -04:00
Alex
b6664456c0
[deploy] Validate filenames server-side (#7405) 2020-04-23 14:30:59 -05:00