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\Model\Contact;
use Friendica\Model\Profile;
use Friendica\Model\Item;
use Friendica\Object\Post;
use Friendica\Object\Thread;
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) {
$max_comments = Config::get('system', 'max_comments', 100);
$params = ['order' => ['uid', 'commented' => true]];
if ($max_comments > 0) {
$limit = ' LIMIT '.intval($max_comments + 1);
} else {
$limit = '';
$params['limit'] = $max_comments;
}
$items = [];
$block_sql = $block_authors ? "AND NOT `author`.`hidden` AND NOT `author`.`blocked`" : "";
foreach ($parents AS $parent) {
$thread_items = dba::p(item_query(local_user())."AND `item`.`parent-uri` = ?
AND `item`.`uid` IN (0, ?) $block_sql
ORDER BY `item`.`uid` ASC, `item`.`commented` DESC" . $limit,
$parent['uri'], local_user());
$condition = ["`item`.`parent-uri` = ? AND `item`.`uid` IN (0, ?) ",
$parent['uri'], local_user()];
if ($block_authors) {
$condition[0] .= "AND NOT `author`.`hidden`";
}
$thread_items = Item::select(local_user(), [], $condition, $params);
$comments = dba::inArray($thread_items);

View File

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