mirror of
https://github.com/openvk/openvk
synced 2024-11-11 01:19:53 +03:00
Notifications: Automatically redirect to archive tab if there is no new notifs (until if user will manually go to unread tab)
This commit is contained in:
parent
5f3f3299de
commit
5b2d18e96b
2 changed files with 12 additions and 3 deletions
|
@ -6,9 +6,18 @@ final class NotificationPresenter extends OpenVKPresenter
|
|||
function renderFeed(): void
|
||||
{
|
||||
$this->assertUserLoggedIn();
|
||||
|
||||
|
||||
$archive = $this->queryParam("act") === "archived";
|
||||
$this->template->mode = $archive ? "archived" : "new";
|
||||
$count = $this->user->identity->getNotificationsCount($archive);
|
||||
|
||||
if($count == 0 && $this->queryParam("act") == NULL) {
|
||||
$mode = "archived";
|
||||
$archive = true;
|
||||
} else {
|
||||
$mode = $archive ? "archived" : "new";
|
||||
}
|
||||
|
||||
$this->template->mode = $mode;
|
||||
$this->template->page = (int) ($this->queryParam("p") ?? 1);
|
||||
$this->template->iterator = iterator_to_array($this->user->identity->getNotifications($this->template->page, $archive));
|
||||
$this->template->count = $this->user->identity->getNotificationsCount($archive);
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
{block tabs}
|
||||
<div n:attr="id => ($mode === 'new' ? 'activetabs' : 'ki')" class="tab">
|
||||
<a n:attr="id => ($mode === 'new' ? 'act_tab_a' : 'ki')" href="?">{_unread}</a>
|
||||
<a n:attr="id => ($mode === 'new' ? 'act_tab_a' : 'ki')" href="?act=new">{_unread}</a>
|
||||
</div>
|
||||
<div n:attr="id => ($mode === 'archived' ? 'activetabs' : 'ki')" class="tab">
|
||||
<a n:attr="id => ($mode === 'archived' ? 'act_tab_a' : 'ki')" href="?act=archived">{_archive}</a>
|
||||
|
|
Loading…
Reference in a new issue