* 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
* 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
* 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
* 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
* De-duplicate giphy_img? function in favor of a tested service.
Add a tested `GiphyService` and move `giphy_img?` function to it.
Make `labor/markdown_parser.rb` and `models/html_variant.rb` use the service version of the function.
* Refactor GiphyService into Giphy::Image class
Based on comments from @rhymes, I've changed this into a `Giphy::Image` class sincethe repo is currently being moved away from `XYZService` objects for namespacing and organization purposes.
* Fix typo
Update describe case to mention the current method name.
* added a condition to check if owner of the comment is in mentions
* added a test to check if comment owner can mention self
* fixed metion test by:
- adding a second user to simulate a owner of a comment
- change the user on comment to owned by newly created user
* Add specs for ArticleImageUploader
* Add specs for BadgeUploader
* Add specs for CoverImageUploader
* Add specs for ProfileImageUploader
* Refactor uploaders to inherit from BaseUploader
* Strip EXIF and GPS data from uploaded images
* Add ImageMagick to the docs
* Protect strip_exif
* Run Inspecting 1050 files
....................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................C.....................................................................................................................................................................................................................................................................................................
Offenses:
spec/models/article_spec.rb:195:7: C: RSpec/NestedGroups: Maximum example group nesting exceeded [4/3]. (http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/NestedGroups)
context "when description is empty" do
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1050 files inspected, 1 offense detected to fix autofixable errors
* Refactor to correct test
it was braking the rule RSpec/NestedGroups: Maximum example group nesting exceeded [4/3]. (http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/NestedGroups)
* Run `rubocop --auto-gen-config` to regenrate `.rubocop_todo.yml`
* Initial changes for some new themes/fonts/etc.
* Add basic navbar config
* Finalize navbar config
* Make config_navbar non nullable
* Add dark_theme? to user decorator
* Prevent need for eager loading
* Add initial implementation of user block
* Remove debugger oops
* Add index and foreign keys for user_block table
* Use private method instead of exists
* Move channel handling logic to service object
* Update styling a bit
* Use profileDropdown file for future proofing
* Remove commented out code
* Render json: { result } for all endpoints
* Add statuses for sad paths
* Add better sad path handling in the JS
* Remove accidentally committed spec file
* Don't wait for DOM to load block button
* Use equality for accuracy in slug query
* Add status code for unauthorized requests
* Add missing comma sigh
* Regenerate rubocop todo
* Fix outstanding problems
* Fix Style/FormatStringToken
* Final update to rubocop todo file
* Set RSpec/ExampleLength to max 10 and regenerate todo file
* Fix broken job specs
Many job specs were putting their assertions inside a block provided to
ActiveJob's perform_now. Unfortunately, this syntax does not error and
simply ignores the provided block.
The tests were therefore not executing their assertions. As a result
many of them were actually broken to begin with. Many used incorrect
stubbing, were trying to stub instances of models that wouldn't actually
be returned by ActiveRecord queries, etc.
This commit fixes the syntax and does it's best to fix the tests. Many
of these assertions/spec could use more TLC, but this work at least gets
them passing/executing.
* Avoid time comparison precision issues
* Implement review feedback
Adds negative test cases for when record is not found/nil. Also some
formatting changes as I was paying more attention to the rubocop setup
now.
* Add without article context to job spec
* Remove unused lets