Keep matching mainline as much as possible
This commit is contained in:
parent
94153792ba
commit
4bc60b2b79
17 changed files with 3 additions and 128 deletions
|
@ -198,8 +198,4 @@ class Auth::SessionsController < Devise::SessionsController
|
||||||
format.all { super }
|
format.all { super }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def second_factor_attempts_key(user)
|
|
||||||
"2fa_auth_attempts:#{user.id}:#{Time.now.utc.hour}"
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -19,6 +19,7 @@ module WellKnown
|
||||||
|
|
||||||
def set_account
|
def set_account
|
||||||
username = username_from_resource
|
username = username_from_resource
|
||||||
|
|
||||||
@account = begin
|
@account = begin
|
||||||
if username == Rails.configuration.x.local_domain || username == Rails.configuration.x.web_domain
|
if username == Rails.configuration.x.local_domain || username == Rails.configuration.x.web_domain
|
||||||
Account.representative
|
Account.representative
|
||||||
|
|
|
@ -22,13 +22,7 @@ export default class Column extends PureComponent {
|
||||||
scrollable = document.scrollingElement;
|
scrollable = document.scrollingElement;
|
||||||
} else {
|
} else {
|
||||||
scrollable = this.node.querySelector('.scrollable');
|
scrollable = this.node.querySelector('.scrollable');
|
||||||
|
}
|
||||||
// Some columns have nested `.scrollable` containers, with the outer one
|
|
||||||
// being a wrapper while the actual scrollable content is deeper.
|
|
||||||
if (scrollable.classList.contains('scrollable--flex')) {
|
|
||||||
scrollable = scrollable?.querySelector('.scrollable') || scrollable;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!scrollable) {
|
if (!scrollable) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -42,8 +42,4 @@ class ActivityPub::Activity::Flag < ActivityPub::Activity
|
||||||
def report_comment
|
def report_comment
|
||||||
(@json['content'] || '')[0...COMMENT_SIZE_LIMIT]
|
(@json['content'] || '')[0...COMMENT_SIZE_LIMIT]
|
||||||
end
|
end
|
||||||
|
|
||||||
def report_comment
|
|
||||||
(@json['content'] || '')[0...5000]
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -302,11 +302,6 @@ class LinkDetailsExtractor
|
||||||
nil
|
nil
|
||||||
end
|
end
|
||||||
|
|
||||||
def detect_encoding
|
|
||||||
guess = detector.detect(@html, @html_charset)
|
|
||||||
guess&.fetch(:confidence, 0).to_i > 60 ? guess&.fetch(:encoding, nil) : nil
|
|
||||||
end
|
|
||||||
|
|
||||||
def detector
|
def detector
|
||||||
@detector ||= CharlockHolmes::EncodingDetector.new.tap do |detector|
|
@detector ||= CharlockHolmes::EncodingDetector.new.tap do |detector|
|
||||||
detector.strip_tags = true
|
detector.strip_tags = true
|
||||||
|
|
|
@ -22,10 +22,4 @@ class ApplicationMailer < ActionMailer::Base
|
||||||
'X-Auto-Response-Suppress' => 'All'
|
'X-Auto-Response-Suppress' => 'All'
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
def set_autoreply_headers!
|
|
||||||
headers['Precedence'] = 'list'
|
|
||||||
headers['X-Auto-Response-Suppress'] = 'All'
|
|
||||||
headers['Auto-Submitted'] = 'auto-generated'
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -305,8 +305,4 @@ module Account::Interactions
|
||||||
def normalized_domain(domain)
|
def normalized_domain(domain)
|
||||||
TagManager.instance.normalize_domain(domain)
|
TagManager.instance.normalize_domain(domain)
|
||||||
end
|
end
|
||||||
|
|
||||||
def normalized_domain(domain)
|
|
||||||
TagManager.instance.normalize_domain(domain)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -128,8 +128,6 @@ class User < ApplicationRecord
|
||||||
scope :matches_ip, ->(value) { left_joins(:ips).where('user_ips.ip <<= ?', value).group('users.id') }
|
scope :matches_ip, ->(value) { left_joins(:ips).where('user_ips.ip <<= ?', value).group('users.id') }
|
||||||
|
|
||||||
before_validation :sanitize_role
|
before_validation :sanitize_role
|
||||||
before_validation :sanitize_time_zone
|
|
||||||
before_validation :sanitize_locale
|
|
||||||
before_create :set_approved
|
before_create :set_approved
|
||||||
after_commit :send_pending_devise_notifications
|
after_commit :send_pending_devise_notifications
|
||||||
after_create_commit :trigger_webhooks
|
after_create_commit :trigger_webhooks
|
||||||
|
|
|
@ -15,9 +15,6 @@ class FetchLinkCardService < BaseService
|
||||||
)
|
)
|
||||||
}iox
|
}iox
|
||||||
|
|
||||||
# URL size limit to safely store in PosgreSQL's unique indexes
|
|
||||||
BYTESIZE_LIMIT = 2692
|
|
||||||
|
|
||||||
def call(status)
|
def call(status)
|
||||||
@status = status
|
@status = status
|
||||||
@original_url = parse_urls
|
@original_url = parse_urls
|
||||||
|
@ -94,7 +91,7 @@ class FetchLinkCardService < BaseService
|
||||||
|
|
||||||
def bad_url?(uri)
|
def bad_url?(uri)
|
||||||
# Avoid local instance URLs and invalid URLs
|
# Avoid local instance URLs and invalid URLs
|
||||||
uri.host.blank? || TagManager.instance.local_url?(uri.to_s) || !%w(http https).include?(uri.scheme) || uri.to_s.bytesize > BYTESIZE_LIMIT
|
uri.host.blank? || TagManager.instance.local_url?(uri.to_s) || !%w(http https).include?(uri.scheme)
|
||||||
end
|
end
|
||||||
|
|
||||||
def mention_link?(anchor)
|
def mention_link?(anchor)
|
||||||
|
|
|
@ -81,10 +81,6 @@ module Mastodon
|
||||||
# config.time_zone = "Central Time (US & Canada)"
|
# config.time_zone = "Central Time (US & Canada)"
|
||||||
# config.eager_load_paths << Rails.root.join("extras")
|
# config.eager_load_paths << Rails.root.join("extras")
|
||||||
|
|
||||||
config.public_file_server.headers = {
|
|
||||||
'X-Content-Type-Options' => 'nosniff',
|
|
||||||
}
|
|
||||||
|
|
||||||
# config.paths.add File.join('app', 'api'), glob: File.join('**', '*.rb')
|
# config.paths.add File.join('app', 'api'), glob: File.join('**', '*.rb')
|
||||||
# config.autoload_paths += Dir[Rails.root.join('app', 'api', '*')]
|
# config.autoload_paths += Dir[Rails.root.join('app', 'api', '*')]
|
||||||
|
|
||||||
|
|
|
@ -211,20 +211,6 @@ RSpec.describe AccountStatusesFilter do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when blocking an unrelated domain' do
|
|
||||||
let(:other_account) { Fabricate(:account, domain: nil) }
|
|
||||||
let(:reblogging_status) { Fabricate(:status, account: other_account, visibility: 'public') }
|
|
||||||
let!(:reblog) { Fabricate(:status, account: account, visibility: 'public', reblog: reblogging_status) }
|
|
||||||
|
|
||||||
before do
|
|
||||||
current_account.block_domain!('example.com')
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'returns the reblog from the non-blocked domain' do
|
|
||||||
expect(subject.results.pluck(:id)).to include(reblog.id)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'when muting a reblogged account' do
|
context 'when muting a reblogged account' do
|
||||||
let(:reblog) { status_with_reblog!('public') }
|
let(:reblog) { status_with_reblog!('public') }
|
||||||
|
|
||||||
|
|
|
@ -134,14 +134,6 @@ RSpec.describe ActivityPub::TagManager do
|
||||||
reblog = Fabricate(:status, visibility: :public, account: alice, reblog: status)
|
reblog = Fabricate(:status, visibility: :public, account: alice, reblog: status)
|
||||||
expect(subject.cc(reblog)).to include(subject.uri_for(bob))
|
expect(subject.cc(reblog)).to include(subject.uri_for(bob))
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'returns poster of reblogged post, if reblog' do
|
|
||||||
bob = Fabricate(:account, username: 'bob', domain: 'example.com', inbox_url: 'http://example.com/bob')
|
|
||||||
alice = Fabricate(:account, username: 'alice')
|
|
||||||
status = Fabricate(:status, visibility: :public, account: bob)
|
|
||||||
reblog = Fabricate(:status, visibility: :public, account: alice, reblog: status)
|
|
||||||
expect(subject.cc(reblog)).to include(subject.uri_for(bob))
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#local_uri?' do
|
describe '#local_uri?' do
|
||||||
|
|
|
@ -100,12 +100,6 @@ RSpec.describe LinkDetailsExtractor do
|
||||||
language: eq('en')
|
language: eq('en')
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#language' do
|
|
||||||
it 'returns the language from structured data' do
|
|
||||||
expect(subject.language).to eq 'en'
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when is wrapped in CDATA tags' do
|
context 'when is wrapped in CDATA tags' do
|
||||||
|
|
|
@ -444,8 +444,6 @@ RSpec.describe User do
|
||||||
|
|
||||||
let(:redis_pipeline_stub) { instance_double(Redis::Namespace, publish: nil) }
|
let(:redis_pipeline_stub) { instance_double(Redis::Namespace, publish: nil) }
|
||||||
|
|
||||||
let(:redis_pipeline_stub) { instance_double(Redis::Namespace, publish: nil) }
|
|
||||||
|
|
||||||
before { stub_redis }
|
before { stub_redis }
|
||||||
|
|
||||||
it 'changes the password immediately and revokes related access' do
|
it 'changes the password immediately and revokes related access' do
|
||||||
|
|
|
@ -235,19 +235,6 @@ RSpec.describe FetchLinkCardService do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'with an URL too long for PostgreSQL unique indexes' do
|
|
||||||
let(:url) { "http://example.com/#{'a' * 2674}" }
|
|
||||||
let(:status) { Fabricate(:status, text: url) }
|
|
||||||
|
|
||||||
it 'does not fetch the URL' do
|
|
||||||
expect(a_request(:get, url)).to_not have_been_made
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'does not create a preview card' do
|
|
||||||
expect(status.preview_card).to be_nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'with a URL of a page with oEmbed support' do
|
context 'with a URL of a page with oEmbed support' do
|
||||||
let(:html) { '<!doctype html><title>Hello world</title><link rel="alternate" type="application/json+oembed" href="http://example.com/oembed?url=http://example.com/html">' }
|
let(:html) { '<!doctype html><title>Hello world</title><link rel="alternate" type="application/json+oembed" href="http://example.com/oembed?url=http://example.com/html">' }
|
||||||
let(:status) { Fabricate(:status, text: 'http://example.com/html') }
|
let(:status) { Fabricate(:status, text: 'http://example.com/html') }
|
||||||
|
|
|
@ -18,17 +18,6 @@ RSpec.describe NotifyService do
|
||||||
expect { subject }.to_not change(Notification, :count)
|
expect { subject }.to_not change(Notification, :count)
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when the sender is a local moderator' do
|
|
||||||
let(:sender) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')).account }
|
|
||||||
let(:type) { :mention }
|
|
||||||
let(:activity) { Fabricate(:mention, account: recipient, status: Fabricate(:status, account: sender)) }
|
|
||||||
|
|
||||||
it 'does notify when the sender is blocked' do
|
|
||||||
recipient.block!(sender)
|
|
||||||
expect { subject }.to change(Notification, :count).by(1)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'does not notify when sender is muted with hide_notifications' do
|
it 'does not notify when sender is muted with hide_notifications' do
|
||||||
recipient.mute!(sender, notifications: true)
|
recipient.mute!(sender, notifications: true)
|
||||||
expect { subject }.to_not change(Notification, :count)
|
expect { subject }.to_not change(Notification, :count)
|
||||||
|
|
|
@ -74,40 +74,6 @@ RSpec.describe PostStatusService do
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'returns existing status when used twice with idempotency key' do
|
|
||||||
account = Fabricate(:account)
|
|
||||||
status1 = subject.call(account, text: 'test', idempotency: 'meepmeep', scheduled_at: future)
|
|
||||||
status2 = subject.call(account, text: 'test', idempotency: 'meepmeep', scheduled_at: future)
|
|
||||||
expect(status2.id).to eq status1.id
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'when scheduled_at is less than min offset' do
|
|
||||||
let(:invalid_scheduled_time) { 4.minutes.from_now }
|
|
||||||
|
|
||||||
it 'raises invalid record error' do
|
|
||||||
expect do
|
|
||||||
subject.call(account, text: 'Hi future!', scheduled_at: invalid_scheduled_time)
|
|
||||||
end.to raise_error(ActiveRecord::RecordInvalid)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'returns existing status when used twice with idempotency key' do
|
|
||||||
account = Fabricate(:account)
|
|
||||||
status1 = subject.call(account, text: 'test', idempotency: 'meepmeep', scheduled_at: future)
|
|
||||||
status2 = subject.call(account, text: 'test', idempotency: 'meepmeep', scheduled_at: future)
|
|
||||||
expect(status2.id).to eq status1.id
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'when scheduled_at is less than min offset' do
|
|
||||||
let(:invalid_scheduled_time) { 4.minutes.from_now }
|
|
||||||
|
|
||||||
it 'raises invalid record error' do
|
|
||||||
expect do
|
|
||||||
subject.call(account, text: 'Hi future!', scheduled_at: invalid_scheduled_time)
|
|
||||||
end.to raise_error(ActiveRecord::RecordInvalid)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'creates response to the original status of boost' do
|
it 'creates response to the original status of boost' do
|
||||||
|
|
Loading…
Reference in a new issue