Skip to content

Commit

Permalink
Merge branch '2.x' into dev-theming-improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
SychO9 authored Oct 10, 2023
2 parents 0ad0ffc + 24d13e3 commit 2529aab
Show file tree
Hide file tree
Showing 59 changed files with 960 additions and 179 deletions.
45 changes: 24 additions & 21 deletions extensions/mentions/locale/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,40 +70,43 @@ flarum-mentions:
# These translations are used in emails sent when a post is replied to
post_mentioned:
subject: "{replier_display_name} replied to your post in {title}"
body: |
Hey {recipient_display_name}!
plain:
body: |
{replier_display_name} replied to your post (#{post_number}) in {title}.
{replier_display_name} replied to your post (#{post_number}) in {title}.
{url}
{url}
---
---
{content}
{content}
html:
body: "{replier_display_name} replied to your post (#{post_number}) in [{title}]({url})."

# These translations are used in emails sent when a user is mentioned
user_mentioned:
subject: "{mentioner_display_name} mentioned you in {title}"
body: |
Hey {recipient_display_name}!
{mentioner_display_name} mentioned you in a post in {title}.
plain:
body: |
{mentioner_display_name} mentioned you in a post in {title}.
{url}
{url}
---
---
{content}
{content}
html:
body: "{mentioner_display_name} mentioned you in a post in [{title}]({url})."
# These translations are used in emails sent when a group is mentioned
group_mentioned:
subject: "{mentioner_display_name} mentioned a group you're a member of in {title}"
body: |
Hey {recipient_display_name}!
{mentioner_display_name} mentioned a group you're a member of in {title}.
plain:
body: |
{mentioner_display_name} mentioned a group you're a member of in {title}.
{url}
{url}
---
---
{content}
{content}
html:
body: "{mentioner_display_name} mentioned a group you're a member of in [{title}]({url})."
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,11 @@ public function getData(): mixed
return null;
}

public function getEmailView(): string|array
public function getEmailViews(): array
{
return ['text' => 'flarum-mentions::emails.groupMentioned'];
return [
'text' => 'flarum-mentions::emails.plain.groupMentioned',
'html' => 'flarum-mentions::emails.html.groupMentioned', ];
}

public function getEmailSubject(TranslatorInterface $translator): string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,12 @@ public function getData(): array
return ['replyNumber' => (int) $this->reply->number];
}

public function getEmailView(): string|array
public function getEmailViews(): array
{
return ['text' => 'flarum-mentions::emails.postMentioned'];
return [
'text' => 'flarum-mentions::emails.plain.postMentioned',
'html' => 'flarum-mentions::emails.html.postMentioned',
];
}

public function getEmailSubject(TranslatorInterface $translator): string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,12 @@ public function getData(): mixed
return null;
}

public function getEmailView(): string|array
public function getEmailViews(): array
{
return ['text' => 'flarum-mentions::emails.userMentioned'];
return [
'text' => 'flarum-mentions::emails.plain.userMentioned',
'html' => 'flarum-mentions::emails.html.userMentioned'
];
}

public function getEmailSubject(TranslatorInterface $translator): string
Expand Down
13 changes: 13 additions & 0 deletions extensions/mentions/views/emails/html/groupMentioned.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
@extends('flarum.forum::email.html.notification.base')

