This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
mastodon/spec/controllers
Claire 02851848e9
Revamp post filtering system (#18058)
* Add model for custom filter keywords

* Use CustomFilterKeyword internally

Does not change the API

* Fix /filters/edit and /filters/new

* Add migration tests

* Remove whole_word column from custom_filters (covered by custom_filter_keywords)

* Redesign /filters

Instead of a list, present a card that displays more information and handles
multiple keywords per filter.

* Redesign /filters/new and /filters/edit to add and remove keywords

This adds a new gem dependency: cocoon, as well as a npm dependency:
cocoon-js-vanilla. Those are used to easily populate and remove form fields
from the user interface when manipulating multiple keyword filters at once.

* Add /api/v2/filters to edit filter with multiple keywords

Entities:
- `Filter`: `id`, `title`, `filter_action` (either `hide` or `warn`), `context`
  `keywords`
- `FilterKeyword`: `id`, `keyword`, `whole_word`

API endpoits:
- `GET /api/v2/filters` to list filters (including keywords)
- `POST /api/v2/filters` to create a new filter
  `keywords_attributes` can also be passed to create keywords in one request
- `GET /api/v2/filters/:id` to read a particular filter
- `PUT /api/v2/filters/:id` to update a new filter
  `keywords_attributes` can also be passed to edit, delete or add keywords in
   one request
- `DELETE /api/v2/filters/:id` to delete a particular filter
- `GET /api/v2/filters/:id/keywords` to list keywords for a filter
- `POST /api/v2/filters/:filter_id/keywords/:id` to add a new keyword to a
   filter
- `GET /api/v2/filter_keywords/:id` to read a particular keyword
- `PUT /api/v2/filter_keywords/:id` to edit a particular keyword
- `DELETE /api/v2/filter_keywords/:id` to delete a particular keyword

* Change from `irreversible` boolean to `action` enum

* Remove irrelevent `irreversible_must_be_within_context` check

* Fix /filters/new and /filters/edit with update for filter_action

* Fix Rubocop/Codeclimate complaining about task names

* Refactor FeedManager#phrase_filtered?

This moves regexp building and filter caching to the `CustomFilter` class.

This does not change the functional behavior yet, but this changes how the
cache is built, doing per-custom_filter regexps so that filters can be matched
independently, while still offering caching.

* Perform server-side filtering and output result in REST API

* Fix numerous filters_changed events being sent when editing multiple keywords at once

* Add some tests

* Use the new API in the WebUI

- use client-side logic for filters we have fetched rules for.
  This is so that filter changes can be retroactively applied without
  reloading the UI.
- use server-side logic for filters we haven't fetched rules for yet
  (e.g. network error, or initial timeline loading)

* Minor optimizations and refactoring

* Perform server-side filtering on the streaming server

* Change the wording of filter action labels

* Fix issues pointed out by linter

* Change design of “Show anyway” link in accordence to review comments

* Drop “irreversible” filtering behavior

* Move /api/v2/filter_keywords to /api/v1/filters/keywords

* Rename `filter_results` attribute to `filtered`

* Rename REST::LegacyFilterSerializer to REST::V1::FilterSerializer

* Fix systemChannelId value in streaming server

* Simplify code by removing client-side filtering code

The simplifcation comes at a cost though: filters aren't retroactively
applied anymore.
2022-06-28 09:42:13 +02:00
..
activitypub Spelling (#17705) 2022-03-06 22:51:40 +01:00
admin Fix test-related issues (#17888) 2022-03-28 12:43:58 +02:00
api Revamp post filtering system (#18058) 2022-06-28 09:42:13 +02:00
auth Fix suspicious sign-in mails never being sent (#18599) 2022-06-21 15:16:22 +02:00
concerns Fix single Redis connection being used across all threads (#18135) 2022-04-28 17:47:34 +02:00
disputes Add appeals (#17364) 2022-02-14 21:27:53 +01:00
oauth Bump doorkeeper from 5.3.3 to 5.4.0 (#13733) 2020-05-12 15:25:33 +02:00
settings Remove unused `filtered_languages` column (#18533) 2022-05-27 20:05:22 +02:00
well_known Remove Keybase integration (#17045) 2021-11-26 05:58:18 +01:00
about_controller_spec.rb
account_follow_controller_spec.rb Add support for reversible suspensions through ActivityPub (#14989) 2020-11-08 00:28:39 +01:00
account_unfollow_controller_spec.rb Add support for reversible suspensions through ActivityPub (#14989) 2020-11-08 00:28:39 +01:00
accounts_controller_spec.rb Spelling (#17705) 2022-03-06 22:51:40 +01:00
application_controller_spec.rb Spelling (#17705) 2022-03-06 22:51:40 +01:00
authorize_interactions_controller_spec.rb Refactor and improve tests (#17386) 2022-01-28 00:46:42 +01:00
emojis_controller_spec.rb
follower_accounts_controller_spec.rb Add `/api/v1/accounts/familiar_followers` to REST API (#17700) 2022-03-07 09:36:47 +01:00
following_accounts_controller_spec.rb Add `/api/v1/accounts/familiar_followers` to REST API (#17700) 2022-03-07 09:36:47 +01:00
home_controller_spec.rb Change routing paths to use usernames in web UI (#16171) 2021-09-26 05:46:13 +02:00
instance_actors_controller_spec.rb Fix instance actor not being dereferenceable (#17457) 2022-02-06 15:31:03 +01:00
intents_controller_spec.rb
invites_controller_spec.rb
manifests_controller_spec.rb
media_controller_spec.rb Fix error when rendering public pages with media attachments (#16763) 2021-10-13 15:27:19 +02:00
media_proxy_controller_spec.rb Fix media attachments enumeration (#14254) 2020-07-07 15:26:51 +02:00
relationships_controller_spec.rb Remove PubSubHubbub-related columns from accounts table (#16170) 2021-05-07 19:32:58 +02:00
remote_follow_controller_spec.rb Add support for reversible suspensions through ActivityPub (#14989) 2020-11-08 00:28:39 +01:00
remote_interaction_controller_spec.rb
shares_controller_spec.rb
statuses_cleanup_controller_spec.rb Add feature to automatically delete old toots (#16529) 2021-08-09 23:11:50 +02:00
statuses_controller_spec.rb Spelling (#17705) 2022-03-06 22:51:40 +01:00
tags_controller_spec.rb