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:
Franz Liedke 2020-04-03 14:14:30 +02:00
parent 8c19ba1aaa
commit cd9edf656b
No known key found for this signature in database
GPG Key ID: 9A0231A879B055F4

View File

@ -64,10 +64,10 @@ class ForumSerializer extends AbstractSerializer
'title' => $this->settings->get('forum_title'),
'description' => $this->settings->get('forum_description'),
'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) ?: '',
'debug' => $this->app->inDebugMode(),
'apiUrl' => $this->app->url('api'),
'apiUrl' => $this->url->to('api')->base(),
'welcomeTitle' => $this->settings->get('welcome_title'),
'welcomeMessage' => $this->settings->get('welcome_message'),
'themePrimaryColor' => $this->settings->get('theme_primary_color'),
@ -84,7 +84,7 @@ class ForumSerializer extends AbstractSerializer
];
if ($this->actor->can('administrate')) {
$attributes['adminUrl'] = $this->app->url('admin');
$attributes['adminUrl'] = $this->url->to('admin')->base();
$attributes['version'] = $this->app->version();
}