mirror of
https://github.com/lunaisnotaboy/mastodon.git
synced 2024-12-22 13:17:13 +00:00
Prevent from publicly boosting one's own private toots (#10775)
This commit is contained in:
parent
e976a9dfbd
commit
a1519a8ef5
|
@ -18,7 +18,9 @@ class ReblogService < BaseService
|
||||||
|
|
||||||
return reblog unless reblog.nil?
|
return reblog unless reblog.nil?
|
||||||
|
|
||||||
reblog = account.statuses.create!(reblog: reblogged_status, text: '', visibility: options[:visibility] || account.user&.setting_default_privacy)
|
visibility = options[:visibility] || account.user&.setting_default_privacy
|
||||||
|
visibility = reblogged_status.visibility if reblogged_status.hidden?
|
||||||
|
reblog = account.statuses.create!(reblog: reblogged_status, text: '', visibility: visibility)
|
||||||
|
|
||||||
DistributionWorker.perform_async(reblog.id)
|
DistributionWorker.perform_async(reblog.id)
|
||||||
Pubsubhubbub::DistributionWorker.perform_async(reblog.stream_entry.id)
|
Pubsubhubbub::DistributionWorker.perform_async(reblog.stream_entry.id)
|
||||||
|
|
|
@ -4,10 +4,9 @@ RSpec.describe ReblogService, type: :service do
|
||||||
let(:alice) { Fabricate(:account, username: 'alice') }
|
let(:alice) { Fabricate(:account, username: 'alice') }
|
||||||
|
|
||||||
context 'creates a reblog with appropriate visibility' do
|
context 'creates a reblog with appropriate visibility' do
|
||||||
let(:bob) { Fabricate(:account, username: 'bob') }
|
|
||||||
let(:visibility) { :public }
|
let(:visibility) { :public }
|
||||||
let(:reblog_visibility) { :public }
|
let(:reblog_visibility) { :public }
|
||||||
let(:status) { Fabricate(:status, account: bob, visibility: visibility) }
|
let(:status) { Fabricate(:status, account: alice, visibility: visibility) }
|
||||||
|
|
||||||
subject { ReblogService.new }
|
subject { ReblogService.new }
|
||||||
|
|
||||||
|
@ -22,6 +21,15 @@ RSpec.describe ReblogService, type: :service do
|
||||||
expect(status.reblogs.first.visibility).to eq 'private'
|
expect(status.reblogs.first.visibility).to eq 'private'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe 'public reblogs of private toots should remain private' do
|
||||||
|
let(:visibility) { :private }
|
||||||
|
let(:reblog_visibility) { :public }
|
||||||
|
|
||||||
|
it 'reblogs privately' do
|
||||||
|
expect(status.reblogs.first.visibility).to eq 'private'
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'OStatus' do
|
context 'OStatus' do
|
||||||
|
|
Loading…
Reference in a new issue