Remove superfluous variable in item template variables

2022.09-rc
Hypolite Petovan 2020-09-13 19:50:39 -04:00
rodzic 3fa3e78844
commit 76d6962129
2 zmienionych plików z 23 dodań i 36 usunięć

Wyświetl plik

@ -520,10 +520,6 @@ function conversation(App $a, array $items, $mode, $update, $preview = false, $o
$threadsid++; $threadsid++;
$owner_url = '';
$owner_name = '';
$sparkle = '';
// prevent private email from leaking. // prevent private email from leaking.
if ($item['network'] === Protocol::MAIL && local_user() != $item['uid']) { if ($item['network'] === Protocol::MAIL && local_user() != $item['uid']) {
continue; continue;
@ -540,6 +536,7 @@ function conversation(App $a, array $items, $mode, $update, $preview = false, $o
'network' => $item['author-network'], 'url' => $item['author-link']]; 'network' => $item['author-network'], 'url' => $item['author-link']];
$profile_link = Contact::magicLinkByContact($author); $profile_link = Contact::magicLinkByContact($author);
$sparkle = '';
if (strpos($profile_link, 'redir/') === 0) { if (strpos($profile_link, 'redir/') === 0) {
$sparkle = ' sparkle'; $sparkle = ' sparkle';
} }
@ -562,10 +559,6 @@ function conversation(App $a, array $items, $mode, $update, $preview = false, $o
'delete' => DI::l10n()->t('Delete'), 'delete' => DI::l10n()->t('Delete'),
]; ];
$star = false;
$isstarred = "unstarred";
$lock = false;
$likebuttons = [ $likebuttons = [
'like' => null, 'like' => null,
'dislike' => null, 'dislike' => null,
@ -598,7 +591,7 @@ function conversation(App $a, array $items, $mode, $update, $preview = false, $o
'item_photo_menu_html' => item_photo_menu($item), 'item_photo_menu_html' => item_photo_menu($item),
'name' => $profile_name, 'name' => $profile_name,
'sparkle' => $sparkle, 'sparkle' => $sparkle,
'lock' => $lock, 'lock' => false,
'thumb' => DI::baseUrl()->remove($item['author-avatar']), 'thumb' => DI::baseUrl()->remove($item['author-avatar']),
'title' => $title, 'title' => $title,
'body_html' => $body_html, 'body_html' => $body_html,
@ -617,13 +610,13 @@ function conversation(App $a, array $items, $mode, $update, $preview = false, $o
'ago' => (($item['app']) ? DI::l10n()->t('%s from %s', Temporal::getRelativeDate($item['created']),$item['app']) : Temporal::getRelativeDate($item['created'])), 'ago' => (($item['app']) ? DI::l10n()->t('%s from %s', Temporal::getRelativeDate($item['created']),$item['app']) : Temporal::getRelativeDate($item['created'])),
'location_html' => $location_html, 'location_html' => $location_html,
'indent' => '', 'indent' => '',
'owner_name' => $owner_name, 'owner_name' => '',
'owner_url' => $owner_url, 'owner_url' => '',
'owner_photo' => DI::baseUrl()->remove($item['owner-avatar']), 'owner_photo' => DI::baseUrl()->remove($item['owner-avatar']),
'plink' => Item::getPlink($item), 'plink' => Item::getPlink($item),
'edpost' => false, 'edpost' => false,
'isstarred' => $isstarred, 'isstarred' => 'unstarred',
'star' => $star, 'star' => false,
'drop' => $drop, 'drop' => $drop,
'vote' => $likebuttons, 'vote' => $likebuttons,
'like_html' => '', 'like_html' => '',

Wyświetl plik

@ -221,15 +221,14 @@ class Post
$delete = $origin ? DI::l10n()->t('Delete globally') : DI::l10n()->t('Remove locally'); $delete = $origin ? DI::l10n()->t('Delete globally') : DI::l10n()->t('Remove locally');
} }
$drop = [ $drop = false;
'dropping' => $dropping, if (local_user()) {
'pagedrop' => $item['pagedrop'], $drop = [
'select' => DI::l10n()->t('Select'), 'dropping' => $dropping,
'delete' => $delete, 'pagedrop' => $item['pagedrop'],
]; 'select' => DI::l10n()->t('Select'),
'delete' => $delete,
if (!local_user()) { ];
$drop = false;
} }
$filer = (($conv->getProfileOwner() == local_user() && ($item['uid'] != 0)) ? DI::l10n()->t("save to folder") : false); $filer = (($conv->getProfileOwner() == local_user() && ($item['uid'] != 0)) ? DI::l10n()->t("save to folder") : false);
@ -361,17 +360,12 @@ class Post
list($categories, $folders) = DI::contentItem()->determineCategoriesTerms($item); list($categories, $folders) = DI::contentItem()->determineCategoriesTerms($item);
$name_e = $profile_name;
$text = strip_tags($body_html);
if (!empty($item['content-warning']) && DI::pConfig()->get(local_user(), 'system', 'disable_cw', false)) { if (!empty($item['content-warning']) && DI::pConfig()->get(local_user(), 'system', 'disable_cw', false)) {
$title_e = ucfirst($item['content-warning']); $title = ucfirst($item['content-warning']);
} else { } else {
$title_e = $item['title']; $title = $item['title'];
} }
$owner_name_e = $this->getOwnerName();
if (DI::pConfig()->get(local_user(), 'system', 'hide_dislike')) { if (DI::pConfig()->get(local_user(), 'system', 'hide_dislike')) {
$buttons['dislike'] = false; $buttons['dislike'] = false;
} }
@ -412,8 +406,8 @@ class Post
} elseif (DI::config()->get('debug', 'show_direction')) { } elseif (DI::config()->get('debug', 'show_direction')) {
$conversation = DBA::selectFirst('conversation', ['direction'], ['item-uri' => $item['uri']]); $conversation = DBA::selectFirst('conversation', ['direction'], ['item-uri' => $item['uri']]);
if (!empty($conversation['direction']) && in_array($conversation['direction'], [1, 2])) { if (!empty($conversation['direction']) && in_array($conversation['direction'], [1, 2])) {
$title = [1 => DI::l10n()->t('Pushed'), 2 => DI::l10n()->t('Pulled')]; $direction_title = [1 => DI::l10n()->t('Pushed'), 2 => DI::l10n()->t('Pulled')];
$direction = ['direction' => $conversation['direction'], 'title' => $title[$conversation['direction']]]; $direction = ['direction' => $conversation['direction'], 'title' => $direction_title[$conversation['direction']]];
} }
} }
@ -432,7 +426,7 @@ class Post
'categories' => $categories, 'categories' => $categories,
'folders' => $folders, 'folders' => $folders,
'body_html' => $body_html, 'body_html' => $body_html,
'text' => $text, 'text' => strip_tags($body_html),
'id' => $this->getId(), 'id' => $this->getId(),
'guid' => urlencode($item['guid']), 'guid' => urlencode($item['guid']),
'isevent' => $isevent, 'isevent' => $isevent,
@ -444,12 +438,12 @@ class Post
'wall' => DI::l10n()->t('Wall-to-Wall'), 'wall' => DI::l10n()->t('Wall-to-Wall'),
'vwall' => DI::l10n()->t('via Wall-To-Wall:'), 'vwall' => DI::l10n()->t('via Wall-To-Wall:'),
'profile_url' => $profile_link, 'profile_url' => $profile_link,
'name' => $name_e, 'name' => $profile_name,
'item_photo_menu_html' => item_photo_menu($item), 'item_photo_menu_html' => item_photo_menu($item),
'thumb' => DI::baseUrl()->remove($item['author-avatar']), 'thumb' => DI::baseUrl()->remove($item['author-avatar']),
'osparkle' => $osparkle, 'osparkle' => $osparkle,
'sparkle' => $sparkle, 'sparkle' => $sparkle,
'title' => $title_e, 'title' => $title,
'localtime' => DateTimeFormat::local($item['created'], 'r'), 'localtime' => DateTimeFormat::local($item['created'], 'r'),
'ago' => $item['app'] ? DI::l10n()->t('%s from %s', $ago, $item['app']) : $ago, 'ago' => $item['app'] ? DI::l10n()->t('%s from %s', $ago, $item['app']) : $ago,
'app' => $item['app'], 'app' => $item['app'],
@ -461,7 +455,7 @@ class Post
'owner_self' => $item['author-link'] == Session::get('my_url'), 'owner_self' => $item['author-link'] == Session::get('my_url'),
'owner_url' => $this->getOwnerUrl(), 'owner_url' => $this->getOwnerUrl(),
'owner_photo' => DI::baseUrl()->remove($item['owner-avatar']), 'owner_photo' => DI::baseUrl()->remove($item['owner-avatar']),
'owner_name' => $owner_name_e, 'owner_name' => $this->getOwnerName(),
'plink' => Item::getPlink($item), 'plink' => Item::getPlink($item),
'edpost' => $edpost, 'edpost' => $edpost,
'ispinned' => $ispinned, 'ispinned' => $ispinned,
@ -478,7 +472,7 @@ class Post
'dislike_html' => $responses['dislike']['output'], 'dislike_html' => $responses['dislike']['output'],
'responses' => $responses, 'responses' => $responses,
'switchcomment' => DI::l10n()->t('Comment'), 'switchcomment' => DI::l10n()->t('Comment'),
'reply_label' => DI::l10n()->t('Reply to %s', $name_e), 'reply_label' => DI::l10n()->t('Reply to %s', $profile_name),
'comment_html' => $comment_html, 'comment_html' => $comment_html,
'remote_comment' => $remote_comment, 'remote_comment' => $remote_comment,
'menu' => DI::l10n()->t('More'), 'menu' => DI::l10n()->t('More'),