Fix ignore link showing for anonymous users

This commit is contained in:
Hypolite Petovan 2018-11-23 01:25:38 -05:00
parent 540321d0aa
commit 03de5c018f

View file

@ -270,34 +270,36 @@ class Post extends BaseObject
$tagger = ''; $tagger = '';
if ($this->isToplevel()) { if ($this->isToplevel()) {
$thread = Item::selectFirstThreadForUser(local_user(), ['ignored'], ['iid' => $item['id']]); if(local_user()) {
if (DBA::isResult($thread)) { $thread = Item::selectFirstThreadForUser(local_user(), ['ignored'], ['iid' => $item['id']]);
$ignore = [ if (DBA::isResult($thread)) {
'do' => L10n::t("ignore thread"), $ignore = [
'undo' => L10n::t("unignore thread"), 'do' => L10n::t("ignore thread"),
'toggle' => L10n::t("toggle ignore status"), 'undo' => L10n::t("unignore thread"),
'classdo' => $thread['ignored'] ? "hidden" : "", 'toggle' => L10n::t("toggle ignore status"),
'classundo' => $thread['ignored'] ? "" : "hidden", 'classdo' => $thread['ignored'] ? "hidden" : "",
'ignored' => L10n::t('ignored'), 'classundo' => $thread['ignored'] ? "" : "hidden",
]; 'ignored' => L10n::t('ignored'),
} ];
}
if ($conv->getProfileOwner() == local_user() && ($item['uid'] != 0)) { if ($conv->getProfileOwner() == local_user() && ($item['uid'] != 0)) {
$isstarred = (($item['starred']) ? "starred" : "unstarred"); $isstarred = (($item['starred']) ? "starred" : "unstarred");
$star = [ $star = [
'do' => L10n::t("add star"), 'do' => L10n::t("add star"),
'undo' => L10n::t("remove star"), 'undo' => L10n::t("remove star"),
'toggle' => L10n::t("toggle star status"), 'toggle' => L10n::t("toggle star status"),
'classdo' => $item['starred'] ? "hidden" : "", 'classdo' => $item['starred'] ? "hidden" : "",
'classundo' => $item['starred'] ? "" : "hidden", 'classundo' => $item['starred'] ? "" : "hidden",
'starred' => L10n::t('starred'), 'starred' => L10n::t('starred'),
]; ];
$tagger = [ $tagger = [
'add' => L10n::t("add tag"), 'add' => L10n::t("add tag"),
'class' => "", 'class' => "",
]; ];
}
} }
} else { } else {
$indent = 'comment'; $indent = 'comment';