Notifications: Fix code style + little bit of performance

This commit is contained in:
veselcraft 2022-05-26 15:26:38 +03:00
parent b3e597959c
commit 39c85451fc
No known key found for this signature in database
GPG key ID: AED66BC1AC628A4E

View file

@ -8,7 +8,7 @@ final class NotificationPresenter extends OpenVKPresenter
$this->assertUserLoggedIn(); $this->assertUserLoggedIn();
$archive = $this->queryParam("act") === "archived"; $archive = $this->queryParam("act") === "archived";
$count = $this->user->identity->getNotificationsCount($archive); $count = $this->user->identity->getNotificationsCount($archive);
if($count == 0 && $this->queryParam("act") == NULL) { if($count == 0 && $this->queryParam("act") == NULL) {
$mode = "archived"; $mode = "archived";
@ -20,7 +20,7 @@ final class NotificationPresenter extends OpenVKPresenter
$this->template->mode = $mode; $this->template->mode = $mode;
$this->template->page = (int) ($this->queryParam("p") ?? 1); $this->template->page = (int) ($this->queryParam("p") ?? 1);
$this->template->iterator = iterator_to_array($this->user->identity->getNotifications($this->template->page, $archive)); $this->template->iterator = iterator_to_array($this->user->identity->getNotifications($this->template->page, $archive));
$this->template->count = $this->user->identity->getNotificationsCount($archive); $this->template->count = $count;
$this->user->identity->updateNotificationOffset(); $this->user->identity->updateNotificationOffset();
$this->user->identity->save(); $this->user->identity->save();