mirror of https://github.com/mastodon/mastodon
Add option to not consider word boundaries when processing keyword filtering (#7975)
* Add option to not consider word boundaries when filtering phrases * Add a few tests for keyword/phrase filteringpull/7987/head
parent
451e585b97
commit
1ca4e51eb3
@ -1,6 +1,6 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class REST::FilterSerializer < ActiveModel::Serializer
|
||||
attributes :id, :phrase, :context, :expires_at,
|
||||
attributes :id, :phrase, :context, :whole_word, :expires_at,
|
||||
:irreversible
|
||||
end
|
||||
|
@ -0,0 +1,17 @@
|
||||
require Rails.root.join('lib', 'mastodon', 'migration_helpers')
|
||||
|
||||
class AddWholeWordToCustomFilter < ActiveRecord::Migration[5.2]
|
||||
include Mastodon::MigrationHelpers
|
||||
|
||||
disable_ddl_transaction!
|
||||
|
||||
def change
|
||||
safety_assured do
|
||||
add_column_with_default :custom_filters, :whole_word, :boolean, default: true, allow_null: false
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
remove_column :custom_filters, :whole_word
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue