diff --git a/Web/Models/Entities/User.php b/Web/Models/Entities/User.php index fe82e30f..e73bfb29 100644 --- a/Web/Models/Entities/User.php +++ b/Web/Models/Entities/User.php @@ -683,6 +683,28 @@ class User extends RowModel return FALSE; } + /** + * 0 - Default status + * 1 - Incognito online status + * 2 - Page of a dead person + */ + function onlineStatus(): int + { + switch ($this->getRecord()->online) { + case 1: + return 1; + break; + + case 2: + return 2; + break; + + default: + return 0; + break; + } + } + use Traits\TSubscribable; } diff --git a/Web/Presenters/OpenVKPresenter.php b/Web/Presenters/OpenVKPresenter.php index 9aedc6fa..e74114ed 100644 --- a/Web/Presenters/OpenVKPresenter.php +++ b/Web/Presenters/OpenVKPresenter.php @@ -196,8 +196,11 @@ abstract class OpenVKPresenter extends SimplePresenter exit; } - $this->user->identity->setOnline(time()); - $this->user->identity->save(); + if ($this->user->identity->onlineStatus() == 0) { + $this->user->identity->setOnline(time()); + $this->user->identity->save(); + } + } setlocale(LC_TIME, ...(explode(";", tr("__locale")))); diff --git a/Web/Presenters/templates/User/View.xml b/Web/Presenters/templates/User/View.xml index 063a2bdf..e18fc1fd 100644 --- a/Web/Presenters/templates/User/View.xml +++ b/Web/Presenters/templates/User/View.xml @@ -40,6 +40,9 @@ {_was_online} {$user->getOnline()} {/if} +