mirror of
https://framagit.org/tykayn/mastodon.git
synced 2023-08-25 08:33:12 +02:00
Discard misattributed remote statuses, improve timelines filter
This commit is contained in:
parent
17903c6dae
commit
aabf884c5f
@ -121,6 +121,7 @@ class Status < ApplicationRecord
|
||||
|
||||
def filter_timeline(query, account)
|
||||
blocked = Block.where(account: account).pluck(:target_account_id)
|
||||
return query if blocked.empty?
|
||||
|
||||
query
|
||||
.joins('LEFT OUTER JOIN statuses AS parents ON statuses.in_reply_to_id = parents.id')
|
||||
|
@ -48,6 +48,8 @@ class ProcessFeedService < BaseService
|
||||
if original_status.nil?
|
||||
status.destroy
|
||||
return nil
|
||||
elsif original_status.reblog?
|
||||
status.reblog = original_status.reblog
|
||||
end
|
||||
end
|
||||
|
||||
@ -73,11 +75,18 @@ class ProcessFeedService < BaseService
|
||||
status = find_status(id(entry))
|
||||
return status unless status.nil?
|
||||
|
||||
# If status embeds an author, find that author
|
||||
# If that author cannot be found, don't record the status (do not misattribute)
|
||||
if account?(entry)
|
||||
begin
|
||||
account = account?(entry) ? find_or_resolve_account(acct(entry)) : @account
|
||||
account = find_or_resolve_account(acct(entry))
|
||||
return nil if account.nil?
|
||||
rescue Goldfinger::Error
|
||||
return nil
|
||||
end
|
||||
else
|
||||
account = @account
|
||||
end
|
||||
|
||||
status = Status.create!({
|
||||
uri: id(entry),
|
||||
|
@ -15,6 +15,7 @@ Sidekiq::Testing.inline!
|
||||
RSpec.configure do |config|
|
||||
config.fixture_path = "#{::Rails.root}/spec/fixtures"
|
||||
config.use_transactional_fixtures = true
|
||||
config.order = 'random'
|
||||
config.infer_spec_type_from_file_location!
|
||||
config.filter_rails_from_backtrace!
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user