mastodon/app/javascript/mastodon/components
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
..
__tests__ Change custom emoji to be animated when hovering container (#15637) 2021-01-31 21:25:31 +01:00
admin Add a hashtag public link to the trending hashtag page (#17140) 2022-03-26 02:52:51 +01:00
edited_timestamp Add edit history to web UI (#17390) 2022-02-09 01:17:07 +01:00
account.js Fix block/mute lists showing a follow button when unblocking a user (#18364) 2022-05-09 23:20:19 +02:00
animated_number.js Add pop-out player for audio/video in web UI (#14870) 2020-09-28 13:29:43 +02:00
attachment_list.js Fix crash if a notification contains an unprocessed media attachment (#16573) 2021-08-11 17:49:10 +02:00
autosuggest_emoji.js Change how CDN_HOST is passed down to make assets build reproducible (#14381) 2020-10-13 01:19:35 +02:00
autosuggest_hashtag.js Replace shortNumberFormat with <ShortNumber> (#14061) 2020-07-06 14:27:32 +02:00
autosuggest_input.js Fix default searchTokens (#15775) 2021-02-22 11:26:08 +01:00
autosuggest_textarea.js Change RTL detection to rely on unicode-bidi paragraph by paragraph (#14573) 2020-12-15 12:56:43 +01:00
avatar.js Add `limited` attribute to accounts in REST API and a warning in web UI (#18344) 2022-05-10 09:44:35 +02:00
avatar_composite.js Change conversations UI (#11896) 2019-09-21 20:01:16 +02:00
avatar_overlay.js
blurhash.js Improve safety of Blurhash component (#14278) 2020-07-09 22:32:36 +02:00
button.js Fix logo button style (#15428) 2020-12-26 23:50:34 +01:00
check.js Change report modal to include category selection in web UI (#17565) 2022-02-23 20:03:46 +01:00
column.js Bump detect-passive-events from 1.0.5 to 2.0.1 (#15003) 2020-11-05 02:21:05 +09:00
column_back_button.js Fix crash when switching back/from mobile layout (#11655) 2019-08-25 15:49:02 +02:00
column_back_button_slim.js Refactor icons in web UI to use Icon component (#9951) 2019-02-01 00:14:05 +01:00
column_header.js Improve hover and focus style in columns settings (#16222) 2021-10-01 00:55:51 +02:00
common_counter.js Change "Direct" status visibility to "Only people I mention" in web UI (#18146) 2022-04-29 00:24:31 +02:00
display_name.js Change custom emoji to be animated when hovering container (#15637) 2021-01-31 21:25:31 +01:00
domain.js Change the string "hidden" to "blocked" in WebUI (#13221) 2020-03-09 09:13:21 +01:00
dropdown_menu.js Add edit history to web UI (#17390) 2022-02-09 01:17:07 +01:00
error_boundary.js Add paragraph about browser add-ons when encountering some errors (#14801) 2020-09-14 15:05:22 +02:00
gifv.js Fix click range discrepancies in gifv (#14615) 2020-08-23 00:08:12 +02:00
hashtag.js Add explore page to web UI (#17123) 2022-02-25 00:34:33 +01:00
icon.js Refactor icons in web UI to use Icon component (#9951) 2019-02-01 00:14:05 +01:00
icon_button.js Add notifications for new reports (#18697) 2022-06-27 09:30:15 +02:00
icon_with_badge.js Fix browser notification permission request logic (#13543) 2020-10-13 00:37:21 +02:00
inline_account.js Add edit history to web UI (#17390) 2022-02-09 01:17:07 +01:00
intersection_observer_article.js Change references to tootsuite/mastodon to mastodon/mastodon (#16491) 2021-07-13 15:46:20 +02:00
load_gap.js Refactor icons in web UI to use Icon component (#9951) 2019-02-01 00:14:05 +01:00
load_more.js
load_pending.js Add option to disable real-time updates in web UI (#9984) 2019-07-16 06:30:47 +02:00
loading_indicator.js Fix various typos (#17621) 2022-02-22 20:14:17 +01:00
logo.js Change onboarding by replacing tutorial with follow recommendations in web UI (#16060) 2021-04-19 14:45:15 +02:00
media_attachments.js Add polls and media attachments to edit comparison modal in web UI (#17727) 2022-03-09 21:15:24 +01:00
media_gallery.js Make media_gallery.toggle_visible less confusing to translate (#15993) 2021-05-08 01:56:40 +02:00
missing_indicator.js Fix performance of home feed regeneration (#12084) 2019-10-06 22:11:17 +02:00
modal_root.js Fix reply button on media modal not giving focus to compose form (#17626) 2022-02-25 00:51:01 +01:00
permalink.js
picture_in_picture_placeholder.js Add pop-out player for audio/video in web UI (#14870) 2020-09-28 13:29:43 +02:00
poll.js Add single option votes tooltip in polls (#16849) 2021-10-13 04:59:31 +02:00
radio_button.js Add profile directory to web UI (#11688) 2019-08-30 00:14:36 +02:00
regeneration_indicator.js fix component name (#16138) 2021-05-03 14:59:49 +02:00
relative_timestamp.js Add edit history to web UI (#17390) 2022-02-09 01:17:07 +01:00
scrollable_list.js Spelling (#17705) 2022-03-06 22:51:40 +01:00
setting_text.js
short_number.js Replace shortNumberFormat with <ShortNumber> (#14061) 2020-07-06 14:27:32 +02:00
skeleton.js Add graphs and retention metrics to admin dashboard (#16829) 2021-10-14 20:44:59 +02:00
status.js Revamp post filtering system (#18058) 2022-06-28 09:42:13 +02:00
status_action_bar.js Revamp post filtering system (#18058) 2022-06-28 09:42:13 +02:00
status_content.js Add lang html attr to each posts (#18544) 2022-05-28 15:50:36 +02:00
status_list.js Add explore page to web UI (#17123) 2022-02-25 00:34:33 +01:00
timeline_hint.js Add hints about incomplete remote content to web UI (#14031) 2020-06-14 22:29:40 +02:00