X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/615741af9d36c725299cc8fc9c0ee012bd3d5759..refs/pull/5676/head:/app/Activity/Tools/UserEntityWatchOptions.php diff --git a/app/Activity/Tools/UserEntityWatchOptions.php b/app/Activity/Tools/UserEntityWatchOptions.php index 08fbe2e8d..559d7903d 100644 --- a/app/Activity/Tools/UserEntityWatchOptions.php +++ b/app/Activity/Tools/UserEntityWatchOptions.php @@ -22,7 +22,7 @@ class UserEntityWatchOptions public function canWatch(): bool { - return $this->user->can('receive-notifications') && !$this->user->isDefault(); + return $this->user->can('receive-notifications') && !$this->user->isGuest(); } public function getWatchLevel(): string @@ -51,15 +51,20 @@ class UserEntityWatchOptions return null; } - public function updateWatchLevel(string $level): void + public function updateLevelByName(string $level): void { $levelValue = WatchLevels::levelNameToValue($level); - if ($levelValue < 0) { + $this->updateLevelByValue($levelValue); + } + + public function updateLevelByValue(int $level): void + { + if ($level < 0) { $this->remove(); return; } - $this->updateLevel($levelValue); + $this->updateLevel($level); } public function getWatchMap(): array