fix: set per-user instead of globally
This commit is contained in:
@ -12,23 +12,23 @@ class AppSettings {
|
||||
public function __construct(private IConfig $config) {
|
||||
}
|
||||
|
||||
public function getStringSetting(string $key, string $default = ''): string {
|
||||
return $this->config->getAppValue(AppConstants::APP_ID, $key) ?: $default;
|
||||
public function getStringSetting($userId, string $key, string $default = ''): string {
|
||||
return $this->config->getUserValue(AppConstants::APP_ID, $userId, $key) ?: $default;
|
||||
}
|
||||
|
||||
public function setStringSetting(string $key, string $value): void {
|
||||
$this->config->setAppValue(AppConstants::APP_ID, $key, $value);
|
||||
public function setStringSetting($userId, string $key, string $value): void {
|
||||
$this->config->setUserValue(AppConstants::APP_ID, $userId, $key, $value);
|
||||
}
|
||||
|
||||
public function getAll(): array {
|
||||
public function getAll($userId): array {
|
||||
return [
|
||||
AppSettings::FOLDER_VARIANT => $this->getStringSetting(AppSettings::FOLDER_VARIANT, 'pride'),
|
||||
AppSettings::BUTTON_VARIANT => $this->getStringSetting(AppSettings::BUTTON_VARIANT, 'trans'),
|
||||
AppSettings::FOLDER_VARIANT => $this->getStringSetting($userId, AppSettings::FOLDER_VARIANT, 'pride'),
|
||||
AppSettings::BUTTON_VARIANT => $this->getStringSetting($userId, AppSettings::BUTTON_VARIANT, 'trans'),
|
||||
];
|
||||
}
|
||||
|
||||
public function set($folder, $button): void {
|
||||
$this->setStringSetting(AppSettings::FOLDER_VARIANT, $folder);
|
||||
$this->setStringSetting(AppSettings::BUTTON_VARIANT, $button);
|
||||
public function set($userId, $folder, $button): void {
|
||||
$this->setStringSetting($userId, AppSettings::FOLDER_VARIANT, $folder);
|
||||
$this->setStringSetting($userId, AppSettings::BUTTON_VARIANT, $button);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user