Automatic rubocop fixing
This commit is contained in:
parent
d0014788f6
commit
8925306af0
|
@ -129,15 +129,15 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
|
|||
conversation: conversation_from_uri(@object['conversation']),
|
||||
media_attachment_ids: process_attachments.take(4).map(&:id),
|
||||
poll: process_poll,
|
||||
activity_pub_type: @object['type']
|
||||
activity_pub_type: @object['type'],
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
class Handler < ::Ox::Sax
|
||||
attr_reader :srcs
|
||||
attr_reader :alts
|
||||
def initialize(block)
|
||||
attr_reader :srcs, :alts
|
||||
|
||||
def initialize(_block)
|
||||
@stack = []
|
||||
@srcs = []
|
||||
@alts = {}
|
||||
|
@ -147,7 +147,7 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
|
|||
@stack << [element_name, {}]
|
||||
end
|
||||
|
||||
def end_element(element_name)
|
||||
def end_element(_element_name)
|
||||
self_name, self_attributes = @stack[-1]
|
||||
if self_name == :img && !self_attributes[:src].nil?
|
||||
@srcs << self_attributes[:src]
|
||||
|
@ -163,7 +163,7 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
|
|||
end
|
||||
|
||||
def process_inline_images
|
||||
proc = Proc.new { |name| puts name }
|
||||
proc = proc { |name| puts name }
|
||||
handler = Handler.new(proc)
|
||||
Ox.sax_parse(handler, @object['content'])
|
||||
handler.srcs.each do |src|
|
||||
|
@ -436,7 +436,7 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
|
|||
|
||||
return article_format(@object['content']) if @object['content'].present? && @object['type'] == 'Article'
|
||||
|
||||
return @status_parser.text || ''
|
||||
@status_parser.text || ''
|
||||
end
|
||||
|
||||
def text_from_name
|
||||
|
|
|
@ -122,13 +122,11 @@ class PostStatusService < BaseService
|
|||
spoiler_text&.include?(':local_only')
|
||||
return true
|
||||
end
|
||||
|
||||
if local_only.nil?
|
||||
if in_reply_to && in_reply_to.local_only
|
||||
return true
|
||||
end
|
||||
if in_reply_to && !in_reply_to.local_only
|
||||
return false
|
||||
end
|
||||
return true if in_reply_to&.local_only
|
||||
return false if in_reply_to && !in_reply_to.local_only
|
||||
|
||||
return !federation_setting
|
||||
end
|
||||
local_only
|
||||
|
@ -139,9 +137,7 @@ class PostStatusService < BaseService
|
|||
Trends.tags.register(@status)
|
||||
LinkCrawlWorker.perform_async(@status.id)
|
||||
DistributionWorker.perform_async(@status.id)
|
||||
unless @status.local_only?
|
||||
ActivityPub::DistributionWorker.perform_async(@status.id)
|
||||
end
|
||||
ActivityPub::DistributionWorker.perform_async(@status.id) unless @status.local_only?
|
||||
PollExpirationNotifyWorker.perform_at(@status.poll.expires_at, @status.poll.id) if @status.poll
|
||||
end
|
||||
|
||||
|
|
|
@ -30,9 +30,7 @@ class ReblogService < BaseService
|
|||
|
||||
Trends.register!(reblog)
|
||||
DistributionWorker.perform_async(reblog.id)
|
||||
unless reblogged_status.local_only?
|
||||
ActivityPub::DistributionWorker.perform_async(reblog.id)
|
||||
end
|
||||
ActivityPub::DistributionWorker.perform_async(reblog.id) unless reblogged_status.local_only?
|
||||
|
||||
create_notification(reblog)
|
||||
bump_potential_friendship(account, reblog)
|
||||
|
|
|
@ -4,7 +4,7 @@ require_relative '../../lib/mastodon/sidekiq_middleware'
|
|||
|
||||
Sidekiq.configure_server do |config|
|
||||
if Rails.configuration.database_configuration.dig('production', 'adapter') == 'postgresql_makara'
|
||||
STDERR.puts 'ERROR: Database replication is not currently supported in Sidekiq workers. Check your configuration.'
|
||||
warn 'ERROR: Database replication is not currently supported in Sidekiq workers. Check your configuration.'
|
||||
exit 1
|
||||
end
|
||||
|
||||
|
|
|
@ -68,13 +68,13 @@ class Sanitize
|
|||
elements: %w(p br span a abbr del pre blockquote code b strong i em h1 h2 h3 h4 h5 ul ol li img u),
|
||||
|
||||
attributes: {
|
||||
'abbr' => %w(title),
|
||||
'abbr' => %w(title),
|
||||
'blockquote' => %w(cite),
|
||||
'img' => %w(src alt),
|
||||
'a' => %w(href rel class translate title),
|
||||
'span' => %w(class translate),
|
||||
'ol' => %w(start reversed),
|
||||
'li' => %w(value),
|
||||
'img' => %w(src alt),
|
||||
'a' => %w(href rel class translate title),
|
||||
'span' => %w(class translate),
|
||||
'ol' => %w(start reversed),
|
||||
'li' => %w(value),
|
||||
},
|
||||
|
||||
add_attributes: {
|
||||
|
@ -85,7 +85,7 @@ class Sanitize
|
|||
},
|
||||
|
||||
protocols: {
|
||||
'a' => { 'href' => HTTP_PROTOCOLS },
|
||||
'a' => { 'href' => HTTP_PROTOCOLS },
|
||||
'blockquote' => { 'cite' => HTTP_PROTOCOLS },
|
||||
},
|
||||
|
||||
|
@ -101,16 +101,16 @@ class Sanitize
|
|||
elements: %w(audio embed iframe source video),
|
||||
|
||||
attributes: {
|
||||
'audio' => %w(controls),
|
||||
'embed' => %w(height src type width),
|
||||
'audio' => %w(controls),
|
||||
'embed' => %w(height src type width),
|
||||
'iframe' => %w(allowfullscreen frameborder height scrolling src width),
|
||||
'source' => %w(src type),
|
||||
'video' => %w(controls height loop width),
|
||||
'div' => [:data]
|
||||
'video' => %w(controls height loop width),
|
||||
'div' => [:data],
|
||||
},
|
||||
|
||||
protocols: {
|
||||
'embed' => { 'src' => HTTP_PROTOCOLS },
|
||||
'embed' => { 'src' => HTTP_PROTOCOLS },
|
||||
'iframe' => { 'src' => HTTP_PROTOCOLS },
|
||||
'source' => { 'src' => HTTP_PROTOCOLS },
|
||||
},
|
||||
|
|
|
@ -87,14 +87,14 @@ RSpec.describe StatusPolicy, type: :model do
|
|||
end
|
||||
|
||||
it 'denies access when local-only and the viewer is not logged in' do
|
||||
allow(status).to receive(:local_only?) { true }
|
||||
allow(status).to receive(:local_only?).and_return(true)
|
||||
|
||||
expect(subject).to_not permit(nil, status)
|
||||
end
|
||||
|
||||
it 'denies access when local-only and the viewer is from another domain' do
|
||||
viewer = Fabricate(:account, domain: 'remote-domain')
|
||||
allow(status).to receive(:local_only?) { true }
|
||||
allow(status).to receive(:local_only?).and_return(true)
|
||||
expect(subject).to_not permit(viewer, status)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue