use Friendica\Model\Group;
use Friendica\Model\Item;
use Friendica\Model\Mail;
+use Friendica\Model\Notification;
use Friendica\Model\Photo;
use Friendica\Model\Profile;
use Friendica\Model\User;
throw new BadRequestException("Invalid argument count");
}
- $notifications = DI::notification()->select([], ['order' => ['seen' => 'ASC', 'date' => 'DESC'], 'limit' => 50]);
+ $notifications = DI::notification()->select(['uid' => api_user()], ['order' => ['seen' => 'ASC', 'date' => 'DESC'], 'limit' => 50]);
if ($type == "xml") {
$xmlnotes = false;
$notification = DI::notification()->getByID($id);
$notification->setSeen();
- if ($notification->otype == 'item') {
- // would be really better with an ItemsManager and $im->getByID() :-P
+ if ($notification->otype === Notification::OTYPE_ITEM) {
$item = Item::selectFirstForUser(api_user(), [], ['id' => $notification->iid, 'uid' => api_user()]);
if (DBA::isResult($item)) {
// we found the item, return it to the user
use Friendica\DI;
use Friendica\Model\Item;
use Friendica\Model\ItemContent;
+use Friendica\Model\Notification;
use Friendica\Model\User;
use Friendica\Model\UserItem;
use Friendica\Protocol\Activity;
// if it's a post figure out who's post it is.
$item = null;
- if ($params['otype'] === 'item' && $parent_id) {
+ if ($params['otype'] === Notification::OTYPE_ITEM && $parent_id) {
$item = Item::selectFirstForUser($params['uid'], Item::ITEM_FIELDLIST, ['id' => $parent_id, 'deleted' => false]);
}
*
* @return Introduction[]
*/
- public function getIntroList(bool $all = false, int $start = 0, int $limit = BaseNotifications::DEFAULT_PAGE_LIMIT, int $id = 0)
+ public function getList(bool $all = false, int $start = 0, int $limit = BaseNotifications::DEFAULT_PAGE_LIMIT, int $id = 0)
{
$sql_extra = "";
// Normal connection requests
} else {
- $notification = $this->getMissingIntroData($notification);
+ $notification = $this->getMissingData($notification);
if (empty($notification['url'])) {
continue;
*
* @throws InternalServerErrorException
*/
- private function getMissingIntroData(array $intro)
+ private function getMissingData(array $intro)
{
// If the network and the addr isn't available from the gcontact
// table entry, take the one of the contact table entry
*/
class Notification extends BaseModel
{
+ const OTYPE_ITEM = 'item';
+ const OTYPE_INTRO = 'intro';
+ const OTYPE_MAIL = 'mail';
+ const OTYPE_PERSON = 'person';
+
/** @var \Friendica\Repository\Notification */
private $repo;
$notifications = [
'ident' => 'introductions',
- 'notifications' => DI::factNotIntro()->getIntroList($all, self::$firstItemNum, self::ITEMS_PER_PAGE, $id),
+ 'notifications' => DI::factNotIntro()->getList($all, self::$firstItemNum, self::ITEMS_PER_PAGE, $id),
];
return [