Add option to block direct messages from people you don't follow (#5669)
* Add option to block direct messages from people you don't follow Fix #5326 * If the DM responds to a toot by recipient, allow it through * i18n: Update Polish translation (for #5669) (#5673)
This commit is contained in:
parent
c3ec1e87b8
commit
fbef909c2a
7 changed files with 89 additions and 11 deletions
|
@ -38,6 +38,39 @@ RSpec.describe NotifyService do
|
|||
is_expected.to_not change(Notification, :count)
|
||||
end
|
||||
|
||||
context 'for direct messages' do
|
||||
let(:activity) { Fabricate(:mention, account: recipient, status: Fabricate(:status, account: sender, visibility: :direct)) }
|
||||
|
||||
before do
|
||||
user.settings.interactions = user.settings.interactions.merge('must_be_following_dm' => enabled)
|
||||
end
|
||||
|
||||
context 'if recipient is supposed to be following sender' do
|
||||
let(:enabled) { true }
|
||||
|
||||
it 'does not notify' do
|
||||
is_expected.to_not change(Notification, :count)
|
||||
end
|
||||
|
||||
context 'if the message chain initiated by recipient' do
|
||||
let(:reply_to) { Fabricate(:status, account: recipient) }
|
||||
let(:activity) { Fabricate(:mention, account: recipient, status: Fabricate(:status, account: sender, visibility: :direct, thread: reply_to)) }
|
||||
|
||||
it 'does notify' do
|
||||
is_expected.to change(Notification, :count)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'if recipient is NOT supposed to be following sender' do
|
||||
let(:enabled) { false }
|
||||
|
||||
it 'does notify' do
|
||||
is_expected.to change(Notification, :count)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context do
|
||||
let(:asshole) { Fabricate(:account, username: 'asshole') }
|
||||
let(:reply_to) { Fabricate(:status, account: asshole) }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue