Custom_filter working on status_reference
This commit is contained in:
parent
ff06b04e91
commit
76013b10b4
5 changed files with 23 additions and 3 deletions
|
@ -12,6 +12,9 @@ class InlineRenderer
|
|||
when :status
|
||||
serializer = REST::StatusSerializer
|
||||
preload_associations_for_status
|
||||
when :status_internal
|
||||
serializer = REST::StatusInternalSerializer
|
||||
preload_associations_for_status
|
||||
when :notification
|
||||
serializer = REST::NotificationSerializer
|
||||
when :emoji_reaction
|
||||
|
|
|
@ -101,7 +101,10 @@ class CustomFilter < ApplicationRecord
|
|||
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?
|
||||
if rules[:keywords].present?
|
||||
match = rules[:keywords].match(status.proper.searchable_text)
|
||||
match = rules[:keywords].match(status.proper.references.pluck(:text).join("\n\n")) if match.nil? && status.proper.references.exists?
|
||||
end
|
||||
keyword_matches = [match.to_s] unless match.nil?
|
||||
|
||||
status_matches = [status.id, status.reblog_of_id].compact & rules[:status_ids] if rules[:status_ids].present?
|
||||
|
|
9
app/serializers/rest/status_internal_serializer.rb
Normal file
9
app/serializers/rest/status_internal_serializer.rb
Normal file
|
@ -0,0 +1,9 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class REST::StatusInternalSerializer < REST::StatusSerializer
|
||||
attributes :reference_texts
|
||||
|
||||
def reference_texts
|
||||
object.references.pluck(:text)
|
||||
end
|
||||
end
|
|
@ -195,7 +195,7 @@ class FanOutOnWriteService < BaseService
|
|||
end
|
||||
|
||||
def rendered_status
|
||||
@rendered_status ||= InlineRenderer.render(@status, nil, :status)
|
||||
@rendered_status ||= InlineRenderer.render(@status, nil, :status_internal)
|
||||
end
|
||||
|
||||
def update?
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue