mirror of
https://github.com/flarum/core.git
synced 2025-07-27 19:50:20 +02:00
ForumSerializer: Use UrlGenerator for base URLs
The test from the previous commit proves this works as intended. :) This is one more step in trying to avoid the widespread usage of the `Application` godclass. Refs #2055.
This commit is contained in:
@@ -64,10 +64,10 @@ class ForumSerializer extends AbstractSerializer
|
|||||||
'title' => $this->settings->get('forum_title'),
|
'title' => $this->settings->get('forum_title'),
|
||||||
'description' => $this->settings->get('forum_description'),
|
'description' => $this->settings->get('forum_description'),
|
||||||
'showLanguageSelector' => (bool) $this->settings->get('show_language_selector', true),
|
'showLanguageSelector' => (bool) $this->settings->get('show_language_selector', true),
|
||||||
'baseUrl' => $url = $this->app->url(),
|
'baseUrl' => $url = $this->url->to('forum')->base(),
|
||||||
'basePath' => parse_url($url, PHP_URL_PATH) ?: '',
|
'basePath' => parse_url($url, PHP_URL_PATH) ?: '',
|
||||||
'debug' => $this->app->inDebugMode(),
|
'debug' => $this->app->inDebugMode(),
|
||||||
'apiUrl' => $this->app->url('api'),
|
'apiUrl' => $this->url->to('api')->base(),
|
||||||
'welcomeTitle' => $this->settings->get('welcome_title'),
|
'welcomeTitle' => $this->settings->get('welcome_title'),
|
||||||
'welcomeMessage' => $this->settings->get('welcome_message'),
|
'welcomeMessage' => $this->settings->get('welcome_message'),
|
||||||
'themePrimaryColor' => $this->settings->get('theme_primary_color'),
|
'themePrimaryColor' => $this->settings->get('theme_primary_color'),
|
||||||
@@ -84,7 +84,7 @@ class ForumSerializer extends AbstractSerializer
|
|||||||
];
|
];
|
||||||
|
|
||||||
if ($this->actor->can('administrate')) {
|
if ($this->actor->can('administrate')) {
|
||||||
$attributes['adminUrl'] = $this->app->url('admin');
|
$attributes['adminUrl'] = $this->url->to('admin')->base();
|
||||||
$attributes['version'] = $this->app->version();
|
$attributes['version'] = $this->app->version();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user