use Friendica\Model\Notification;
use Friendica\Model\Post;
use Friendica\Model\User;
-use Friendica\Model\Verb;
use Friendica\Navigation\Notifications;
use Friendica\Protocol\Activity;
$notify_id = 0;
if ($show_in_notification_page) {
- /** @var $factory Notifications\Factory\Notify */
- $factory = DI::getDice()->create(Notifications\Factory\Notify::class);
-
- $Notify = $factory->createFromParams($params, $itemlink, $item_id, $uri_id, $parent_id, $parent_uri_id);
+ $Notify = DI::notifyFactory()->createFromParams($params, $itemlink, $item_id, $uri_id, $parent_id, $parent_uri_id);
try {
$Notify = DI::notify()->save($Notify);
} catch (Notifications\Exception\NotificationCreationInterceptedException $e) {
$subject = $l10n->t('%1$s Comment to conversation #%2$d by %3$s', $subjectPrefix, $item['parent'], $contact['name']);
}
- $msg = (new Notifications\Factory\Notification(DI::logger()))->getMessageFromNotification($Notification, DI::baseUrl(), $l10n);
+ $msg = DI::notificationFactory()->getMessageFromNotification($Notification, DI::baseUrl(), $l10n);
if (empty($msg)) {
Logger::info('No notification message, quitting', ['uid' => $Notification->uid, 'id' => $Notification->id, 'type' => $Notification->type]);
return false;
return self::$dice->create(Navigation\Notifications\Depository\Notification::class);
}
+ public static function notificationFactory(): Navigation\Notifications\Factory\Notification
+ {
+ return self::$dice->create(Navigation\Notifications\Factory\Notification::class);
+ }
+
public static function notify(): Navigation\Notifications\Depository\Notify
{
return self::$dice->create(Navigation\Notifications\Depository\Notify::class);
}
+ public static function notifyFactory(): Navigation\Notifications\Factory\Notify
+ {
+ return self::$dice->create(Navigation\Notifications\Factory\Notify::class);
+ }
+
+ public static function formattedNotificationFactory(): Navigation\Notifications\Factory\FormattedNotification
+ {
+ return self::$dice->create(Navigation\Notifications\Factory\FormattedNotification::class);
+ }
+
//
// "Protocol" namespace instances
//
$notificationHeader = '';
$notifications = [];
- /** @var \Friendica\Navigation\Notifications\Factory\FormattedNotification $factory */
- $factory = DI::getDice()->create(\Friendica\Navigation\Notifications\Factory\FormattedNotification::class);
+ $factory = DI::formattedNotificationFactory();
if ((DI::args()->get(1) == 'network')) {
$notificationHeader = DI::l10n()->t('Network Notifications');
}
}
- $message = (new Notifications\Factory\Notification(DI::logger()))->getMessageFromNotification($Notification, DI::baseUrl(), $l10n);
+ $message = DI::notificationFactory()->getMessageFromNotification($Notification, DI::baseUrl(), $l10n);
$title = $message['plain'] ?: '';
$push = Subscription::create([