Merge commit 'a7a578a055
' into kb_migration
This commit is contained in:
commit
962770e14f
10 changed files with 68 additions and 45 deletions
|
@ -679,7 +679,7 @@ GEM
|
||||||
sshkit (1.21.4)
|
sshkit (1.21.4)
|
||||||
net-scp (>= 1.1.2)
|
net-scp (>= 1.1.2)
|
||||||
net-ssh (>= 2.8.0)
|
net-ssh (>= 2.8.0)
|
||||||
stackprof (0.2.23)
|
stackprof (0.2.24)
|
||||||
statsd-ruby (1.5.0)
|
statsd-ruby (1.5.0)
|
||||||
stoplight (3.0.1)
|
stoplight (3.0.1)
|
||||||
redlock (~> 1.0)
|
redlock (~> 1.0)
|
||||||
|
|
|
@ -292,6 +292,21 @@ module AccountInteractions
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def relations_map(account_ids, domains = nil, **options)
|
||||||
|
relations = {
|
||||||
|
blocked_by: Account.blocked_by_map(account_ids, id),
|
||||||
|
following: Account.following_map(account_ids, id),
|
||||||
|
}
|
||||||
|
|
||||||
|
return relations if options[:skip_blocking_and_muting]
|
||||||
|
|
||||||
|
relations.merge!({
|
||||||
|
blocking: Account.blocking_map(account_ids, id),
|
||||||
|
muting: Account.muting_map(account_ids, id),
|
||||||
|
domain_blocking_by_domain: Account.domain_blocking_map_by_domain(domains, id),
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def remove_potential_friendship(other_account)
|
def remove_potential_friendship(other_account)
|
||||||
|
|
|
@ -79,7 +79,7 @@ module StatusThreadingConcern
|
||||||
statuses = Status.with_accounts(ids).to_a
|
statuses = Status.with_accounts(ids).to_a
|
||||||
account_ids = statuses.map(&:account_id).uniq
|
account_ids = statuses.map(&:account_id).uniq
|
||||||
domains = statuses.filter_map(&:account_domain).uniq
|
domains = statuses.filter_map(&:account_domain).uniq
|
||||||
relations = relations_map_for_account(account, account_ids, domains)
|
relations = account&.relations_map(account_ids, domains) || {}
|
||||||
|
|
||||||
statuses.reject! { |status| StatusFilter.new(status, account, relations).filtered? }
|
statuses.reject! { |status| StatusFilter.new(status, account, relations).filtered? }
|
||||||
|
|
||||||
|
@ -108,16 +108,4 @@ module StatusThreadingConcern
|
||||||
|
|
||||||
arr
|
arr
|
||||||
end
|
end
|
||||||
|
|
||||||
def relations_map_for_account(account, account_ids, domains)
|
|
||||||
return {} if account.nil?
|
|
||||||
|
|
||||||
{
|
|
||||||
blocking: Account.blocking_map(account_ids, account.id),
|
|
||||||
blocked_by: Account.blocked_by_map(account_ids, account.id),
|
|
||||||
muting: Account.muting_map(account_ids, account.id),
|
|
||||||
following: Account.following_map(account_ids, account.id),
|
|
||||||
domain_blocking_by_domain: Account.domain_blocking_map_by_domain(domains, account.id),
|
|
||||||
}
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -22,10 +22,6 @@ class InstancePresenter < ActiveModelSerializers::Model
|
||||||
ContactPresenter.new
|
ContactPresenter.new
|
||||||
end
|
end
|
||||||
|
|
||||||
def closed_registrations_message
|
|
||||||
Setting.closed_registrations_message
|
|
||||||
end
|
|
||||||
|
|
||||||
def description
|
def description
|
||||||
Setting.site_short_description
|
Setting.site_short_description
|
||||||
end
|
end
|
||||||
|
@ -34,10 +30,6 @@ class InstancePresenter < ActiveModelSerializers::Model
|
||||||
Setting.site_extended_description
|
Setting.site_extended_description
|
||||||
end
|
end
|
||||||
|
|
||||||
def privacy_policy
|
|
||||||
Setting.site_terms
|
|
||||||
end
|
|
||||||
|
|
||||||
def status_page_url
|
def status_page_url
|
||||||
Setting.status_page_url
|
Setting.status_page_url
|
||||||
end
|
end
|
||||||
|
|
|
@ -120,7 +120,7 @@ class ImportService < BaseService
|
||||||
end
|
end
|
||||||
|
|
||||||
account_ids = statuses.map(&:account_id)
|
account_ids = statuses.map(&:account_id)
|
||||||
preloaded_relations = relations_map_for_account(@account, account_ids)
|
preloaded_relations = @account.relations_map(account_ids, skip_blocking_and_muting: true)
|
||||||
|
|
||||||
statuses.keep_if { |status| StatusPolicy.new(@account, status, preloaded_relations).show? }
|
statuses.keep_if { |status| StatusPolicy.new(@account, status, preloaded_relations).show? }
|
||||||
|
|
||||||
|
@ -138,14 +138,4 @@ class ImportService < BaseService
|
||||||
def import_data
|
def import_data
|
||||||
Paperclip.io_adapters.for(@import.data).read.force_encoding(Encoding::UTF_8)
|
Paperclip.io_adapters.for(@import.data).read.force_encoding(Encoding::UTF_8)
|
||||||
end
|
end
|
||||||
|
|
||||||
def relations_map_for_account(account, account_ids)
|
|
||||||
{
|
|
||||||
blocking: {},
|
|
||||||
blocked_by: Account.blocked_by_map(account_ids, account.id),
|
|
||||||
muting: {},
|
|
||||||
following: Account.following_map(account_ids, account.id),
|
|
||||||
domain_blocking_by_domain: {},
|
|
||||||
}
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -49,7 +49,7 @@ class SearchService < BaseService
|
||||||
results = definition.limit(@limit).offset(@offset).objects.compact
|
results = definition.limit(@limit).offset(@offset).objects.compact
|
||||||
account_ids = results.map(&:account_id)
|
account_ids = results.map(&:account_id)
|
||||||
account_domains = results.map(&:account_domain)
|
account_domains = results.map(&:account_domain)
|
||||||
preloaded_relations = relations_map_for_account(@account, account_ids, account_domains)
|
preloaded_relations = @account.relations_map(account_ids, account_domains)
|
||||||
|
|
||||||
results.reject { |status| StatusFilter.new(status, @account, preloaded_relations).filtered? }
|
results.reject { |status| StatusFilter.new(status, @account, preloaded_relations).filtered? }
|
||||||
rescue Faraday::ConnectionFailed, Parslet::ParseFailed
|
rescue Faraday::ConnectionFailed, Parslet::ParseFailed
|
||||||
|
@ -111,16 +111,6 @@ class SearchService < BaseService
|
||||||
@options[:type].blank? || @options[:type] == 'statuses'
|
@options[:type].blank? || @options[:type] == 'statuses'
|
||||||
end
|
end
|
||||||
|
|
||||||
def relations_map_for_account(account, account_ids, domains)
|
|
||||||
{
|
|
||||||
blocking: Account.blocking_map(account_ids, account.id),
|
|
||||||
blocked_by: Account.blocked_by_map(account_ids, account.id),
|
|
||||||
muting: Account.muting_map(account_ids, account.id),
|
|
||||||
following: Account.following_map(account_ids, account.id),
|
|
||||||
domain_blocking_by_domain: Account.domain_blocking_map_by_domain(domains, account.id),
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
def parsed_query
|
def parsed_query
|
||||||
SearchQueryTransformer.new.apply(SearchQueryParser.new.parse(@query))
|
SearchQueryTransformer.new.apply(SearchQueryParser.new.parse(@query))
|
||||||
end
|
end
|
||||||
|
|
|
@ -1714,7 +1714,7 @@ en:
|
||||||
seamless_external_login: You are logged in via an external service, so password and e-mail settings are not available.
|
seamless_external_login: You are logged in via an external service, so password and e-mail settings are not available.
|
||||||
signed_in_as: 'Signed in as:'
|
signed_in_as: 'Signed in as:'
|
||||||
verification:
|
verification:
|
||||||
explanation_html: 'You can <strong>verify yourself as the owner of the links in your profile metadata</strong>. For that, the linked website must contain a link back to your Mastodon profile. The link back <strong>must</strong> have a <code>rel="me"</code> attribute. The text content of the link does not matter. Here is an example:'
|
explanation_html: 'You can <strong>verify yourself as the owner of the links in your profile metadata</strong>. For that, the linked website must contain a link back to your Mastodon profile. After adding the link you may need to come back here and re-save your profile for the verification to take effect. The link back <strong>must</strong> have a <code>rel="me"</code> attribute. The text content of the link does not matter. Here is an example:'
|
||||||
verification: Verification
|
verification: Verification
|
||||||
webauthn_credentials:
|
webauthn_credentials:
|
||||||
add: Add new security key
|
add: Add new security key
|
||||||
|
|
16
spec/lib/importer/accounts_index_importer_spec.rb
Normal file
16
spec/lib/importer/accounts_index_importer_spec.rb
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
describe Importer::AccountsIndexImporter do
|
||||||
|
describe 'import!' do
|
||||||
|
let(:pool) { Concurrent::FixedThreadPool.new(5) }
|
||||||
|
let(:importer) { described_class.new(batch_size: 123, executor: pool) }
|
||||||
|
|
||||||
|
before { Fabricate(:account) }
|
||||||
|
|
||||||
|
it 'indexes relevant accounts' do
|
||||||
|
expect { importer.import! }.to update_index(AccountsIndex)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
16
spec/lib/importer/statuses_index_importer_spec.rb
Normal file
16
spec/lib/importer/statuses_index_importer_spec.rb
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
describe Importer::StatusesIndexImporter do
|
||||||
|
describe 'import!' do
|
||||||
|
let(:pool) { Concurrent::FixedThreadPool.new(5) }
|
||||||
|
let(:importer) { described_class.new(batch_size: 123, executor: pool) }
|
||||||
|
|
||||||
|
before { Fabricate(:status) }
|
||||||
|
|
||||||
|
it 'indexes relevant statuses' do
|
||||||
|
expect { importer.import! }.to update_index(StatusesIndex)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
16
spec/lib/importer/tags_index_importer_spec.rb
Normal file
16
spec/lib/importer/tags_index_importer_spec.rb
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
describe Importer::TagsIndexImporter do
|
||||||
|
describe 'import!' do
|
||||||
|
let(:pool) { Concurrent::FixedThreadPool.new(5) }
|
||||||
|
let(:importer) { described_class.new(batch_size: 123, executor: pool) }
|
||||||
|
|
||||||
|
before { Fabricate(:tag) }
|
||||||
|
|
||||||
|
it 'indexes relevant tags' do
|
||||||
|
expect { importer.import! }.to update_index(TagsIndex)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
Loading…
Add table
Add a link
Reference in a new issue