Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions framework/core/src/Mail/MailServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@
use Flarum\User\UserRepository;
use Illuminate\Contracts\Container\Container;
use Illuminate\Contracts\Events\Dispatcher;
use Illuminate\Contracts\Filesystem\Factory as FilesystemFactory;
use Illuminate\Contracts\Mail\Mailer as MailerContract;
use Illuminate\Contracts\Validation\Factory;
use Illuminate\Contracts\View\Factory as ViewFactory;
use Illuminate\Mail\Events\MessageSending;
use Illuminate\Support\Arr;
use Psr\Log\LoggerInterface;
Expand Down Expand Up @@ -99,8 +101,18 @@ public function register(): void
});
}

public function boot(Dispatcher $events): void
{
public function boot(
Dispatcher $events,
ViewFactory $views,
FilesystemFactory $filesystemFactory,
SettingsRepositoryInterface $settings,
): void {
$events->listen(MessageSending::class, MutateEmail::class);

// Resolve the logo URL via the flarum-assets disk so it stays correct on
// installs whose assets are served from a remote bucket / CDN — same path
// ForumResource::getLogoUrl() uses for the frontend.
$logoPath = $settings->get('logo_path');
$views->share('logoUrl', $logoPath ? $filesystemFactory->disk('flarum-assets')->url($logoPath) : null);
}
}
4 changes: 2 additions & 2 deletions framework/core/views/email/html.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@
<div class="header">
<div class="Header-title">
<a href="{{ $url->to('forum')->base() }}" id="home-link">
@if ($settings->get('logo_path'))
<img src="{{ $url->to('forum')->base() . '/assets/' . $settings->get('logo_path') }}" alt="{{ $settings->get('forum_title') }}" class="Header-logo">
@if ($logoUrl)
<img src="{{ $logoUrl }}" alt="{{ $settings->get('forum_title') }}" class="Header-logo">
@else
{{ $settings->get('forum_title') }}
@endif
Expand Down
Loading