hometown/app/controllers/api/v1
aschmitz eeaec39888 Allow hiding of reblogs from followed users (#5762)
* Allow hiding of reblogs from followed users

This adds a new entry to the account menu to allow users to hide
future reblogs from a user (and then if they've done that, to show
future reblogs instead).

This does not remove or add historical reblogs from/to the user's
timeline; it only affects new statuses.

The API for this operates by sending a "reblogs" key to the follow
endpoint. If this is sent when starting a new follow, it will be
respected from the beginning of the follow relationship (even if
the follow request must be approved by the followee). If this is
sent when a follow relationship already exists, it will simply
update the existing follow relationship. As with the notification
muting, this will now return an object ({reblogs: [true|false]}) or
false for each follow relationship when requesting relationship
information for an account. This should cause few issues due to an
object being truthy in many languages, but some modifications may
need to be made in pickier languages.

Database changes: adds a show_reblogs column (default true,
non-nullable) to the follows and follow_requests tables. Because
these are non-nullable, we use the existing MigrationHelpers to
perform this change without locking those tables, although the
tables are likely to be small anyway.

Tests included.

See also <https://github.com/glitch-soc/mastodon/pull/212>.

* Rubocop fixes

* Code review changes

* Test fixes

This patchset closes #648 and resolves #3271.

* Rubocop fix

* Revert reblogs defaulting in argument, fix tests

It turns out we needed this for the same reason we needed it in muting:
if nil gets passed in somehow (most usually by an API client not passing
any value), we need to detect and handle it.

We could specify a default in the parameter and then also catch nil, but
there's no great reason to duplicate the default value.
2017-11-28 15:00:35 +01:00
..
accounts Non-Serial ("Snowflake") IDs (#4801) 2017-10-04 09:56:37 +02:00
apps Fix #5104 - GET /api/v1/apps/verify_credentials to confirm app works (#5112) 2017-09-30 22:05:42 +02:00
lists Lists (#5703) 2017-11-18 00:16:48 +01:00
statuses Pinned statuses (#4675) 2017-08-25 01:41:18 +02:00
timelines Lists (#5703) 2017-11-18 00:16:48 +01:00
accounts_controller.rb Allow hiding of reblogs from followed users (#5762) 2017-11-28 15:00:35 +01:00
apps_controller.rb Fix #5104 - GET /api/v1/apps/verify_credentials to confirm app works (#5112) 2017-09-30 22:05:42 +02:00
blocks_controller.rb Fix pagination in Api::V1::BlocksController (#5285) 2017-10-09 17:30:31 +02:00
custom_emojis_controller.rb Improve admin UI for custom emojis, add copy/disable/enable (#5231) 2017-10-05 23:42:05 +02:00
domain_blocks_controller.rb Clean up for api/base controller (#3629) 2017-06-07 20:09:25 +02:00
favourites_controller.rb Merge queries in Api::V1::FavouritesController (#4359) 2017-07-25 16:01:03 +02:00
follow_requests_controller.rb Refactor JSON templates to be generated with ActiveModelSerializers instead of Rabl (#4090) 2017-07-07 04:02:06 +02:00
follows_controller.rb Fix POST /api/v1/follows error when already following (#4878) 2017-09-10 15:09:06 +02:00
instances_controller.rb Refactor JSON templates to be generated with ActiveModelSerializers instead of Rabl (#4090) 2017-07-07 04:02:06 +02:00
lists_controller.rb Lists (#5703) 2017-11-18 00:16:48 +01:00
media_controller.rb Add ability to specify alternative text for media attachments (#5123) 2017-09-28 15:31:31 +02:00
mutes_controller.rb Refactor JSON templates to be generated with ActiveModelSerializers instead of Rabl (#4090) 2017-07-07 04:02:06 +02:00
notifications_controller.rb Refactor JSON templates to be generated with ActiveModelSerializers instead of Rabl (#4090) 2017-07-07 04:02:06 +02:00
reports_controller.rb Add moderator role and add pundit policies for admin actions (#5635) 2017-11-11 20:23:33 +01:00
search_controller.rb Filter searched toots to be consistent with blocking behaviors (#5383) 2017-11-15 01:53:33 +01:00
statuses_controller.rb Make PreviewCard records reuseable between statuses (#4642) 2017-09-01 16:20:16 +02:00
streaming_controller.rb Clean up for api/base controller (#3629) 2017-06-07 20:09:25 +02:00