You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
mastodon/spec/models
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.
3 years ago
..
admin Refactor and improve tests (#17386) 3 years ago
concerns Add remove from followers api (#16864) 3 years ago
trends Add trending statuses (#17431) 3 years ago
web Fix various typos (#17621) 3 years ago
account_alias_spec.rb
account_conversation_spec.rb
account_deletion_request_spec.rb Change account suspensions to be reversible by default (#14726) 5 years ago
account_domain_block_spec.rb
account_filter_spec.rb Add batch suspend for accounts in admin UI (#17009) 3 years ago
account_migration_spec.rb
account_moderation_note_spec.rb
account_spec.rb Change unapproved and unconfirmed account to not be accessible in the REST API (#17530) 3 years ago
account_statuses_cleanup_policy_spec.rb Fix some flaky tests that randomly failed because of item ordering (#17509) 3 years ago
account_statuses_filter_spec.rb Fix performance of account timelines (#17709) 3 years ago
announcement_mute_spec.rb
announcement_reaction_spec.rb
announcement_spec.rb
appeal_spec.rb Add appeals (#17364) 3 years ago
backup_spec.rb
block_spec.rb
canonical_email_block_spec.rb Add canonical e-mail blocks for suspended accounts (#16049) 4 years ago
conversation_mute_spec.rb
conversation_spec.rb
custom_emoji_category_spec.rb
custom_emoji_filter_spec.rb
custom_emoji_spec.rb
custom_filter_keyword_spec.rb Revamp post filtering system (#18058) 3 years ago
custom_filter_spec.rb
device_spec.rb
domain_allow_spec.rb
domain_block_spec.rb
email_domain_block_spec.rb Change e-mail domain blocks to block IPs dynamically (#17635) 3 years ago
encrypted_message_spec.rb
export_spec.rb
favourite_spec.rb
featured_tag_spec.rb
follow_recommendation_suppression_spec.rb Add cold-start follow recommendations (#15945) 4 years ago
follow_request_spec.rb Fix edge case where accepted follow cannot be processed because of follow limit (#16098) 4 years ago
follow_spec.rb Fix follow limit preventing re-following of a moved account (#14207) 4 years ago
home_feed_spec.rb Fix single Redis connection being used across all threads (#18135) 3 years ago
identity_spec.rb
import_spec.rb Fix follow limit preventing re-following of a moved account (#14207) 4 years ago
invite_spec.rb Change account suspensions to be reversible by default (#14726) 5 years ago
ip_block_spec.rb Add IP-based rules (#14963) 5 years ago
list_account_spec.rb
list_spec.rb
login_activity_spec.rb Add authentication history (#16408) 4 years ago
marker_spec.rb
media_attachment_spec.rb Fix edits with no actual changes being allowed (#17843) 3 years ago
mention_spec.rb
mute_spec.rb
notification_spec.rb Improved performance of notification preloading (#15640) 4 years ago
one_time_key_spec.rb
poll_spec.rb
poll_vote_spec.rb
preview_card_spec.rb
public_feed_spec.rb Refactor and improve tests (#17386) 3 years ago
relationship_filter_spec.rb
relay_spec.rb
remote_follow_spec.rb
report_filter_spec.rb
report_spec.rb Change how changes to media attachments are stored for edits (#17696) 3 years ago
rule_spec.rb Add server rules (#15769) 4 years ago
scheduled_status_spec.rb
session_activation_spec.rb Add Ruby 3.0 support (#16046) 4 years ago
setting_spec.rb Update Mastodon to Rails 6.1 (#15910) 4 years ago
site_upload_spec.rb
status_edit_spec.rb Add support for editing for published statuses (#16697) 3 years ago
status_pin_spec.rb Add support for private pinned posts (#16954) 3 years ago
status_spec.rb Fix performance of account timelines (#17709) 3 years ago
status_stat_spec.rb
system_key_spec.rb
tag_feed_spec.rb Fix typo in tag_feed_spec.rb (#16466) 4 years ago
tag_spec.rb Improve tag search query (#16104) 4 years ago
unavailable_domain_spec.rb
user_invite_request_spec.rb
user_spec.rb Add test for user matching ip (#17572) 3 years ago
webauthn_credentials_spec.rb Fix validates :sign_count of WebauthnCredential (#14806) 5 years ago
webhook_spec.rb Add administrative webhooks (#18510) 3 years ago