@section('notificationContent')
{!! $formatter->convert($translator->trans('flarum-mentions.email.group_mentioned.html.body', [
'{mentioner_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
14 changes: 14 additions & 0 deletions extensions/mentions/views/emails/html/postMentioned.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
@extends('flarum.forum::email.html.notification.base')

@section('notificationContent')
{!! $formatter->convert($translator->trans('flarum-mentions.email.post_mentioned.html.body', [
'{replier_display_name}' => $blueprint->reply->user->display_name,
'{post_number}' => $blueprint->post->number,
'{title}' => $blueprint->post->discussion->title,
'{url}' => $url->to('forum')->route('discussion', ['id' => $blueprint->reply->discussion_id, 'near' => $blueprint->reply->number])
])) !!}
@endsection

@section('contentPreview')
{!! $blueprint->reply->formatContent() !!}
@endsection
13 changes: 13 additions & 0 deletions extensions/mentions/views/emails/html/userMentioned.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
@extends('flarum.forum::email.html.notification.base')

@section('notificationContent')
{!! $formatter->convert($translator->trans('flarum-mentions.email.user_mentioned.html.body', [
'{mentioner_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
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
{!! $translator->trans('flarum-mentions.email.group_mentioned.body', [
'{recipient_display_name}' => $user->display_name,
@extends('flarum.forum::email.plain.notification.base')

@section('content')
{!! $translator->trans('flarum-mentions.email.group_mentioned.plain.body', [
'{mentioner_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
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
{!! $translator->trans('flarum-mentions.email.post_mentioned.body', [
'{recipient_display_name}' => $user->display_name,
@extends('flarum.forum::email.plain.notification.base')

@section('content')
{!! $translator->trans('flarum-mentions.email.post_mentioned.plain.body', [
'{replier_display_name}' => $blueprint->reply->user->display_name,
'{post_number}' => $blueprint->post->number,
'{title}' => $blueprint->post->discussion->title,
'{url}' => $url->to('forum')->route('discussion', ['id' => $blueprint->reply->discussion_id, 'near' => $blueprint->reply->number]),
'{content}' => $blueprint->reply->content
]) !!}
@endsection
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
{!! $translator->trans('flarum-mentions.email.user_mentioned.body', [
'{recipient_display_name}' => $user->display_name,
@extends('flarum.forum::email.plain.notification.base')

@section('content')
{!! $translator->trans('flarum-mentions.email.user_mentioned.plain.body', [
'{mentioner_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
22 changes: 13 additions & 9 deletions extensions/subscriptions/locale/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,11 @@ public function getData(): array
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
Expand Down
13 changes: 13 additions & 0 deletions extensions/subscriptions/views/emails/html/newPost.blade.php
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
26 changes: 14 additions & 12 deletions extensions/suspend/locale/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,20 +52,22 @@ flarum-suspend:
no_reason_given: No reason was given for this suspension.
suspended:
subject: Your account has been suspended
body: |
Hey {recipient_display_name},
plain:
body: |
You have been suspended for the following reason:
You have been suspended for the following reason:
---
{suspension_message}
---
---
{suspension_message}
---
html:
body: "You have been suspended from {forumTitle} for the following reason:"

unsuspended:
subject: Your account has been unsuspended
body: |
Hey {recipient_display_name},
You have been unsuspended. You can head back to the forum by clicking on the following link:
plain:
body: |
You have been unsuspended. You can head back to the forum by clicking on the following link:
{forum_url}
{forum_url}
html:
body: "You have been unsuspended. You can head back to [{forumTitle}]({forum_url}) when you are ready."
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

namespace Flarum\Suspend\Notification;

use Carbon\Carbon;
use Carbon\CarbonInterface;
use Flarum\Database\AbstractModel;
use Flarum\Locale\TranslatorInterface;
Expand All @@ -35,7 +36,7 @@ public function getFromUser(): ?User

public function getData(): CarbonInterface
{
return $this->user->suspended_until;
return Carbon::now();
}

public static function getType(): string
Expand All @@ -48,9 +49,11 @@ public static function getSubjectModel(): string
return User::class;
}

public function getEmailView(): string|array
public function getEmailViews(): array
{
return ['text' => 'flarum-suspend::emails.suspended'];
return [
'text' => 'flarum-suspend::emails.plain.suspended',
'html' => 'flarum-suspend::emails.html.suspended', ];
}

public function getEmailSubject(TranslatorInterface $translator): string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,11 @@ public static function getSubjectModel(): string
return User::class;
}

public function getEmailView(): string|array
public function getEmailViews(): array
{
return ['text' => 'flarum-suspend::emails.unsuspended'];
return [
'text' => 'flarum-suspend::emails.plain.unsuspended',
'html' => 'flarum-suspend::emails.html.unsuspended', ];
}

public function getEmailSubject(TranslatorInterface $translator): string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function can_suspend_user_if_allowed(?int $authenticatedAs, int $targetUs
{
$response = $this->sendSuspensionRequest($authenticatedAs, $targetUserId);

$this->assertEquals(200, $response->getStatusCode());
$this->assertEquals(200, $response->getStatusCode(), $response->getBody()->getContents());
}

/**
Expand Down
11 changes: 11 additions & 0 deletions extensions/suspend/views/emails/html/suspended.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
@extends('flarum.forum::email.html.information.base')

@section('informationContent')
{!! $formatter->convert($translator->trans('flarum-suspend.email.suspended.html.body', [
'{forumTitle}' => $settings->get('forum_title')
])) !!}
@endsection

@section('contentPreview')
{!! $formatter->convert($blueprint->user->suspend_message ?? $translator->trans('flarum-suspend.email.no_reason_given')) !!}
@endsection
8 changes: 8 additions & 0 deletions extensions/suspend/views/emails/html/unsuspended.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
@extends('flarum.forum::email.html.information.base')

@section('content')
{!! $formatter->convert($translator->trans('flarum-suspend.email.unsuspended.html.body', [
'{forumTitle}' => $settings->get('forum_title'),
'{forum_url}' => $url->to('forum')->base(),
])) !!}
@endsection
7 changes: 7 additions & 0 deletions extensions/suspend/views/emails/plain/suspended.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
@extends('flarum.forum::email.plain.information.base')

@section('content')
{!! $translator->trans('flarum-suspend.email.suspended.plain.body', [
'{suspension_message}' => $blueprint->user->suspend_message ?? $translator->trans('flarum-suspend.email.no_reason_given'),
]) !!}
@endsection
7 changes: 7 additions & 0 deletions extensions/suspend/views/emails/plain/unsuspended.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
@extends('flarum.forum::email.plain.information.base')

@section('content')
{!! $translator->trans('flarum-suspend.email.unsuspended.plain.body', [
'{forum_url}' => $url->to('forum')->base(),
]) !!}
@endsection
4 changes: 0 additions & 4 deletions extensions/suspend/views/emails/suspended.blade.php

This file was deleted.

Loading

0 comments on commit 2529aab

Please sign in to comment.