Bugfix in notifications / network and display are using the new functions now

This commit is contained in:
Michael 2018-06-10 07:26:37 +00:00
parent eca43895e1
commit 5d9083c369
3 changed files with 16 additions and 14 deletions

View file

@ -15,6 +15,7 @@ use Friendica\Core\System;
use Friendica\Database\DBM; use Friendica\Database\DBM;
use Friendica\Model\Contact; use Friendica\Model\Contact;
use Friendica\Model\Profile; use Friendica\Model\Profile;
use Friendica\Model\Item;
use Friendica\Object\Post; use Friendica\Object\Post;
use Friendica\Object\Thread; use Friendica\Object\Thread;
use Friendica\Util\DateTimeFormat; use Friendica\Util\DateTimeFormat;
@ -865,21 +866,21 @@ function conversation(App $a, $items, $mode, $update, $preview = false, $order =
function conversation_add_children($parents, $block_authors, $order, $uid) { function conversation_add_children($parents, $block_authors, $order, $uid) {
$max_comments = Config::get('system', 'max_comments', 100); $max_comments = Config::get('system', 'max_comments', 100);
$params = ['order' => ['uid', 'commented' => true]];
if ($max_comments > 0) { if ($max_comments > 0) {
$limit = ' LIMIT '.intval($max_comments + 1); $params['limit'] = $max_comments;
} else {
$limit = '';
} }
$items = []; $items = [];
$block_sql = $block_authors ? "AND NOT `author`.`hidden` AND NOT `author`.`blocked`" : "";
foreach ($parents AS $parent) { foreach ($parents AS $parent) {
$thread_items = dba::p(item_query(local_user())."AND `item`.`parent-uri` = ? $condition = ["`item`.`parent-uri` = ? AND `item`.`uid` IN (0, ?) ",
AND `item`.`uid` IN (0, ?) $block_sql $parent['uri'], local_user()];
ORDER BY `item`.`uid` ASC, `item`.`commented` DESC" . $limit, if ($block_authors) {
$parent['uri'], local_user()); $condition[0] .= "AND NOT `author`.`hidden`";
}
$thread_items = Item::select(local_user(), [], $condition, $params);
$comments = dba::inArray($thread_items); $comments = dba::inArray($thread_items);

View file

@ -11,6 +11,7 @@ use Friendica\Core\System;
use Friendica\Database\DBM; use Friendica\Database\DBM;
use Friendica\Util\DateTimeFormat; use Friendica\Util\DateTimeFormat;
use Friendica\Util\Emailer; use Friendica\Util\Emailer;
use Friendica\Model\Item;
/** /**
* @brief Creates a notification entry and possibly sends a mail * @brief Creates a notification entry and possibly sends a mail

View file

@ -14,6 +14,7 @@ use Friendica\Core\System;
use Friendica\Database\DBM; use Friendica\Database\DBM;
use Friendica\Model\Contact; use Friendica\Model\Contact;
use Friendica\Model\Group; use Friendica\Model\Group;
use Friendica\Model\Item;
use Friendica\Model\Profile; use Friendica\Model\Profile;
use Friendica\Protocol\DFRN; use Friendica\Protocol\DFRN;
@ -345,11 +346,10 @@ function display_content(App $a, $update = false, $update_uid = 0) {
return ''; return '';
} }
$r = dba::p(item_query(local_user())."AND `item`.`parent-uri` = (SELECT `parent-uri` FROM `item` WHERE `id` = ?) $condition = ["`item`.`parent-uri` = (SELECT `parent-uri` FROM `item` WHERE `id` = ?)
AND `item`.`uid` IN (0, ?) $sql_extra AND `item`.`uid` IN (0, ?) " . $sql_extra, $item_id, local_user()];
ORDER BY `item`.`uid` ASC, `parent` DESC, `gravity` ASC, `id` ASC", $params = ['order' => ['uid', 'parent' => true, 'gravity', 'id']];
$item_id, local_user() $r = Item::select(local_user(), [], $condition, $params);
);
if (!DBM::is_result($r)) { if (!DBM::is_result($r)) {
notice(L10n::t('Item not found.') . EOL); notice(L10n::t('Item not found.') . EOL);