Merge pull request #8329 from MrPetovan/bug/notices
Remove unused conversation response code
This commit is contained in:
commit
b0690077aa
|
@ -579,12 +579,11 @@ function conversation(App $a, array $items, $mode, $update, $preview = false, $o
|
||||||
$items = $cb['items'];
|
$items = $cb['items'];
|
||||||
|
|
||||||
$conv_responses = [
|
$conv_responses = [
|
||||||
'like' => ['title' => DI::l10n()->t('Likes','title')],
|
'like' => [],
|
||||||
'dislike' => ['title' => DI::l10n()->t('Dislikes','title')],
|
'dislike' => [],
|
||||||
'attendyes' => ['title' => DI::l10n()->t('Attending','title')],
|
'attendyes' => [],
|
||||||
'attendno' => ['title' => DI::l10n()->t('Not attending','title')],
|
'attendno' => [],
|
||||||
'attendmaybe' => ['title' => DI::l10n()->t('Might attend','title')],
|
'attendmaybe' => []
|
||||||
'announce' => ['title' => DI::l10n()->t('Reshares','title')]
|
|
||||||
];
|
];
|
||||||
|
|
||||||
if (DI::pConfig()->get(local_user(), 'system', 'hide_dislike')) {
|
if (DI::pConfig()->get(local_user(), 'system', 'hide_dislike')) {
|
||||||
|
@ -1572,56 +1571,3 @@ function render_location_dummy(array $item) {
|
||||||
return $item['coord'];
|
return $item['coord'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_responses(array $conv_responses, array $response_verbs, array $item, Post $ob = null) {
|
|
||||||
$ret = [];
|
|
||||||
foreach ($response_verbs as $v) {
|
|
||||||
$ret[$v] = [];
|
|
||||||
$ret[$v]['count'] = $conv_responses[$v][$item['uri']] ?? 0;
|
|
||||||
$ret[$v]['list'] = $conv_responses[$v][$item['uri'] . '-l'] ?? [];
|
|
||||||
$ret[$v]['self'] = $conv_responses[$v][$item['uri'] . '-self'] ?? '0';
|
|
||||||
if (count($ret[$v]['list']) > MAX_LIKERS) {
|
|
||||||
$ret[$v]['list_part'] = array_slice($ret[$v]['list'], 0, MAX_LIKERS);
|
|
||||||
array_push($ret[$v]['list_part'], '<a href="#" data-toggle="modal" data-target="#' . $v . 'Modal-'
|
|
||||||
. (($ob) ? $ob->getId() : $item['id']) . '"><b>' . DI::l10n()->t('View all') . '</b></a>');
|
|
||||||
} else {
|
|
||||||
$ret[$v]['list_part'] = '';
|
|
||||||
}
|
|
||||||
$ret[$v]['button'] = get_response_button_text($v, $ret[$v]['count']);
|
|
||||||
$ret[$v]['title'] = $conv_responses[$v]['title'];
|
|
||||||
}
|
|
||||||
|
|
||||||
$count = 0;
|
|
||||||
foreach ($ret as $key) {
|
|
||||||
if ($key['count'] == true) {
|
|
||||||
$count++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$ret['count'] = $count;
|
|
||||||
|
|
||||||
return $ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
function get_response_button_text($v, $count)
|
|
||||||
{
|
|
||||||
$return = '';
|
|
||||||
switch ($v) {
|
|
||||||
case 'like':
|
|
||||||
$return = DI::l10n()->tt('Like', 'Likes', $count);
|
|
||||||
break;
|
|
||||||
case 'dislike':
|
|
||||||
$return = DI::l10n()->tt('Dislike', 'Dislikes', $count);
|
|
||||||
break;
|
|
||||||
case 'attendyes':
|
|
||||||
$return = DI::l10n()->tt('Attending', 'Attending', $count);
|
|
||||||
break;
|
|
||||||
case 'attendno':
|
|
||||||
$return = DI::l10n()->tt('Not Attending', 'Not Attending', $count);
|
|
||||||
break;
|
|
||||||
case 'attendmaybe':
|
|
||||||
$return = DI::l10n()->tt('Undecided', 'Undecided', $count);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $return;
|
|
||||||
}
|
|
||||||
|
|
|
@ -1372,7 +1372,6 @@ function photos_content(App $a)
|
||||||
$likebuttons = '';
|
$likebuttons = '';
|
||||||
$comments = '';
|
$comments = '';
|
||||||
$paginate = '';
|
$paginate = '';
|
||||||
$responses = '';
|
|
||||||
|
|
||||||
if (!empty($link_item['id']) && !empty($link_item['uri'])) {
|
if (!empty($link_item['id']) && !empty($link_item['uri'])) {
|
||||||
$cmnt_tpl = Renderer::getMarkupTemplate('comment_item.tpl');
|
$cmnt_tpl = Renderer::getMarkupTemplate('comment_item.tpl');
|
||||||
|
@ -1413,11 +1412,11 @@ function photos_content(App $a)
|
||||||
}
|
}
|
||||||
|
|
||||||
$conv_responses = [
|
$conv_responses = [
|
||||||
'like' => ['title' => DI::l10n()->t('Likes','title')],
|
'like' => [],
|
||||||
'dislike' => ['title' => DI::l10n()->t('Dislikes','title')],
|
'dislike' => [],
|
||||||
'attendyes' => ['title' => DI::l10n()->t('Attending','title')],
|
'attendyes' => [],
|
||||||
'attendno' => ['title' => DI::l10n()->t('Not attending','title')],
|
'attendno' => [],
|
||||||
'attendmaybe' => ['title' => DI::l10n()->t('Might attend','title')]
|
'attendmaybe' => []
|
||||||
];
|
];
|
||||||
|
|
||||||
if (DI::pConfig()->get(local_user(), 'system', 'hide_dislike')) {
|
if (DI::pConfig()->get(local_user(), 'system', 'hide_dislike')) {
|
||||||
|
@ -1460,7 +1459,6 @@ function photos_content(App $a)
|
||||||
foreach ($items as $item) {
|
foreach ($items as $item) {
|
||||||
$comment = '';
|
$comment = '';
|
||||||
$template = $tpl;
|
$template = $tpl;
|
||||||
$sparkle = '';
|
|
||||||
|
|
||||||
$activity = DI::activity();
|
$activity = DI::activity();
|
||||||
|
|
||||||
|
@ -1523,8 +1521,6 @@ function photos_content(App $a)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$responses = get_responses($conv_responses, ['like', 'dislike'], $link_item);
|
|
||||||
|
|
||||||
$paginate = $pager->renderFull($total);
|
$paginate = $pager->renderFull($total);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1544,7 +1540,6 @@ function photos_content(App $a)
|
||||||
'$likebuttons' => $likebuttons,
|
'$likebuttons' => $likebuttons,
|
||||||
'$like' => $like,
|
'$like' => $like,
|
||||||
'$dislike' => $dislike,
|
'$dislike' => $dislike,
|
||||||
'responses' => $responses,
|
|
||||||
'$comments' => $comments,
|
'$comments' => $comments,
|
||||||
'$paginate' => $paginate,
|
'$paginate' => $paginate,
|
||||||
]);
|
]);
|
||||||
|
|
|
@ -57,7 +57,7 @@ class BoundariesPager extends Pager
|
||||||
$this->last_item_id = $last_item_id;
|
$this->last_item_id = $last_item_id;
|
||||||
|
|
||||||
$parsed = parse_url($this->getBaseQueryString());
|
$parsed = parse_url($this->getBaseQueryString());
|
||||||
if ($parsed) {
|
if (!empty($parsed['query'])) {
|
||||||
parse_str($parsed['query'], $queryParameters);
|
parse_str($parsed['query'], $queryParameters);
|
||||||
|
|
||||||
$this->first_page = !($queryParameters['since_id'] ?? null) && !($queryParameters['max_id'] ?? null);
|
$this->first_page = !($queryParameters['since_id'] ?? null) && !($queryParameters['max_id'] ?? null);
|
||||||
|
|
|
@ -272,10 +272,12 @@ class Post
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$responses = get_responses($conv_responses, $response_verbs, $item, $this);
|
$responses = [];
|
||||||
|
foreach ($response_verbs as $value => $verb) {
|
||||||
foreach ($response_verbs as $value => $verbs) {
|
$responses[$verb] = [
|
||||||
$responses[$verbs]['output'] = !empty($conv_responses[$verbs][$item['uri']]) ? format_like($conv_responses[$verbs][$item['uri']], $conv_responses[$verbs][$item['uri'] . '-l'], $verbs, $item['uri']) : '';
|
'self' => $conv_responses[$verb][$item['uri'] . '-self'] ?? 0,
|
||||||
|
'output' => !empty($conv_responses[$verb][$item['uri']]) ? format_like($conv_responses[$verb][$item['uri']], $conv_responses[$verb][$item['uri'] . '-l'], $verb, $item['uri']) : '',
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -34,6 +34,7 @@ use Friendica\Util\Security;
|
||||||
*/
|
*/
|
||||||
class Thread
|
class Thread
|
||||||
{
|
{
|
||||||
|
/** @var Post[] */
|
||||||
private $parents = [];
|
private $parents = [];
|
||||||
private $mode = null;
|
private $mode = null;
|
||||||
private $writable = false;
|
private $writable = false;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user