Skip to content

Commit

Permalink
fix visibility info no longer being shown (#767)
Browse files Browse the repository at this point in the history
  • Loading branch information
e-five256 committed May 5, 2024
1 parent da0615f commit 10bbe43
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
7 changes: 4 additions & 3 deletions src/Controller/Entry/EntryFrontController.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function front(?string $sortBy, ?string $time, ?string $type, string $sub
$templatePath = ('threads' === $content) ? 'entry/' : 'post/';
$dataKey = ('threads' === $content) ? 'entries' : 'posts';

return $this->renderResponse($request, $content, $criteria, [$dataKey => $entities], $templatePath);
return $this->renderResponse($request, $content, $criteria, [$dataKey => $entities], $templatePath, $user);
}

// $name is magazine name, for compatibility
Expand Down Expand Up @@ -120,7 +120,7 @@ public function magazine(
$templatePath = ('threads' === $content) ? 'entry/' : 'post/';
$dataKey = ('threads' === $content) ? 'entries' : 'posts';

return $this->renderResponse($request, $content, $criteria, [$dataKey => $entities, 'magazine' => $magazine], $templatePath);
return $this->renderResponse($request, $content, $criteria, [$dataKey => $entities, 'magazine' => $magazine], $templatePath, $user);
}

private function createCriteria(string $content, Request $request)
Expand Down Expand Up @@ -162,7 +162,7 @@ private function setUserPreferences(?User $user, &$criteria)
}
}

private function renderResponse(Request $request, $content, $criteria, $data, $templatePath)
private function renderResponse(Request $request, $content, $criteria, $data, $templatePath, ?User $user)
{
$baseData = ['criteria' => $criteria] + $data;
if ('microblog' === $content) {
Expand All @@ -171,6 +171,7 @@ private function renderResponse(Request $request, $content, $criteria, $data, $t
$dto->magazine = $data['magazine'];
}
$baseData['form'] = $this->createForm(PostType::class)->setData($dto)->createView();
$baseData['user'] = $user;
}

if ($request->isXmlHttpRequest()) {
Expand Down
2 changes: 1 addition & 1 deletion templates/post/front.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
{% endif %}
{% include 'post/_options.html.twig' %}
{% include 'layout/_flash.html.twig' %}
{% if app.user is defined and app.user %}
{% if user is defined and user %}
{% include('user/_visibility_info.html.twig') %}
{% endif %}
{% if magazine is defined and magazine %}
Expand Down
2 changes: 1 addition & 1 deletion templates/user/_visibility_info.html.twig
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% if app.user is defined and app.user and app.user.visibility is same as 'trashed' %}
{% if user is defined and user and user.visibility is same as 'trashed' %}
<div class="alert alert__danger">
<p>{{ 'account_is_suspended'|trans }}</p>
</div>
Expand Down

0 comments on commit 10bbe43

Please sign in to comment.