* 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