mirror of
https://github.com/friendica/friendica
synced 2025-04-27 21:10:11 +00:00
show pinned items
This commit is contained in:
parent
cf56992444
commit
ed58af25a5
10 changed files with 41 additions and 8 deletions
|
@ -116,7 +116,7 @@ class Item extends BaseObject
|
|||
|
||||
/**
|
||||
* Set the pinned state of an item
|
||||
*
|
||||
*
|
||||
* @param integer $iid Item ID
|
||||
* @param integer $uid User ID
|
||||
* @param boolean $pinned Pinned state
|
||||
|
@ -128,10 +128,10 @@ class Item extends BaseObject
|
|||
|
||||
/**
|
||||
* Get the pinned state
|
||||
*
|
||||
*
|
||||
* @param integer $iid Item ID
|
||||
* @param integer $uid User ID
|
||||
*
|
||||
*
|
||||
* @return boolean pinned state
|
||||
*/
|
||||
public static function getPinned(int $iid, int $uid)
|
||||
|
@ -143,6 +143,22 @@ class Item extends BaseObject
|
|||
return (bool)$useritem['pinned'];
|
||||
}
|
||||
|
||||
public static function selectPinned(int $uid, array $selected = [])
|
||||
{
|
||||
$useritems = DBA::select('user-item', ['iid'], ['uid' => $uid, 'pinned' => true]);
|
||||
if (!DBA::isResult($useritems)) {
|
||||
return $useritems;
|
||||
}
|
||||
|
||||
$pinned = [];
|
||||
while ($useritem = self::fetch($useritems)) {
|
||||
$pinned[] = $useritem['iid'];
|
||||
}
|
||||
DBA::close($useritems);
|
||||
|
||||
return self::selectThreadForUser($uid, $selected, ['iid' => $pinned]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief returns an activity index from an activity string
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue