mirror of
https://github.com/flarum/core.git
synced 2025-08-20 07:11:31 +02:00
feat: notification unsubscribe & email overhaul with HTML multipart (#3872)
This commit is contained in:
@@ -51,21 +51,25 @@ flarum-subscriptions:
|
||||
# These translations are used in emails sent when a post is made in a subscribed discussion
|
||||
new_post:
|
||||
subject: "[New Post] {title}"
|
||||
body: |
|
||||
Hey {recipient_display_name}!
|
||||
plain:
|
||||
body: |
|
||||
{poster_display_name} just posted in a discussion you're following: {title}.
|
||||
|
||||
{poster_display_name} made a post in a discussion you're following: {title}.
|
||||
To view the new activity, check out the following link:
|
||||
{url}
|
||||
|
||||
To view the new activity, check out the following link:
|
||||
{url}
|
||||
---
|
||||
|
||||
---
|
||||
{content}
|
||||
|
||||
{content}
|
||||
---
|
||||
|
||||
---
|
||||
You won't receive any more notifications about this discussion until you're up-to-date.
|
||||
html:
|
||||
body: |
|
||||
{poster_display_name} just posted in a discussion you're following: [{title}]({url}).
|
||||
|
||||
You won't receive any more notifications about this discussion until you're up-to-date.
|
||||
You won't recieve any more notifications about this discussion until you're up-to-date.
|
||||
|
||||
##
|
||||
# REUSED TRANSLATIONS - These keys should not be used directly in code!
|
||||
|
@@ -39,9 +39,11 @@ class NewPostBlueprint implements BlueprintInterface, MailableInterface
|
||||
return ['postNumber' => (int) $this->post->number];
|
||||
}
|
||||
|
||||
public function getEmailView(): string|array
|
||||
public function getEmailViews(): array
|
||||
{
|
||||
return ['text' => 'flarum-subscriptions::emails.newPost'];
|
||||
return [
|
||||
'text' => 'flarum-subscriptions::emails.plain.newPost',
|
||||
'html' => 'flarum-subscriptions::emails.html.newPost', ];
|
||||
}
|
||||
|
||||
public function getEmailSubject(TranslatorInterface $translator): string
|
||||
|
13
extensions/subscriptions/views/emails/html/newPost.blade.php
Normal file
13
extensions/subscriptions/views/emails/html/newPost.blade.php
Normal file
@@ -0,0 +1,13 @@
|
||||
@extends('flarum.forum::email.html.notification.base')
|
||||
|
||||
@section('notificationContent')
|
||||
{!! $formatter->convert($translator->trans('flarum-subscriptions.email.new_post.html.body', [
|
||||
'{poster_display_name}' => $blueprint->post->user->display_name,
|
||||
'{title}' => $blueprint->post->discussion->title,
|
||||
'{url}' => $url->to('forum')->route('discussion', ['id' => $blueprint->post->discussion_id, 'near' => $blueprint->post->number])
|
||||
])) !!}
|
||||
@endsection
|
||||
|
||||
@section('contentPreview')
|
||||
{!! $blueprint->post->formatContent() !!}
|
||||
@endsection
|
@@ -1,7 +1,10 @@
|
||||
{!! $translator->trans('flarum-subscriptions.email.new_post.body', [
|
||||
'{recipient_display_name}' => $user->display_name,
|
||||
@extends('flarum.forum::email.plain.notification.base')
|
||||
|
||||
@section('content')
|
||||
{!! $translator->trans('flarum-subscriptions.email.new_post.plain.body', [
|
||||
'{poster_display_name}' => $blueprint->post->user->display_name,
|
||||
'{title}' => $blueprint->post->discussion->title,
|
||||
'{url}' => $url->to('forum')->route('discussion', ['id' => $blueprint->post->discussion_id, 'near' => $blueprint->post->number]),
|
||||
'{content}' => $blueprint->post->content
|
||||
]) !!}
|
||||
@endsection
|
Reference in New Issue
Block a user