Commit graph

188 commits

Author SHA1 Message Date
rhymes
0d58de830b
API: Add reading_time_minutes to /api/articles/me (#14318) 2021-07-26 17:47:50 +02:00
Alex
7a48708156
API: Add instance endpoint and spec (#14301)
* Create /api/forem_directories endpoint and spec

* PR feedback

* Update regex in spec
2021-07-23 12:10:08 -04:00
rhymes
d018b69106
API: Remove Admin Config endpoint (#13934) 2021-06-08 09:43:51 +02: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
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
Daniel Uber
2f1dad4e37
Add reading_time to articles api responses (#13446)
* Add reading_time to articles api responses

Fixes #13436

* Update api docs to match changes to the articles response

* Follow up docs updates

- increment api docs version
- add reading_time to articles/me responses
- add reading time to the show response example format

* Change reading_time attribute to reading_time_minutes

Update the article builder to use `article.reading_time` and present
it as `"reading_time_minutes"`.

Update the api spec to expect the new property name instead of the attribute.

* Update api documentation to reflect the new name

- Change reading_time -> reading_time_minutes.
- I decided to keep the (possibly redundant) description text here.
2021-04-19 17:11:55 -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
Mac Siri
aed41c3238
Fix Ruby 2.7 kwargs' warnings & misc spec warnings (#13256) 2021-04-06 16:57:59 -04:00
Jacob Herrington
a5b2d109d5
Rename banned and comment_banned roles (#12270)
* Rename banned and comment_banned roles

* Add data update script to rename roles containing 'ban'

* Add named error for Suspended users

* Update unidiomatic method names

* Rename misc banned to suspended

* Apply suggestions from code review

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

* Add unit tests for suspended methods

This commit also adds TODO comments for removing banned and
comment_banned from the codebase after data update scripts have
successfully run on all of our Forems.

Co-authored-by: Michael Kohl <me@citizen428.net>
2021-04-06 10:12:14 -05:00
Jacob Herrington
2186210792
Fix deprecation warning (#13253)
Rendering actions with '.' in the name is deprecated
2021-04-06 08:16:42 -05:00
Vaidehi Joshi
95055b2a89
Remove pro role + expose analytics to all users via dashboard (#13156)
* Remove pro role on user, expose pro dashboard to all users as analytics

* Remove pro from Elasticsearch mappings

* Update user role docs to use :trusted over :pro

* Remove pro from Role model spec

* Remove more references to pro, as noted by @rhymes
2021-03-30 15:02:18 -07:00
Fernando Valverde
cf3bde4259
Add mobile push notifications to Forem (#12419)
* First commit with iOS PN working

* RPush cleanup worker + unique jobs config

* Remove rpush tables from schema.rb

* PR feedback

* Feature flag and test for route

* Tests and feature flag PushNotification ::Send

* Update app/controllers/devices_controller.rb

Co-authored-by: Michael Kohl <citizen428@dev.to>

* Update spec/routing/devices_routes_spec.rb

Co-authored-by: Michael Kohl <citizen428@dev.to>

* Update spec/services/push_notifications/send_spec.rb

Co-authored-by: Michael Kohl <citizen428@dev.to>

* PR feedback

* Set Rpush driver and url

* More PR feedback

* Apply suggestions from code review

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

* PR feedback from Rhymes

* Don’t double render

* Sure

Co-authored-by: Josh Puetz <hi@joshpuetz.com>
Co-authored-by: Josh Puetz <josh@dev.to>
Co-authored-by: Michael Kohl <citizen428@dev.to>
Co-authored-by: Jamie Gaskins <jgaskins@gmail.com>
2021-03-12 14:08:18 -06:00
Anna Buianova
10a02f46d4
Articles update refactoring (#12913)
* Start refactoring articles update

* Articles update refactoring

* Added a couple of tests for Articles::Updater

* Reorganized code in Articles::Updater and ::Attributes a bit

* A couple of more tests for Articles::Attributes

* Reverted changed in the articles_controller

* Edited_at in Articles::Attributes

* Use Articles::Updater in ArticlesController

* Tests for notifications when published/unpublished an article

* Removed old code

* Return result object from Articles::Updater

* Don't reset articles collection when no series was passed

* Fixed sending notifications when published an article the first time

* Fix articles collection when updating

* Fix setting attributes for articles update

* Spec for articles update via api failure

* More tests for Articles::Updater

* More specs for articles updating

* Pass article instead of article_id to articles updater to avoid loading an article twice

* Remove the redundant check in the articles_controller

* Articles::Attributes refactoring
2021-03-10 13:08:36 +03:00
Andy Zhao
1b47f16291
Prevent banned users from using API (#12730)
* Prevent banned users from accessing API

* Prevent banned users from creating API keys

* Delete API keys when deleting user

* Add tests

* Prevent banned signed in users from accessing API oops

* Refactor authenticate! for readability
2021-02-18 17:56:16 -05:00
Spencer
27648a938b
API: Endpoint to get an organization's articles (#12237)
* update route

* add controller action

* add article jbuilder/update shared files

* add tests

* update api docs

* add published to query

* render articles index/delete articles jbuilder

* call articles index attributes const

* put back article/flare partials

* bug fix for readinglist index

* bug fix for render partial in jbuilder
2021-01-13 13:09:58 +01: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
Mac Siri
893151d76b
Fix API's broken organization's image (#11981) 2020-12-21 07:20:16 -05:00
Spencer
6e2aab623e
API: Endpoint to get an organization's listings (#11823)
* add tests

* add route

* add controller action

* add jbuilder file

* update api docs

* update query

* update jbuilder listing

* add organization/user and category to listing

* update api docs/spec file
2020-12-18 12:20:35 -05:00
Ben Halpern
54937fa5a7
Add configs/show api for admins (#11358)
* Add configs/show api for admins

* Add initial test

* Add test

* Update docs/api_v0.yml

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

* Change to single resource

* Change authentication approach

* Change to status code spec

* Fix spec path

* Final touches

* Update spec/requests/api/v0/admin/configs_spec.rb

Co-authored-by: Michael Kohl <citizen428@dev.to>

* Proper stubbing

Co-authored-by: rhymes <rhymes@hey.com>
Co-authored-by: Michael Kohl <citizen428@dev.to>
2020-12-01 12:22:07 -05:00
Spencer
de3d62bc40
API: Endpoint to get an organization's users (#11514)
* add tests

* add route

* add users action to organizations controller

* add jbuilder file

* update api docs

* add recource routes

* make updates to organizations controller

* remove org_users from api docs

* update spec

* add users show jbuilder

* bug fix for user show
2020-11-25 12:50:57 +01:00
Krzysztof Rybka
d6956180ad
Return video_source_url in API V0 Videos index (#11040) 2020-11-09 06:27:28 +01:00
Spencer
c0168df2a8
API: Endpoint to get an organization's details (#10931)
* add organizations api request spec

* add organizations api controller

* add organizations api show route

* add show jbuilder file

* fix merge conflict on routes

* add organization show to api docs

* update created_at to iso format

* api docs add format field/cleanup
2020-10-30 16:22:30 -04:00
Diogo Osório
2b72a35d3d
[deploy] Introduce /api/profile_images/:username endpoint (#10547)
* Documents the new /profile-images/:username API endpoint

* Introduces the /api/profile_images/:username endpoint

This endpoint receives either an user or organization username as input
via the URL path and returns the profile image information for that
user/orgnization.

* Updates the /api/profile_images/:username response

Adapts the response according to the review comments:

1. Removes the cache directives
1. Tweaks how the user query is being done
1. Adds a `image_of` property to the response

* Bump API version

Co-authored-by: rhymes <rhymes@hey.com>
Co-authored-by: Molly Struve <mollylbs@gmail.com>
2020-10-14 14:24:25 -05:00
Jean-Francis Bastien
9ff7f82664
[deploy] API - New endpoint to retrieve the articles in the reading list of the authenticated user (#10540) 2020-10-14 13:20:03 -05:00
Dana Scheider
24641d537a
API: Add route for fetching a user's followed tags (#9108)
* Add route for fetching a user's followed tags

* Move followed tags route to FollowsController instead of TagsController and add JSON view

* Add missing new line

* Change the dots for our linter

Co-authored-by: rhymes <rhymes@hey.com>
Co-authored-by: Molly Struve <mollylbs@gmail.com>
2020-09-18 16:28:42 -05:00
rhymes
2d881ef571
Routine rubocop fixes (#10237) 2020-09-08 12:06:47 -04:00
rhymes
c9e72858b7
Enable pending Style/SingleArgumentDig (#9842) 2020-08-18 10:26:40 -04:00
jkrsn98
dbdc6ead38
[deploy] API: add created_at datetime to comments (#9829)
* added created_at to comments in api response

* added test to ensure a date is returned for comment

* fix offenses in test

* updated docs to include addition of created_at to comment api response
2020-08-17 20:10:24 -04:00
jkrsn98
8639e3b748
API: retrieve podcast episodes comments (#9677)
* modified index to allow retreival of comments belonging to either articles or podcast episodes

* updated comments section in api documentation to include info on podcast comments

* Remove DEV badge link (#9675)

* [deploy] Profile Admin UI Setup Screen Refactor (v1.5)  (#9649)

* implement some suggestions from https://github.com/forem/forem/pull/9610

* chore: update the errors based on suggestions

* feat: make query readable on blazer

* added new parameter p_id to safe parameters

* Remove forward slash from br tags in pages partial (#9678)

* [deploy] Change lingering `/internal` paths to `/admin` (#9673)

* Change lingering `/internal` paths to `/admin`

* Fix multiline test expectation

* [deploy] Add new support admin role (#9681)

* Add new support admin role

* Allow support admins to banish users

* Fix spec order for new support admin role

* Migrate serialization to jsonapi-serializer (#9682)

This replaces the abandoned fast_jsonapi.

* [deploy] Async Handle Notifications for Comments When Saved (#9680)

* [deploy] Optimization: Change Large Table Primary Keys to Bigints (#9476)

* [deploy] Revert "Async Handle Notifications for Comments When Saved (#9680)" (#9686)

This reverts commit 852223dd86.

* Bump ddtrace from 0.38.0 to 0.39.0 (#9695)

* Bump ddtrace from 0.38.0 to 0.39.0

Bumps [ddtrace](https://github.com/DataDog/dd-trace-rb) from 0.38.0 to 0.39.0.
- [Release notes](https://github.com/DataDog/dd-trace-rb/releases)
- [Changelog](https://github.com/DataDog/dd-trace-rb/blob/master/CHANGELOG.md)
- [Commits](https://github.com/DataDog/dd-trace-rb/compare/v0.38.0...v0.39.0)

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

* Bump ddtrace from 0.38.0 to 0.39.0 (Update vendor/cache)

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>

* Bump vault from 0.14.0 to 0.15.0 (#9697)

* Bump vault from 0.14.0 to 0.15.0

Bumps [vault](https://github.com/hashicorp/vault-ruby) from 0.14.0 to 0.15.0.
- [Release notes](https://github.com/hashicorp/vault-ruby/releases)
- [Changelog](https://github.com/hashicorp/vault-ruby/blob/master/CHANGELOG.md)
- [Commits](https://github.com/hashicorp/vault-ruby/compare/v0.14.0...v0.15.0)

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

* Bump vault from 0.14.0 to 0.15.0 (Update vendor/cache)

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>

* [deploy] Optimization:Set Honeybadger send_data_at_exit to False (#9687)

* Travis Optimization:Bundle from Bash File to Use Cache (#9705)

* Bump stripe from 5.22.0 to 5.23.1 (#9692)

* Bump stripe from 5.22.0 to 5.23.1

Bumps [stripe](https://github.com/stripe/stripe-ruby) from 5.22.0 to 5.23.1.
- [Release notes](https://github.com/stripe/stripe-ruby/releases)
- [Changelog](https://github.com/stripe/stripe-ruby/blob/master/CHANGELOG.md)
- [Commits](https://github.com/stripe/stripe-ruby/compare/v5.22.0...v5.23.1)

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

* Bump stripe from 5.22.0 to 5.23.1 (Update vendor/cache)

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>

* [deploy] Bump ancestry from 3.0.7 to 3.1.0 (#9689)

* Bump ancestry from 3.0.7 to 3.1.0

Bumps [ancestry](https://github.com/stefankroes/ancestry) from 3.0.7 to 3.1.0.
- [Release notes](https://github.com/stefankroes/ancestry/releases)
- [Changelog](https://github.com/stefankroes/ancestry/blob/master/CHANGELOG.md)
- [Commits](https://github.com/stefankroes/ancestry/compare/v3.0.7...v3.1.0)

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

* Bump ancestry from 3.0.7 to 3.1.0 (Update vendor/cache)

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>

* Bump rubocop from 0.88.0 to 0.89.0 (#9699)

* Bump rubocop from 0.88.0 to 0.89.0

Bumps [rubocop](https://github.com/rubocop-hq/rubocop) from 0.88.0 to 0.89.0.
- [Release notes](https://github.com/rubocop-hq/rubocop/releases)
- [Changelog](https://github.com/rubocop-hq/rubocop/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rubocop-hq/rubocop/compare/v0.88.0...v0.89.0)

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

* Bump rubocop from 0.88.0 to 0.89.0 (Update vendor/cache)

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>

* Bump twilio-ruby from 5.39.2 to 5.39.3 (#9690)

* Bump twilio-ruby from 5.39.2 to 5.39.3

Bumps [twilio-ruby](https://github.com/twilio/twilio-ruby) from 5.39.2 to 5.39.3.
- [Release notes](https://github.com/twilio/twilio-ruby/releases)
- [Changelog](https://github.com/twilio/twilio-ruby/blob/main/CHANGES.md)
- [Commits](https://github.com/twilio/twilio-ruby/compare/5.39.2...5.39.3)

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

* Bump twilio-ruby from 5.39.2 to 5.39.3 (Update vendor/cache)

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>

* Bump ibm-openapi-validator from 0.28.0 to 0.28.1 (#9703)

Bumps [ibm-openapi-validator](https://github.com/IBM/openapi-validator) from 0.28.0 to 0.28.1.
- [Release notes](https://github.com/IBM/openapi-validator/releases)
- [Changelog](https://github.com/IBM/openapi-validator/blob/master/CHANGELOG.md)
- [Commits](https://github.com/IBM/openapi-validator/compare/v0.28.0...v0.28.1)

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

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>

* Bump sass-loader from 9.0.2 to 9.0.3 (#9702)

Bumps [sass-loader](https://github.com/webpack-contrib/sass-loader) from 9.0.2 to 9.0.3.
- [Release notes](https://github.com/webpack-contrib/sass-loader/releases)
- [Changelog](https://github.com/webpack-contrib/sass-loader/blob/master/CHANGELOG.md)
- [Commits](https://github.com/webpack-contrib/sass-loader/compare/v9.0.2...v9.0.3)

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

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>

* Bump jsdom from 16.3.0 to 16.4.0 (#9701)

Bumps [jsdom](https://github.com/jsdom/jsdom) from 16.3.0 to 16.4.0.
- [Release notes](https://github.com/jsdom/jsdom/releases)
- [Changelog](https://github.com/jsdom/jsdom/blob/master/Changelog.md)
- [Commits](https://github.com/jsdom/jsdom/compare/16.3.0...16.4.0)

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

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>

* Bump eslint-plugin-react from 7.20.3 to 7.20.5 (#9694)

Bumps [eslint-plugin-react](https://github.com/yannickcr/eslint-plugin-react) from 7.20.3 to 7.20.5.
- [Release notes](https://github.com/yannickcr/eslint-plugin-react/releases)
- [Changelog](https://github.com/yannickcr/eslint-plugin-react/blob/master/CHANGELOG.md)
- [Commits](https://github.com/yannickcr/eslint-plugin-react/compare/v7.20.3...v7.20.5)

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

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>

* Flaky Spec Fix:HTML Escape Special Characters in Assertion like Template (#9708)

* Bump redoc-cli from 0.9.9 to 0.9.10 (#9698)

Bumps [redoc-cli](https://github.com/Redocly/redoc) from 0.9.9 to 0.9.10.
- [Release notes](https://github.com/Redocly/redoc/releases)
- [Changelog](https://github.com/Redocly/redoc/blob/master/CHANGELOG.md)
- [Commits](https://github.com/Redocly/redoc/commits)

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

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>

* Bump css-loader from 4.2.0 to 4.2.1 (#9700)

Bumps [css-loader](https://github.com/webpack-contrib/css-loader) from 4.2.0 to 4.2.1.
- [Release notes](https://github.com/webpack-contrib/css-loader/releases)
- [Changelog](https://github.com/webpack-contrib/css-loader/blob/master/CHANGELOG.md)
- [Commits](https://github.com/webpack-contrib/css-loader/compare/v4.2.0...v4.2.1)

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

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>

* Bump brakeman from 4.8.2 to 4.9.0 (#9691)

* Bump brakeman from 4.8.2 to 4.9.0

Bumps [brakeman](https://github.com/presidentbeef/brakeman) from 4.8.2 to 4.9.0.
- [Release notes](https://github.com/presidentbeef/brakeman/releases)
- [Changelog](https://github.com/presidentbeef/brakeman/blob/main/CHANGES.md)
- [Commits](https://github.com/presidentbeef/brakeman/compare/v4.8.2...v4.9.0)

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

* Bump brakeman from 4.8.2 to 4.9.0 (Update vendor/cache)

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>

* Bump @babel/core from 7.11.0 to 7.11.1 (#9693)

Bumps [@babel/core](https://github.com/babel/babel/tree/HEAD/packages/babel-core) from 7.11.0 to 7.11.1.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.11.1/packages/babel-core)

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

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>

* Bump preact from 10.4.6 to 10.4.7 (#9696)

Bumps [preact](https://github.com/preactjs/preact) from 10.4.6 to 10.4.7.
- [Release notes](https://github.com/preactjs/preact/releases)
- [Commits](https://github.com/preactjs/preact/compare/10.4.6...10.4.7)

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

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>

* Enable Rubocop 0.89 cops and fix Lint/ violations (#9709)

* Enable new Lint/ cops and run rubocop -a

* Fixing last remaining things with rubocop -a

* Enable and fix Style/ExplicitBlockArgument and Style/GlobalStdStream

* Forgot parenthesis

* changed variable name from article to commentable

* [deploy] Bug Fix:Dont Set Active Channel if ChatChannel Does Not Exist (#9704)

* Rubocop: Enable and fix Style/OptionalBooleanParameter cop (#9711)

* Enable and fix Style/OptionalBooleanParameter cop

* Keep regular parameters for workers

* Keep regular parameters for workers

* Fix spec

* Trigger Travis correctly

* Fix Netlify catch all redirections (#9717)

* added test for get comments by podcast episode

* [deploy] Upgrade Chartkick to fix CVE-2020-16254 Vulnerability (#9718)

* [deploy] Redirect /internal to /admin (#9716)

* Update docs with details on where to install Elasticsearch (#9670) [deploy]

* Gitignore elasticsearch installations

* Add a note to explain that ES should be installed at the root level

Remove `/elasticsearch/*` from .gitignore as well!

* Update reference to home directory in mac + windows installation guides

* [deploy] Improve clean up of user language settings (#9671)

* modified index to allow retreival of comments belonging to either articles or podcast episodes

* updated comments section in api documentation to include info on podcast comments

* changed variable name from article to commentable

* added test for get comments by podcast episode

* added new parameter p_id to safe parameters

* modified index to allow retreival of comments belonging to either articles or podcast episodes

* changed variable name from article to commentable

* Trigger Travis correctly

Co-authored-by: Ben Halpern <bendhalpern@gmail.com>
Co-authored-by: Ridhwana <Ridhwana.Khan16@gmail.com>
Co-authored-by: Julianna Tetreault <32834804+juliannatetreault@users.noreply.github.com>
Co-authored-by: Josh Puetz <joshpuetz@gmail.com>
Co-authored-by: Andy Zhao <17884966+Zhao-Andy@users.noreply.github.com>
Co-authored-by: Jan Klimo <jan.klimo@gmail.com>
Co-authored-by: Molly Struve <mollylbs@gmail.com>
Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
Co-authored-by: rhymes <rhymes@hey.com>
Co-authored-by: Vaidehi Joshi <vaidehi.sj@gmail.com>
Co-authored-by: Alex <alexandersmith223@gmail.com>
2020-08-11 14:36:49 +02:00
rhymes
696c712883
Rubocop: routine fixes (#9345)
* rubocop -A

* Fix Style/HashLikeCase

* regenerated todo file
2020-07-16 18:18:13 +02:00
rhymes
f1ec04a0c9
Rubocop: move dot in multi-line calls to leading position (#9262) 2020-07-16 15:51:11 +02:00
Ben Halpern
da6a6739e5
[deploy] Invite users to join and create password (#9294)
* Initial invitation work

* Add more invitation code

* Add proper registration page

* Fix up tests

* Fix failings

* Fix spec

* Add self-serve auth config

* Add registered condition

* Change profile image call and registered_at test

* Change comment

* Fix copy test

* Stub emojipedia

* Linting

* Add registered at to factory

* Ensure registered for user tag

* Update app/views/internal/invitations/index.html.erb

Co-authored-by: Michael Kohl <citizen428@dev.to>

* Update app/controllers/internal/invitations_controller.rb

Co-authored-by: Michael Kohl <citizen428@dev.to>

* Slight changes

* Update recover password flow

* Update app/views/internal/invitations/index.html.erb

Co-authored-by: Michael Kohl <citizen428@dev.to>

* Update app/controllers/internal/invitations_controller.rb

Co-authored-by: Michael Kohl <citizen428@dev.to>

* Update db/schema.rb

Co-authored-by: Michael Kohl <citizen428@dev.to>
2020-07-15 11:37:19 -04:00
rhymes
1166370818
Rubocop: activate Layout/ClassStructure (#9304) 2020-07-14 18:28:18 +02:00
rhymes
ffc96db209
Rubocop: fix additional violations in todo file (#9218) 2020-07-09 10:25:44 -04:00
rhymes
5b62811c98
[deploy] Rubocop: fix violations of Layout/LineLength (#9197) 2020-07-08 08:36:36 -05:00
Raphael Noriode
1a4dba2475
API: Fetch article by slug (#8929)
* Add check to id param to use slug if passed

* modify to use slug in a different action

* wrote test for this api endpoint

* update test to check array equality
the test also checks if the first tag in the parsed list is the same as the first tag in the article
2020-07-01 10:58:45 +02:00
Michael Kohl
b06e9901d5
Add ApplicationRecord#errors_as_sentence (#8265)
* Add ApplicationRecord#errors_as_sentence

* Refactor existing uses

* Use errors as sentence more consistently
2020-06-04 16:02:41 +02:00
Joe Doss
6406b0727b
Allow localhost or 127.0.0.1 to access api/health_checks without health-check-token (#8231)
* This change allows access to api/health_checks if you are coming from localhost
or 127.0.0.1. Pretty sweet huh?

The reason for this change is because I want to easily get to these healthcheck
end points from localhost without having to get the health-check-token beforehand.

Buttttt.... this addition has some issues. You can spoof the host header pretty
easily:

https://daniel.haxx.se/blog/2018/04/05/curl-another-host/

I thought about doing `return if !request.ssl? && request.local?`

to check of the request was over https or not. Any localhost healthcheck we do
directly to puma will be over http. Checking for TLS seemed like a logical next
check, but since we force https on the edge and not necessarily from the edge to
Puma the Host header can still be spoofed to get at these end points.

More info on host header attacks and what Rails 6 is doing about it:

https://github.com/rails/rails/issues/29893

While I do think it is a good idea to protect these healthcheck end points from
the outside world, I do want to be able to get to them easily locally. WWYD?

* Fix Health Check spec by stubbing request

Co-authored-by: mstruve <mollylbs@gmail.com>
2020-06-02 11:29:04 -04:00
Molly Struve
eda0a78d47
Add Health Check Endpoint for Cache (#8222) 2020-06-01 15:19:56 -05:00
Molly Struve
8a4c2c1cb4
[deploy] Add App, Database, and Search Health Check Endpoints (#8071) 2020-05-28 08:33:31 -05: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
Andy Zhao
c42fd3461e
[deploy] Rename positive_reactions_count to public_reactions_count in logic (#7926)
* Rename positive_reactions_count to public_reactions_count

* Add positive reactions count back in so we can remove it

* Use public_category method for reactions

* Add positive_reactions_count in case any old caches rely on it

* Add positive_rxn_count to account for API endpoints

* Remove unused method

* One more spot...

* Add method back in because of caches

* Update specs to match new functionality

* Fix typo

* Remove unused methods
2020-05-26 12:36:28 -04:00
Mac Siri
321b24d2a0
[deploy] Create write_articles oauth scope (#7834) 2020-05-14 09:55:53 -04:00
Molly Struve
ba0ebbafa8
[deploy] RateLimit Refactor: Consolidate Logic for Checking a Limit and Raising an Error (#7636) 2020-05-01 13:31:44 -05: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
rhymes
0186fd9aee
Add Retry-After for API rate limit errors and document limits in API spec (#7444)
* Add correct rate limit exception to Articles::Updater

* Send Retry-After with HTTP 429 back to the client

* Update API specs for error 429

* Test build

* Fix spec

* Add retry after to ImageUploadsController and fix specs

* Generalize a bit
2020-04-24 17:35:28 +02:00