Skip to content

Commit

Permalink
fix suspension not rendering the reason in html view
Browse files Browse the repository at this point in the history
  • Loading branch information
imorland committed Sep 18, 2023
1 parent 0185c34 commit 6197de3
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
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 Down
5 changes: 2 additions & 3 deletions extensions/suspend/views/emails/html/suspended.blade.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
@extends('flarum.forum::email.html.information.base')

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

@section('contentPreview')
{!! $formatter->convert(($blueprint->user->suspend_message ?? $translator->trans('flarum-suspend.email.no_reason_given'))) !!}
{!! $formatter->convert($blueprint->user->suspend_message ?? $translator->trans('flarum-suspend.email.no_reason_given')) !!}
@endsection
1 change: 0 additions & 1 deletion extensions/suspend/views/emails/plain/suspended.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

@section('content')
{!! $translator->trans('flarum-suspend.email.suspended.plain.body', [
'{recipient_display_name}' => $user->display_name,
'{suspension_message}' => $blueprint->user->suspend_message ?? $translator->trans('flarum-suspend.email.no_reason_given'),
]) !!}
@endsection
6 changes: 5 additions & 1 deletion framework/core/views/email/html/information/base.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@
@endsection

@section('content')
<p>{!! $formatter->convert($infoContent) !!}</p>
@if(isset($infoContent))
<p>{!! $formatter->convert($infoContent) !!}</p>
@else
@yield('informationContent')
@endif
@hasSection('contentPreview')
<div class="content-preview">
@yield('contentPreview')
Expand Down

0 comments on commit 6197de3

Please sign in to comment.