Merge commit '5a0483ed21
' into kb_migration
This commit is contained in:
commit
7b735921dc
26 changed files with 204 additions and 50 deletions
|
@ -265,7 +265,7 @@ module AccountInteractions
|
|||
|
||||
def status_matches_filters(status)
|
||||
active_filters = CustomFilter.cached_filters_for(id)
|
||||
CustomFilter.apply_cached_filters(active_filters, status)
|
||||
CustomFilter.apply_cached_filters(active_filters, status, following?(status.account))
|
||||
end
|
||||
|
||||
def followers_for_local_distribution
|
||||
|
|
|
@ -4,14 +4,16 @@
|
|||
#
|
||||
# Table name: custom_filters
|
||||
#
|
||||
# id :bigint(8) not null, primary key
|
||||
# account_id :bigint(8)
|
||||
# expires_at :datetime
|
||||
# phrase :text default(""), not null
|
||||
# context :string default([]), not null, is an Array
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# action :integer default("warn"), not null
|
||||
# id :bigint(8) not null, primary key
|
||||
# account_id :bigint(8)
|
||||
# expires_at :datetime
|
||||
# phrase :text default(""), not null
|
||||
# context :string default([]), not null, is an Array
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# action :integer default("warn"), not null
|
||||
# exclude_follows :boolean default(FALSE), not null
|
||||
# exclude_localusers :boolean default(FALSE), not null
|
||||
#
|
||||
|
||||
class CustomFilter < ApplicationRecord
|
||||
|
@ -94,8 +96,11 @@ class CustomFilter < ApplicationRecord
|
|||
active_filters.select { |custom_filter, _| !custom_filter.expired? }
|
||||
end
|
||||
|
||||
def self.apply_cached_filters(cached_filters, status)
|
||||
def self.apply_cached_filters(cached_filters, status, following)
|
||||
cached_filters.filter_map do |filter, rules|
|
||||
next if filter.exclude_follows && following
|
||||
next if filter.exclude_localusers && status.account.local?
|
||||
|
||||
match = rules[:keywords].match(status.proper.searchable_text) if rules[:keywords].present?
|
||||
keyword_matches = [match.to_s] unless match.nil?
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
# id :bigint(8) not null, primary key
|
||||
# custom_filter_id :bigint(8) not null
|
||||
# keyword :text default(""), not null
|
||||
# whole_word :boolean default(TRUE), not null
|
||||
# whole_word :boolean default(FALSE), not null
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
#
|
||||
|
|
|
@ -47,8 +47,8 @@ class UserSettings
|
|||
setting :reduce_motion, default: false
|
||||
setting :expand_content_warnings, default: false
|
||||
setting :display_media, default: 'default', in: %w(default show_all hide_all)
|
||||
setting :display_media_expand, default: false
|
||||
setting :auto_play, default: false
|
||||
setting :display_media_expand, default: true
|
||||
setting :auto_play, default: true
|
||||
end
|
||||
|
||||
namespace :notification_emails do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue