*/
public function setSeen($note, $seen = true)
{
- return DBA::update('notify', ['seen' => $seen], ['link' => $note['link'], 'parent' => $note['parent'], 'otype' => $note['otype'], 'uid' => local_user()]);
+ return DBA::update('notify', ['seen' => $seen], [
+ '(`link` = ? OR (`parent` != 0 AND `parent` = ? AND `otype` = ?)) AND `uid` = ?',
+ $note['link'],
+ $note['parent'],
+ $note['otype'],
+ local_user()
+ ]);
}
/**
$fields = ['id', 'parent', 'verb', 'author-name', 'unseen', 'author-link', 'author-avatar', 'contact-avatar',
'network', 'created', 'object', 'parent-author-name', 'parent-author-link', 'parent-guid'];
- $params = ['order' => ['created' => true], 'limit' => [$start, $limit]];
+ $params = ['order' => ['received' => true], 'limit' => [$start, $limit]];
$items = Item::selectForUser(local_user(), $fields, $condition, $params);
}
$params = [];
- $params['order'] = ['date' => 'DESC'];
+ $params['order'] = ['date' => 'DESC'];
$params['limit'] = [$start, $limit];
$stmtNotifies = DBA::select('notify',
$fields = ['id', 'parent', 'verb', 'author-name', 'unseen', 'author-link', 'author-avatar', 'contact-avatar',
'network', 'created', 'object', 'parent-author-name', 'parent-author-link', 'parent-guid'];
- $params = ['order' => ['created' => true], 'limit' => [$start, $limit]];
+ $params = ['order' => ['received' => true], 'limit' => [$start, $limit]];
$items = Item::selectForUser(local_user(), $fields, $condition, $params);
$fields = ['id', 'parent', 'verb', 'author-name', 'unseen', 'author-link', 'author-avatar', 'contact-avatar',
'network', 'created', 'object', 'parent-author-name', 'parent-author-link', 'parent-guid'];
- $params = ['order' => ['created' => true], 'limit' => [$start, $limit]];
+ $params = ['order' => ['received' => true], 'limit' => [$start, $limit]];
$items = Item::selectForUser(local_user(), $fields, $condition, $params);
if (DBA::isResult($items)) {
$sql_extra = "";
if (!$all) {
- $sql_extra = " AND `ignore` = 0 ";
+ $sql_extra = " AND NOT `ignore` ";
}
/// @todo Fetch contact details by "Contact::getDetailsByUrl" instead of queries to contact, fcontact and gcontact
LEFT JOIN `contact` ON `contact`.`id` = `intro`.`contact-id`
LEFT JOIN `gcontact` ON `gcontact`.`nurl` = `contact`.`nurl`
LEFT JOIN `fcontact` ON `intro`.`fid` = `fcontact`.`id`
- WHERE `intro`.`uid` = %d $sql_extra AND `intro`.`blocked` = 0
- LIMIT %d, %d",
- intval($_SESSION['uid']),
- intval($start),
- intval($limit)
+ WHERE `intro`.`uid` = ? $sql_extra AND `intro`.`blocked` = 0
+ LIMIT ?, ?",
+ $_SESSION['uid'],
+ $start,
+ $limit
);
if (DBA::isResult($stmtNotifies)) {
$notifs = $this->formatIntros(DBA::toArray($stmtNotifies));