Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 21 additions & 15 deletions Web/Presenters/UserPresenter.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,23 +28,29 @@ function __construct(Users $users)
function renderView(int $id): void
{
$user = $this->users->get($id);
if(!$user || $user->isDeleted()) {
if($user->isDeactivated()) {
$this->template->_template = "User/deactivated.xml";

$this->template->user = $user;
$canViewDeleted = $this->user->identity->getChandlerUser()->can("access")->model("admin")->whichBelongsTo(NULL) === OPENVK_ROOT_CONF["openvk"]["preferences"]["security"]["adminsCanViewDeletedUsers"];

if ($user === NULL) {
$this->template->_template = "User/deleted.xml";
} else {
if ($user->isDeleted() AND !$canViewDeleted) {
if ($user->isDeactivated()) {
$this->template->_template = "User/deactivated.xml";

$this->template->user = $user;
} else {
$this->template->_template = "User/deleted.xml";
}
} else {
$this->template->_template = "User/deleted.xml";
$this->template->albums = (new Albums)->getUserAlbums($user);
$this->template->albumsCount = (new Albums)->getUserAlbumsCount($user);
$this->template->videos = (new Videos)->getByUser($user, 1, 2);
$this->template->videosCount = (new Videos)->getUserVideosCount($user);
$this->template->notes = (new Notes)->getUserNotes($user, 1, 4);
$this->template->notesCount = (new Notes)->getUserNotesCount($user);

$this->template->user = $user;
}
} else {
$this->template->albums = (new Albums)->getUserAlbums($user);
$this->template->albumsCount = (new Albums)->getUserAlbumsCount($user);
$this->template->videos = (new Videos)->getByUser($user, 1, 2);
$this->template->videosCount = (new Videos)->getUserVideosCount($user);
$this->template->notes = (new Notes)->getUserNotes($user, 1, 4);
$this->template->notesCount = (new Notes)->getUserNotesCount($user);

$this->template->user = $user;
}
}

Expand Down
3 changes: 3 additions & 0 deletions Web/Presenters/templates/User/View.xml
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,9 @@
<div class="right_big_block">
<div class="page_info">
<div n:if="!is_null($alert = $user->getAlert())" class="user-alert">{strpos($alert, "@") === 0 ? tr(substr($alert, 1)) : $alert}</div>
<div n:if="$thisUser->getChandlerUser()->can('access')->model('admin')->whichBelongsTo(NULL) AND $user->isDeactivated()" class="user-alert">
Вы просматриваете страницу удалённого пользователя.
</div>
{var $thatIsThisUser = isset($thisUser) && $user->getId() == $thisUser->getId()}
<div n:if="$thatIsThisUser" class="page_status_popup" id="status_editor" style="display: none;">
<form name="status_popup_form" onsubmit="changeStatus(); return false;">
Expand Down
1 change: 1 addition & 0 deletions openvk-example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ openvk:
maxViolations: 50
maxViolationsAge: 120
autoban: true
adminsCanViewDeletedUsers: false
registration:
enable: true
reason: "" # reason for disabling registration
Expand Down