Fix missing status_reference to push notification
This commit is contained in:
parent
913cf3520a
commit
57ddd35698
6 changed files with 26 additions and 4 deletions
|
@ -27,6 +27,7 @@ class Api::Web::PushSubscriptionsController < Api::Web::BaseController
|
||||||
poll: alerts_enabled,
|
poll: alerts_enabled,
|
||||||
status: alerts_enabled,
|
status: alerts_enabled,
|
||||||
emoji_reaction: alerts_enabled,
|
emoji_reaction: alerts_enabled,
|
||||||
|
status_reference: alerts_enabled,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,6 +63,6 @@ class Api::Web::PushSubscriptionsController < Api::Web::BaseController
|
||||||
end
|
end
|
||||||
|
|
||||||
def data_params
|
def data_params
|
||||||
@data_params ||= params.require(:data).permit(:policy, alerts: [:follow, :follow_request, :favourite, :reblog, :mention, :poll, :status, :emoji_reaction])
|
@data_params ||= params.require(:data).permit(:policy, alerts: [:follow, :follow_request, :favourite, :reblog, :mention, :poll, :status, :emoji_reaction, :status_reference])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -13,6 +13,7 @@ const initialState = Immutable.Map({
|
||||||
poll: false,
|
poll: false,
|
||||||
status: false,
|
status: false,
|
||||||
emoji_reaction: false,
|
emoji_reaction: false,
|
||||||
|
status_reference: false,
|
||||||
}),
|
}),
|
||||||
isSubscribed: false,
|
isSubscribed: false,
|
||||||
browserSupport: false,
|
browserSupport: false,
|
||||||
|
|
|
@ -22,6 +22,7 @@ filenames.forEach(filename => {
|
||||||
'notification.status': full['notification.status'] || '',
|
'notification.status': full['notification.status'] || '',
|
||||||
'notification.poll': full['notification.poll'] || '',
|
'notification.poll': full['notification.poll'] || '',
|
||||||
'notification.emoji_reaction': full['notification.emoji_reaction'] || '',
|
'notification.emoji_reaction': full['notification.emoji_reaction'] || '',
|
||||||
|
'notification.status_reference': full['notification.status_reference'] || '',
|
||||||
|
|
||||||
'status.show_more': full['status.show_more'] || '',
|
'status.show_more': full['status.show_more'] || '',
|
||||||
'status.reblog': full['status.reblog'] || '',
|
'status.reblog': full['status.reblog'] || '',
|
||||||
|
|
|
@ -38,6 +38,7 @@ describe Api::V1::Push::SubscriptionsController do
|
||||||
poll: true,
|
poll: true,
|
||||||
status: false,
|
status: false,
|
||||||
emoji_reaction: false,
|
emoji_reaction: false,
|
||||||
|
status_reference: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}.with_indifferent_access
|
}.with_indifferent_access
|
||||||
|
@ -75,7 +76,7 @@ describe Api::V1::Push::SubscriptionsController do
|
||||||
|
|
||||||
expect(push_subscription.data['policy']).to eq(alerts_payload[:data][:policy])
|
expect(push_subscription.data['policy']).to eq(alerts_payload[:data][:policy])
|
||||||
|
|
||||||
%w(follow follow_request favourite reblog mention poll status emoji_reaction).each do |type|
|
%w(follow follow_request favourite reblog mention poll status emoji_reaction status_reference).each do |type|
|
||||||
expect(push_subscription.data['alerts'][type]).to eq(alerts_payload[:data][:alerts][type.to_sym].to_s)
|
expect(push_subscription.data['alerts'][type]).to eq(alerts_payload[:data][:alerts][type.to_sym].to_s)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -33,6 +33,7 @@ describe Api::Web::PushSubscriptionsController do
|
||||||
poll: true,
|
poll: true,
|
||||||
status: false,
|
status: false,
|
||||||
emoji_reaction: false,
|
emoji_reaction: false,
|
||||||
|
status_reference: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -67,7 +68,7 @@ describe Api::Web::PushSubscriptionsController do
|
||||||
|
|
||||||
expect(push_subscription.data['policy']).to eq 'all'
|
expect(push_subscription.data['policy']).to eq 'all'
|
||||||
|
|
||||||
%w(follow follow_request favourite reblog mention poll status emoji_reaction).each do |type|
|
%w(follow follow_request favourite reblog mention poll status emoji_reaction status_reference).each do |type|
|
||||||
expect(push_subscription.data['alerts'][type]).to eq(alerts_payload[:data][:alerts][type.to_sym].to_s)
|
expect(push_subscription.data['alerts'][type]).to eq(alerts_payload[:data][:alerts][type.to_sym].to_s)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -90,7 +91,7 @@ describe Api::Web::PushSubscriptionsController do
|
||||||
|
|
||||||
expect(push_subscription.data['policy']).to eq 'all'
|
expect(push_subscription.data['policy']).to eq 'all'
|
||||||
|
|
||||||
%w(follow follow_request favourite reblog mention poll status emoji_reaction).each do |type|
|
%w(follow follow_request favourite reblog mention poll status emoji_reaction status_reference).each do |type|
|
||||||
expect(push_subscription.data['alerts'][type]).to eq(alerts_payload[:data][:alerts][type.to_sym].to_s)
|
expect(push_subscription.data['alerts'][type]).to eq(alerts_payload[:data][:alerts][type.to_sym].to_s)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -119,6 +119,23 @@ RSpec.describe NotificationMailer, type: :mailer do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe "status_reference" do
|
||||||
|
let(:status_reference) { StatusReference.create!(status: foreign_status, target_status: own_status) }
|
||||||
|
let(:mail) { NotificationMailer.status_reference(own_status.account, Notification.create!(account: receiver.account, activity: status_reference)) }
|
||||||
|
|
||||||
|
include_examples 'localized subject', 'notification_mailer.status_reference.subject', name: 'bob'
|
||||||
|
|
||||||
|
it "renders the headers" do
|
||||||
|
expect(mail.subject).to eq("bob referenced your post")
|
||||||
|
expect(mail.to).to eq([receiver.email])
|
||||||
|
end
|
||||||
|
|
||||||
|
it "renders the body" do
|
||||||
|
expect(mail.body.encoded).to match("Your post was referenced by bob")
|
||||||
|
expect(mail.body.encoded).to include 'The body of the foreign status'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
describe 'digest' do
|
describe 'digest' do
|
||||||
before do
|
before do
|
||||||
mention = Fabricate(:mention, account: receiver.account, status: foreign_status)
|
mention = Fabricate(:mention, account: receiver.account, status: foreign_status)
|
||||||
|
|
Loading…
Reference in a new issue