Add option to be notified when a followed user posts (#13546)
* Add bell button Fix #4890 * Remove duplicate type from post-deployment migration * Fix legacy class type mappings * Improve query performance with better index * Fix validation * Remove redundant index from notifications
This commit is contained in:
parent
75e4bd9413
commit
974b1b79ce
42 changed files with 330 additions and 112 deletions
|
@ -2,13 +2,14 @@ require 'rails_helper'
|
|||
|
||||
RSpec.describe NotifyService, type: :service do
|
||||
subject do
|
||||
-> { described_class.new.call(recipient, activity) }
|
||||
-> { described_class.new.call(recipient, type, activity) }
|
||||
end
|
||||
|
||||
let(:user) { Fabricate(:user) }
|
||||
let(:recipient) { user.account }
|
||||
let(:sender) { Fabricate(:account, domain: 'example.com') }
|
||||
let(:activity) { Fabricate(:follow, account: sender, target_account: recipient) }
|
||||
let(:type) { :follow }
|
||||
|
||||
it { is_expected.to change(Notification, :count).by(1) }
|
||||
|
||||
|
@ -50,6 +51,7 @@ RSpec.describe NotifyService, type: :service do
|
|||
|
||||
context 'for direct messages' do
|
||||
let(:activity) { Fabricate(:mention, account: recipient, status: Fabricate(:status, account: sender, visibility: :direct)) }
|
||||
let(:type) { :mention }
|
||||
|
||||
before do
|
||||
user.settings.interactions = user.settings.interactions.merge('must_be_following_dm' => enabled)
|
||||
|
@ -93,6 +95,7 @@ RSpec.describe NotifyService, type: :service do
|
|||
describe 'reblogs' do
|
||||
let(:status) { Fabricate(:status, account: Fabricate(:account)) }
|
||||
let(:activity) { Fabricate(:status, account: sender, reblog: status) }
|
||||
let(:type) { :reblog }
|
||||
|
||||
it 'shows reblogs by default' do
|
||||
recipient.follow!(sender)
|
||||
|
@ -114,6 +117,7 @@ RSpec.describe NotifyService, type: :service do
|
|||
let(:asshole) { Fabricate(:account, username: 'asshole') }
|
||||
let(:reply_to) { Fabricate(:status, account: asshole) }
|
||||
let(:activity) { Fabricate(:mention, account: recipient, status: Fabricate(:status, account: sender, thread: reply_to)) }
|
||||
let(:type) { :mention }
|
||||
|
||||
it 'does not notify when conversation is muted' do
|
||||
recipient.mute_conversation!(activity.status.conversation)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue