Fix calls to Setting instead of User preferences

This commit is contained in:
Bubka 2023-03-02 14:34:05 +01:00
parent c5daeb5376
commit 47be24b60f
2 changed files with 6 additions and 5 deletions

View File

@ -17,6 +17,7 @@
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Arr;
use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Crypt;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Log;
@ -386,7 +387,7 @@ public function fillWithOtpParameters(array $parameters, bool $skipIconFetching
$this->enforceAsSteam();
}
if (! $this->icon && Settings::get('getOfficialIcons') && ! $skipIconFetching) {
if (! $this->icon && Auth::user()->preferences['getOfficialIcons'] && ! $skipIconFetching) {
$this->icon = $this->getDefaultIcon();
}
@ -438,7 +439,7 @@ public function fillWithURI(string $uri, bool $isSteamTotp = false, bool $skipIc
self::setIcon($this->generator->getParameter('image'));
}
if (! $this->icon && Settings::get('getOfficialIcons') && ! $skipIconFetching) {
if (! $this->icon && Auth::user()->preferences['getOfficialIcons'] && ! $skipIconFetching) {
$this->icon = $this->getDefaultIcon();
}
@ -676,7 +677,7 @@ private function getDefaultIcon()
{
$logoService = App::make(LogoService::class);
return Settings::get('getOfficialIcons') ? $logoService->getIcon($this->service) : null;
return Auth::user()->preferences['getOfficialIcons'] ? $logoService->getIcon($this->service) : null;
}
/**

View File

@ -86,7 +86,7 @@ public function set($setting, $value = null) : void
foreach ($settings as $setting => $value) {
Option::updateOrCreate(['key' => $setting], ['value' => $value]);
Log::info(sprintf('Setting "%s" is now %s', var_export($setting, true), var_export($this->restoreType($value), true)));
Log::info(sprintf('Setting %s is now %s', var_export($setting, true), var_export($this->restoreType($value), true)));
}
self::buildAndCache();
@ -100,7 +100,7 @@ public function set($setting, $value = null) : void
public function delete(string $name) : void
{
Option::where('key', $name)->delete();
Log::info(sprintf('Setting "%s" deleted', var_export($name, true)));
Log::info(sprintf('Setting %s deleted', var_export($name, true)));
self::buildAndCache();
}