From b74e50ccc518516c1c73242f4bf255c9a2fca92f Mon Sep 17 00:00:00 2001 From: "Tomas Palider (DJTommek)" Date: Sun, 21 Jul 2024 23:10:35 +0200 Subject: [PATCH] Chat presenter: fixed not using AddressProvider --- src/libs/Web/Chat/ChatPresenter.php | 9 ++++++++- src/templates/chat.latte | 1 - 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/libs/Web/Chat/ChatPresenter.php b/src/libs/Web/Chat/ChatPresenter.php index 0079b4c4..83f7d68d 100644 --- a/src/libs/Web/Chat/ChatPresenter.php +++ b/src/libs/Web/Chat/ChatPresenter.php @@ -2,6 +2,7 @@ namespace App\Web\Chat; +use App\Address\AddressProvider; use App\BetterLocation\ProcessExample; use App\BetterLocation\ServicesManager; use App\Chat; @@ -36,6 +37,7 @@ public function __construct( private readonly ServicesManager $servicesManager, private readonly ClientInterface $httpClient, private readonly ProcessExample $processExample, + private readonly AddressProvider $addressProvider, ChatTemplate $template, ) { $this->template = $template; @@ -99,7 +101,12 @@ public function beforeRender(): void } } - $this->template->exampleLocation = $exampleCollection->getFirst(); + $location = $exampleCollection->getFirst(); + if ($this->chat->settingsShowAddress() && $location->hasAddress() === false) { + $location->setAddress($this->addressProvider->reverse($location)->getAddress()); + } + + $this->template->exampleLocation = $location; $this->template->prepareOk($this->chatResponse, $this->servicesManager); $this->template->chat = $this->chat; diff --git a/src/templates/chat.latte b/src/templates/chat.latte index b854ec64..e96dcf6b 100644 --- a/src/templates/chat.latte +++ b/src/templates/chat.latte @@ -283,7 +283,6 @@ {if $chat->settingsShowAddress()}
- {$exampleLocation->generateAddress()} {$exampleLocation->getAddress()} {/if}