mirror of https://github.com/mastodon/mastodon
Fix style
This commit is contained in:
parent
53ca4bd676
commit
67b6af0f8b
|
@ -46,10 +46,6 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
def reject_pattern?
|
|
||||||
Setting.reject_pattern.present? && @object['content']&.match?(Setting.reject_pattern)
|
|
||||||
end
|
|
||||||
|
|
||||||
def create_status
|
def create_status
|
||||||
return reject_payload! if unsupported_object_type? || non_matching_uri_hosts?(@account.uri, object_uri) || tombstone_exists? || !related_to_local_activity? || reject_pattern?
|
return reject_payload! if unsupported_object_type? || non_matching_uri_hosts?(@account.uri, object_uri) || tombstone_exists? || !related_to_local_activity? || reject_pattern?
|
||||||
|
|
||||||
|
@ -417,6 +413,10 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
|
||||||
Tombstone.exists?(uri: object_uri)
|
Tombstone.exists?(uri: object_uri)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def reject_pattern?
|
||||||
|
Setting.reject_pattern.present? && @object['content']&.match?(Setting.reject_pattern)
|
||||||
|
end
|
||||||
|
|
||||||
def forward_for_reply
|
def forward_for_reply
|
||||||
return unless @status.distributable? && @json['signature'].present? && reply_to_local?
|
return unless @status.distributable? && @json['signature'].present? && reply_to_local?
|
||||||
|
|
||||||
|
|
|
@ -4,10 +4,8 @@ class RegexpSyntaxValidator < ActiveModel::EachValidator
|
||||||
def validate_each(record, attribute, value)
|
def validate_each(record, attribute, value)
|
||||||
return if value.blank?
|
return if value.blank?
|
||||||
|
|
||||||
begin
|
Regexp.compile(value)
|
||||||
Regexp.compile(value)
|
rescue RegexpError => e
|
||||||
rescue RegexpError => e
|
record.errors.add(attribute, I18n.t('applications.invalid_regexp', message: e.message))
|
||||||
record.errors.add(attribute, I18n.t('applications.invalid_regexp', message: e.message))
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue