Only show delete icon when logged in. (#73)
Check for a valid login session before showing delete icons on ticks. Reviewed-on: https://gitea.subcultureofone.org/greg/tkr/pulls/73 Co-authored-by: Greg Sarjeant <greg@subcultureofone.org> Co-committed-by: Greg Sarjeant <greg@subcultureofone.org>
This commit is contained in:
parent
d03c0a5331
commit
d60230f975
@ -23,14 +23,14 @@ class TicksView {
|
|||||||
$relativeTime = Util::relative_time($tick['timestamp']);
|
$relativeTime = Util::relative_time($tick['timestamp']);
|
||||||
?>
|
?>
|
||||||
<li class="tick" tabindex="0">
|
<li class="tick" tabindex="0">
|
||||||
<?php if ($tick['can_delete']): ?>
|
<?php if (Session::isLoggedIn() && $tick['can_delete']): ?>
|
||||||
<form method="post"
|
<form method="post"
|
||||||
action="<?= Util::buildRelativeUrl($settings->basePath, "tick/{$tick['id']}/delete") ?>"
|
action="<?= Util::buildRelativeUrl($settings->basePath, "tick/{$tick['id']}/delete") ?>"
|
||||||
class="delete-tick-form">
|
class="delete-tick-form">
|
||||||
<input type="hidden" name="csrf_token" value="<?= Util::escape_html($_SESSION['csrf_token']) ?>">
|
<input type="hidden" name="csrf_token" value="<?= Util::escape_html($_SESSION['csrf_token']) ?>">
|
||||||
<button type="submit" class="delete-tick-button">🗑️</button>
|
<button type="submit" class="delete-tick-button">🗑️</button>
|
||||||
</form>
|
</form>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
<time datetime="<?php echo $datetime->format('c') ?>"><?php echo Util::escape_html($relativeTime) ?></time>
|
<time datetime="<?php echo $datetime->format('c') ?>"><?php echo Util::escape_html($relativeTime) ?></time>
|
||||||
<span class="tick-text"><?php echo Util::linkify(Util::escape_html($tick['tick'])) ?></span>
|
<span class="tick-text"><?php echo Util::linkify(Util::escape_html($tick['tick'])) ?></span>
|
||||||
</li>
|
</li>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user