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 filtering
This commit is contained in:
parent
451e585b97
commit
1ca4e51eb3
9 changed files with 61 additions and 11 deletions
17
db/migrate/20180707154237_add_whole_word_to_custom_filter.rb
Normal file
17
db/migrate/20180707154237_add_whole_word_to_custom_filter.rb
Normal file
|
@ -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
|
|
@ -10,7 +10,7 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 2018_06_28_181026) do
|
||||
ActiveRecord::Schema.define(version: 2018_07_07_154237) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
|
@ -149,6 +149,7 @@ ActiveRecord::Schema.define(version: 2018_06_28_181026) do
|
|||
t.text "phrase", default: "", null: false
|
||||
t.string "context", default: [], null: false, array: true
|
||||
t.boolean "irreversible", default: false, null: false
|
||||
t.boolean "whole_word", default: true, null: false
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.index ["account_id"], name: "index_custom_filters_on_account_id"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue