Fix missing emoji_reaction to push notification

This commit is contained in:
noellabo 2022-04-20 16:10:27 +09:00
parent 6bd24ab1ee
commit 913cf3520a
5 changed files with 24 additions and 3 deletions

View file

@ -12,6 +12,7 @@ const initialState = Immutable.Map({
mention: false,
poll: false,
status: false,
emoji_reaction: false,
}),
isSubscribed: false,
browserSupport: false,

View file

@ -21,6 +21,7 @@ filenames.forEach(filename => {
'notification.reblog': full['notification.reblog'] || '',
'notification.status': full['notification.status'] || '',
'notification.poll': full['notification.poll'] || '',
'notification.emoji_reaction': full['notification.emoji_reaction'] || '',
'status.show_more': full['status.show_more'] || '',
'status.reblog': full['status.reblog'] || '',

View file

@ -37,6 +37,7 @@ describe Api::V1::Push::SubscriptionsController do
mention: false,
poll: true,
status: false,
emoji_reaction: false,
}
}
}.with_indifferent_access
@ -74,7 +75,7 @@ describe Api::V1::Push::SubscriptionsController do
expect(push_subscription.data['policy']).to eq(alerts_payload[:data][:policy])
%w(follow follow_request favourite reblog mention poll status).each do |type|
%w(follow follow_request favourite reblog mention poll status emoji_reaction).each do |type|
expect(push_subscription.data['alerts'][type]).to eq(alerts_payload[:data][:alerts][type.to_sym].to_s)
end
end

View file

@ -32,6 +32,7 @@ describe Api::Web::PushSubscriptionsController do
mention: false,
poll: true,
status: false,
emoji_reaction: false,
}
}
}
@ -66,7 +67,7 @@ describe Api::Web::PushSubscriptionsController do
expect(push_subscription.data['policy']).to eq 'all'
%w(follow follow_request favourite reblog mention poll status).each do |type|
%w(follow follow_request favourite reblog mention poll status emoji_reaction).each do |type|
expect(push_subscription.data['alerts'][type]).to eq(alerts_payload[:data][:alerts][type.to_sym].to_s)
end
end
@ -89,7 +90,7 @@ describe Api::Web::PushSubscriptionsController do
expect(push_subscription.data['policy']).to eq 'all'
%w(follow follow_request favourite reblog mention poll status).each do |type|
%w(follow follow_request favourite reblog mention poll status emoji_reaction).each do |type|
expect(push_subscription.data['alerts'][type]).to eq(alerts_payload[:data][:alerts][type.to_sym].to_s)
end
end

View file

@ -102,6 +102,23 @@ RSpec.describe NotificationMailer, type: :mailer do
end
end
describe "emoji_reaction" do
let(:emoji_reaction) { EmojiReaction.create!(account: sender, status: own_status, name: '😂', custom_emoji: nil) }
let(:mail) { NotificationMailer.emoji_reaction(own_status.account, Notification.create!(account: receiver.account, activity: emoji_reaction)) }
include_examples 'localized subject', 'notification_mailer.emoji_reaction.subject', name: 'bob'
it "renders the headers" do
expect(mail.subject).to eq("bob emoji reactioned your post")
expect(mail.to).to eq([receiver.email])
end
it "renders the body" do
expect(mail.body.encoded).to match("Your post was emoji reactioned by bob")
expect(mail.body.encoded).to include 'The body of the own status'
end
end
describe 'digest' do
before do
mention = Fabricate(:mention, account: receiver.account, status: foreign_status)