Remove item query limit when using file param in mod/network
- Only mark items as seen on regular network page
This commit is contained in:
parent
c7702a4c7a
commit
db3f884a3e
1 changed files with 13 additions and 12 deletions
|
@ -24,6 +24,7 @@ use Friendica\Model\Contact;
|
|||
use Friendica\Model\Group;
|
||||
use Friendica\Model\Item;
|
||||
use Friendica\Model\Profile;
|
||||
use Friendica\Model\Term;
|
||||
use Friendica\Module\Login;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
use Friendica\Util\Proxy as ProxyUtils;
|
||||
|
@ -445,11 +446,13 @@ function networkFlatView(App $a, $update = 0)
|
|||
|
||||
networkPager($a, $pager, $update);
|
||||
|
||||
$item_params = ['order' => ['id' => true]];
|
||||
|
||||
if (strlen($file)) {
|
||||
$condition = ["`term` = ? AND `otype` = ? AND `type` = ? AND `uid` = ?",
|
||||
$file, TERM_OBJ_POST, TERM_FILE, local_user()];
|
||||
$params = ['order' => ['tid' => true], 'limit' => [$pager->getStart(), $pager->getItemsPerPage()]];
|
||||
$result = DBA::select('term', ['oid'], $condition, $params);
|
||||
$term_condition = ["`term` = ? AND `otype` = ? AND `type` = ? AND `uid` = ?",
|
||||
$file, Term::OBJECT_TYPE_POST, Term::FILE, local_user()];
|
||||
$term_params = ['order' => ['tid' => true], 'limit' => [$pager->getStart(), $pager->getItemsPerPage()]];
|
||||
$result = DBA::select('term', ['oid'], $term_condition, $term_params);
|
||||
|
||||
$posts = [];
|
||||
while ($term = DBA::fetch($result)) {
|
||||
|
@ -460,18 +463,16 @@ function networkFlatView(App $a, $update = 0)
|
|||
if (count($posts) == 0) {
|
||||
return '';
|
||||
}
|
||||
$condition = ['uid' => local_user(), 'id' => $posts];
|
||||
$item_condition = ['uid' => local_user(), 'id' => $posts];
|
||||
} else {
|
||||
$condition = ['uid' => local_user()];
|
||||
$item_condition = ['uid' => local_user()];
|
||||
$item_params['limit'] = [$pager->getStart(), $pager->getItemsPerPage()];
|
||||
|
||||
networkSetSeen(['unseen' => true, 'uid' => local_user()]);
|
||||
}
|
||||
|
||||
$params = ['order' => ['id' => true], 'limit' => [$pager->getStart(), $pager->getItemsPerPage()]];
|
||||
$result = Item::selectForUser(local_user(), [], $condition, $params);
|
||||
$result = Item::selectForUser(local_user(), [], $item_condition, $item_params);
|
||||
$items = Item::inArray($result);
|
||||
|
||||
$condition = ['unseen' => true, 'uid' => local_user()];
|
||||
networkSetSeen($condition);
|
||||
|
||||
$o .= networkConversation($a, $items, $pager, 'network-new', $update);
|
||||
|
||||
return $o;
|
||||
|
|
Loading…
Reference in a new issue