Turn local-only threads into a one-way street, making it impossible to reply to a local-only post with a federated status (by accident)

pull/2906/head
CSDUMMI 2024-11-24 21:48:34 +01:00
parent 916d790794
commit 1550d43afd
2 changed files with 18 additions and 1 deletions

View File

@ -496,7 +496,7 @@ class Status < ApplicationRecord
def set_local_only
return unless account.domain.nil? && !attribute_changed?(:local_only)
self.local_only = marked_local_only?
self.local_only = marked_local_only? || thread&.local_only
end
def set_conversation

View File

@ -290,6 +290,23 @@ RSpec.describe Status do
end
end
end
describe 'on a status in a local-only thread' do
subject { described_class.new }
context 'when a status does not contain the local-only emoji' do
let(:thread) { Fabricate(:Status, local_only: true) }
before do
subject.thread = thread
end
it 'is marked local-only' do
subject.save!
expect(subject).to be_local_only
end
end
end
describe '#reported?' do