Commit graph

809 commits

Author SHA1 Message Date
Molly Struve
addec4b72d
Group all BANNED errors in Honeybadger (#5027) [deploy] 2019-12-06 10:59:27 -06:00
Molly Struve
8097b7f8cb Group SIGTERM fetch_all_rss rake task Honeybadgers together (#5021) [deploy] 2019-12-05 17:38:35 -05:00
Molly Struve
ce1bc8d2a4
Revert "Setup dual Redis store for rolling over fragment cacheing to Redis (#4991)" (#5014) [deploy]
This reverts commit e871a01c01.
2019-12-05 14:03:41 -06:00
Molly Struve
e871a01c01
Setup dual Redis store for rolling over fragment cacheing to Redis (#4991) [deploy] 2019-12-05 13:19:01 -06:00
Molly Struve
834eb51e98
Replace Airbrake with Honeybadger (#5007) [deploy] 2019-12-05 11:29:51 -06:00
John Curcio
02c2a0808f Add publication date to medium liquid tag (#4961) (#5002) [deploy]
* Add publication date to medium liquid tag

* Add time tag to publication date and fix timezone issue
2019-12-05 11:19:10 -05:00
rhymes
62edf443f3 Add FKs to notifications_subscriptions, page_views and users_roles (#4999) [deploy] 2019-12-04 10:14:57 -06:00
Anna Buianova
c5cb526cdd Specify on_duplicate_key_update when creating notifications to avoid constraint violation (#4993) [deploy] 2019-12-03 16:24:46 -05:00
Mac Siri
2ee4e703eb
Remove disable_indented_code_blocks (#4988) [deploy]
We have decided enable indented-code-block because it is an expected
markdown feature. The trade-off here is that backticks will cause
rendering issues in codeblock.
2019-12-03 13:04:53 -05:00
rhymes
e62f5ada21 Add missing fks to api_secrets, listings and identities (#4997) [deploy] 2019-12-03 10:59:13 -06:00
rhymes
d76c914f68 Set default Fastly Rails caching back to 30 days (#4996)
* Set default Fastly Rails caching back to 30 days

* Update reactions spec to use Fastly values instead of harcoded ones
2019-12-03 11:29:25 -05:00
Ben Halpern
585d672742
Replace serviceworker-rails gem with custome implementation (#4987) [deploy]
* Customize UserContext in Timber logs

* Replace serviceworker-rails gem with custome implementation
2019-12-03 08:50:56 -05:00
Anna Buianova
bff6cd6985 Fix podcast episode validation error (#4967) [deploy]
* Started fixing podcast episode bug

* Fix the specs for create podcast episode
2019-11-29 16:16:19 -05:00
Anna Buianova
cfd5434d6c User deletion by email (#4863) [deploy]
* Action to request account deletion by email

* Confirmation page for user destroy

* Remove some of the old destroy user code

* System tests for user destroy

* Moved user destroy tokens to redis

* Change tests according to the new user destroy token storage (in redis)

* Added info about the link to user delete confirmation email

* Remove blank like from schema.rb

* Delete user destroy token on user delete

* Update confirm user destroy js
2019-11-29 13:47:11 -05:00
jeffin sam
f023a00d9f add html_css_to_image to RedisRailsCache (#4753) [deploy] 2019-11-28 09:44:31 -05:00
Ben Halpern
b938dab91b
Add ApplicationMetalController to relevant controllers (#4937)
* Add ApplicationMetalController to relevant controllers

* Add request forgery protection to metal

* Remove logger call

* Add logger keyword and skip protect_from_forgery in test

* Uncomment main_image in test
2019-11-26 16:29:07 -05:00
rhymes
87116dcc56 Increase efficiency in models/article_spec.rb (#4882) [deploy]
* Add test sampler

* Use let! and let_it_be for article_spec.rb

* Regroup and restructure expectations and tests

* Move private methods in private

* Decrease the needed objects in .seo_boostable test

* Re-use the user

* Newlined
2019-11-26 10:32:39 -05:00
Anthony Musyoki
2537670968 Refactor raise_error(specific_error) expectation (#4912)
* Refactor raise_error(specific_error) expectation

The full RSpec warining is
```
WARNING: Using `expect { }.not_to raise_error(SpecificErrorClass)` risks false positives,
since literally any other error would cause the expectation to pass,
including those raised by Ruby (e.g. NoMethodError, NameError and ArgumentError),
meaning the code you are intending to test may not even get reached.
Instead consider using `expect { }.not_to raise_error` or `expect { }.to raise_error(DifferentSpecificErrorClass)`.
```

* Refactor jsitor tests to test behaviour

As pointed out by @rhymes, the previous tests were not
testing actual behaviour. This is an attempt at improving the tests.
2019-11-26 08:46:33 -05:00
Ben Halpern
4dabe265c6
Fix linting (#4933) [deploy] 2019-11-26 08:35:34 -05:00
Ben Halpern
befefd08d0
Remove extra dependencies for PageViewsController (#4923) [deploy]
* Remove extra dependencies for PageViewsController

* Fix strongparams and fix typo

* Fix spec

* Remove unnecessary page_view param

* Remove additional unnecessary page_view

* Create ApplicationMetalController for shared Metal behavior

* Revert rand numbers to ensure apples-to-apples perf compare

* Whoops, revert change revert

* Clarify comment
2019-11-25 19:06:34 -05:00
rhymes
213e7bebab Routine rubocop fixes (#4924)
Ran rubocop -a and rubocop --auto-gen-config
2019-11-25 14:13:22 -05:00
Jacob Herrington
d2112adcbf Delete a commented out system spec (#4905)
This test was commented out, but I don't see much information in the
commit message as to why. The Pull Request which this commit was merged
from seems to be lost as well.

This test does seem to pass when it's not commented out, but there must
have been a reason it was commented out.

That being said, the test isn't really *testing* much functionality.
Essentially, it just asserts that a page with the word "settings" on it
renders from several different approaches. This might be problematic
because a false positive would be quite easy.

In light of those things, it makes sense to me that this test should be
removed.
2019-11-25 08:20:13 -05:00
Molly Struve
091392cf1f Remove webpush gem and code (#4883) 2019-11-22 16:46:11 -05:00
Spencer
e5ee2f9013 Mod tooling: add tags via /mod (#4750) [deploy]
* added tests to specs

* added view logic

* added controller/model functionality

* minor tweak to tagadjustment view

* adjusted mod view to reduce query

* added instance variables to controller

* show already adjusted tags in mod view

* removed unnecessary ifs from mods controller

* catch and display errors to tag adjustment forms

* update specs and refactor
2019-11-21 16:32:32 -05:00
Jacob Herrington
10426fbef5 Delete a commented out test (#4875) 2019-11-21 15:14:12 -05:00
John Curcio
157a6f1ef1 Add pagination to followers and following page in dashboard (#258) (#4375) [deploy]
* Add infinite scroll to followers list (#258)

* Refactor fetchNext function for clarity (#258)

* Sepparate following tab into multiple tabs to support infinite scroll (#258)

* Add infinite scroll to following pages (#258)

* Add tests to infinite scroll api

* Refactor dashboard loading text

* Refactor infine scroll function

* Fix duplicated entries problem in infinite scrolling

* Switch randomized attributes to sequential to avoid InvalidRecord error

* Add acceptance tests for infinite scroll

* Remove unused following method

* parameterize limit per page for followers and followings

* Split follows endpoint into followers and followings

* Authenticate user with api key in followers and followings

* Split followers endpoint into users and organizations

* Add redundant html to sublist partial

* Speed up infinite scroll tests

* Refactor api json responses to use partials

* Authenticate api user before follows create

* Resolve conflicts on scrolling js

* Improve partials organization and fix organization username bug

* Improve readability of unauthorized test

* Use let! to create scrolling test data

* Fix not working podcasts link

* Refactor initScrolling to remove linting errors

* Fix codeclimate coding style issue

* Test tags forms and podcasts hyperlinks

* Fix eslint issue with double equals

* Improve before_action usage and readability
2019-11-20 18:21:18 -05:00
Helmi Hidzir
4e4762e3a1 Add - to support dash character in JSitor liquid tag (#4830) [deploy]
* Add - to support dash character in JSitor liquid tag

* Edit spec/liquid_tags/jsitor_tag_spec.rb

* Add support for link with hyphen id in jsitor liquid tag
2019-11-20 13:36:51 -05:00
rhymes
0ef4ce4250 Adjust type tags for RSpec (#4864) 2019-11-20 13:01:30 -05:00
rhymes
b0eec90b24 Add additional keys to site configuration (#4861) [deploy]
* Add rate_limit_follow_count_daily to SiteConfig

* Add favicon_url to SiteConfig

* Add logo_svg to SiteConfig

* Add staff_user_id to SiteConfig

* Add default_site_email to SiteConfig

* Add social_networks_handle to SiteConfig

* Add ga_view_id and ga_fetch_rate to SiteConfig

* Add mailchimp newsletters IDs to SiteConfig

* Add periodic_email_digest_max, periodic_email_digest_min to SiteConfig
2019-11-20 10:58:10 -05:00
rhymes
c15d48265a Routine rubocop fixes (#4859) 2019-11-19 10:46:47 -05:00
Keith Bennett
b9069a2feb Simplify sort tests in user_sorts_dashboard_articles_spec.rb (#4841) [deploy]
* Simplify sort tests.

* Rename some identifiers.
2019-11-18 18:52:30 -05:00
rohan-techfreak
bf867a624a Add lazy loading to iframes (#4673) 2019-11-18 18:31:56 -05:00
rhymes
c1aaf53a40 Add SiteConfig to internal and enable "main_social_image" (#4831) [deploy]
* Redirect /internal to /internal/articles avoiding annoying 404

* Set the navbar on two rows

* Add :main_social_image to SiteConfig and to the internal view

* Add simple tests

* Ameliorate the UI
2019-11-18 18:19:20 -05:00
aRtoo
9b5b2ee98d Redo JSitor (#4762) [deploy]
* Redo JSitor
- can now accept full url with params
- added more test
- redo jsitor guide

* Jsitor redo guide
- moved below JSFiddle
- add more instructions

* Refactor JSitor liquid tag
- Change the iframe size to 400
- can accept ID with or without params
- added ID_REGEX to check for id
- add more information on error
- added more test
  - test for id with invalid link
  - test for id with params
  - test for id without params

* Refactor
- simplified regex, removed unnecessary groupings
- changed method name from link_valid? to validate_link
- changed error message
2019-11-14 09:17:47 -05:00
Anna Buianova
41ab013050 Normalize podcast url before checking for reachability (#4806)
* Normalize podcast url before checking for reachability

* Added to_s when normalizing episode url and simplified tests
2019-11-14 08:58:29 -05:00
Michael Kohl
b57ced5466 CacheBuster refactoring (#4766)
* Turn CacheBuster into a module

This class used no internal state, so repeatedly creating short-lived objects seems wasteful.

* Consistently use string interpolation and parenthesis

* Destructure arrays into meaningful names, formatting

* Fix request spec for internal classified listings controller

Interestingly this works when asserting directly on the module, but not on a double.
Asserting directly in the module seems sufficient for this test so the indirection
was removed.

* Turn CacheBuster into a module

This class used no internal state, so repeatedly creating short-lived objects seems wasteful.

* Fix specs after rebasing
2019-11-13 10:51:23 -05:00
Andy Zhao
b2e18aeb72 Use Redis for session storage (#4004) [deploy]
* WIP use redis-session-store for sessions

* Use Redis as session storage

* Add redis-server to Travis

* Use integer for SESSION_EXPIRY_SECONDS env variable

Co-Authored-By: rhymes <rhymesete@gmail.com>

* Remove sessions b/c no custom sessions logic

* Use ApplicationConfig instead

* Rename default value

* Remove rememberable module

* Persist the user for the test

* Remove remember_me related tests

* Revert 'undo remember_me' commits

* Add redis to procfile

* Cleanup devise configuration

* Move REDIS configuration in the basic configuration section

* Make sure the expiration time can't zero

* Restore old order and remove useless comment line

* Delete legacy session cookie after login

Once deployed the server will start using the new session cookie, this makes sure the legacy one is deleted on the user's browser

* Remove redis from Procfile

* Add signed, secure and httponly to the Redis session cookie
2019-11-12 10:10:34 -06:00
Anna Buianova
8c58be75f5 Self-deleting user account (#4480) [deploy]
* Start with self deleting account

* Moved deleting user content and activity out of moderator hierarchy

* Added tests for the users delete services

* Tests for Users::DeleteComments

* User self-deletion (start)

* Some tests for user self-delete

* Specs for user self-deletion

* Test flash settings on users delete

* Added basic specs for the Users::DeleteJob

* Send notification when a user was destroyed

* Rename Users::DeleteJob to SelfDelete

* Change texts about self-deletion

* Fix users delete job spec

* Rescue and log exceptions while self-deleting user

* Added visible flash notices after deleting user

* Remove unneeded css for flash notice

* Fix link to a ghost account

* Remove redundant css

* Added github and twitter oauth apps links
2019-11-11 14:59:01 -05:00
rhymes
80ab485eb6 Fix http status code for rate limiting (#4742) 2019-11-07 14:11:11 -05:00
Ben Halpern
4a69ac8073 Add more randomness to factories (#4739) 2019-11-07 13:57:27 -05:00
rhymes
40155812bd Comments API: simplify controller code, add tests (#4731) [deploy]
* Use ancestry in the index and add test

* Add tests for show action
2019-11-07 11:37:58 -05:00
Ben Halpern
fc1239b21d
Remove follow limit for single request (#4738) 2019-11-06 18:17:40 -05:00
Omar Bahareth
dca66bd6a8 Rate limit daily user follows to 500 (#4647) [deploy]
* Rate limit daily user follows to 500 per day
Return an error in `POST /follows` JSON response when a user tries to follow more than 500 accounts in a single day.

Other Changes:
- Add a spec for follows#create.

* Turn daily account follow limit into an env var

* Avoid executing today follow count query when possible
user.following_users_count is a counter cache on how many users the person is already following, so if it's less than the limit we don't need to run the query and can just return it instead.

* Simplify today follow count query
Stop needlessly checking into the future, only check from the beginning of the day until now.

* Raise account follow limit error if followable_id count is over limit
Other changes:
- Always return JSON, the `respond_to` block from before was unnecessary since this endpoint always returns JSON.
- Rescue `DailyFollowAccountLimitReached` on the method and remove begin block, since the error can be raised from two places in the same method.

* Index created_at on users table

* Make adding created_at index on users table happen concurrently

* Rename DAILY_ACCOUNT_FOLLOW_LIMIT to RATE_LIMIT_FOLLOW_COUNT_DAILY

* Add RATE_LIMIT_FOLLOW_COUNT_DAILY to Envfile

* Move RATE_LIMIT_FOLLOW_COUNT_DAILY from env var to ApplicationConfig
2019-11-06 16:24:43 -05:00
rianadon
47ca9b5139 Wrap <figcaption> elements and content inside <figure> elements (#4645) 2019-11-06 15:05:45 -05:00
Colby Melvin
4531679c23 fix tag input swallowing numeric keycodes [deploy] (#4283)
* fix tag input swallowing numeric keycodes

* add AR validation for Tags class

* allow whitespace in Tag.name

* fix specs

* whitespace

* reformat
2019-11-05 16:20:34 -05:00
Mike Rogers
cf475779d0 Setting width & height attributes to SVGs on articles#show page (#4705)
* Adding spec around adding width/height to images

* Adding width/height to svgs on article page

* Improving the englishing of the test description

* Re-read final test description, this felt the clearest

* Just checking attriutes are present - not to fussed about much else
2019-11-05 13:13:44 -05:00
aRtoo
b421ad908b Add JSitor liquid tag (#4657) [deploy]
* Request change
- Added specific error message
- changed jsitor to JSitor
- changed JSITOR_URL constant to URL_REGEXP
- added space between URL_REGEXP and initialize method

* created jsitor liquid tag
- created a jsitor_tag.rb for jsitor liquid core
- created partial (_jsitor.html.erb) for jsitor liquid tag

* created test for jsitor liquid tag
- created spec for jsitor liquid tag
- generated jsitor_liquid_tag.approved.html

* added suggestion change
- removed regex
- change the full link to embeddable id
- removed dead code(methods) due to change logic
- removed checking of link since embeddable id will be parse as string
- removed parts of the test
- change the guide explanation

* Added lazy loading on iframe
2019-11-05 09:43:52 -05:00
Andy Zhao
85d8f52789 Hide a blocked user's content [deploy] (#4678)
* Hide blocked users' content appropriately

* Use RESTful create route

* Update functionality to block the user

* Fix specs for new route

* Use const instead of var

* Add noopener and noreferrer

* Remove caching for blocked user ids

* Add new rule for lack of noopener noreferrer

* Update snapshot
2019-11-04 14:47:26 -05:00
rhymes
027dbb027b Return 401 instead of 500 when a channel is blocked (#4721) 2019-11-04 10:39:18 -05:00
Molly Struve
00e3ee811b Use ActiveSupport::Cache::RedisCacheStore As RedisRailsCache (#4676) [deploy] 2019-11-01 12:19:12 -04:00