From cd9edf656b67696b1f8fcf1df9ba97d6ebd088be Mon Sep 17 00:00:00 2001 From: Franz Liedke Date: Fri, 3 Apr 2020 14:14:30 +0200 Subject: [PATCH] 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. --- src/Api/Serializer/ForumSerializer.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Api/Serializer/ForumSerializer.php b/src/Api/Serializer/ForumSerializer.php index 4ad5d891a..5a717eaa4 100644 --- a/src/Api/Serializer/ForumSerializer.php +++ b/src/Api/Serializer/ForumSerializer.php @@ -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(); }