FEATURE: Send an email notification when a post is approved. (#12665)

We now send an email when a queued post is approved, and we create a notification.
This commit is contained in:
Roman Rizzi
2021-04-12 12:08:23 -03:00
committed by GitHub
parent 045adb76f2
commit 958fbfb719
6 changed files with 51 additions and 3 deletions
+13
View File
@@ -80,6 +80,19 @@ describe UserNotifications do
end
end
describe '.post_approved' do
fab!(:post) { Fabricate(:post) }
it 'works' do
subject = UserNotifications.post_approved(user, { notification_data_hash: { post_url: post.url } })
expect(subject.to).to eq([user.email])
expect(subject.subject).to be_present
expect(subject.from).to eq([SiteSetting.notification_email])
expect(subject.body).to be_present
end
end
describe ".confirm_new_email" do
let(:opts) do
{ requested_by_admin: requested_by_admin, email_token: token }