use Friendica\Core\Renderer;
use Friendica\Model\Contact;
use Friendica\Navigation\Notifications\Entity;
+use Friendica\Navigation\Notifications\Exception\NoMessageException;
use Friendica\Navigation\Notifications\ValueObject;
use Friendica\Util\DateTimeFormat;
use Friendica\Util\Proxy;
);
}
+ /**
+ * @param Entity\Notification $notification
+ * @return ValueObject\FormattedNavNotification
+ * @throws NoMessageException
+ * @throws \Friendica\Network\HTTPException\InternalServerErrorException
+ * @throws \Friendica\Network\HTTPException\NotFoundException
+ * @throws \Friendica\Network\HTTPException\ServiceUnavailableException
+ */
public function createFromNotification(Entity\Notification $notification): ValueObject\FormattedNavNotification
{
$message = $this->notification->getMessageFromNotification($notification);
+ if (empty($message)) {
+ throw new NoMessageException();
+ }
+
if (!isset(self::$contacts[$notification->actorId])) {
self::$contacts[$notification->actorId] = Contact::getById($notification->actorId, ['name', 'url']);
}
return $this->createFromParams(
self::$contacts[$intro->cid],
- $this->l10n->t('{0}} wants to follow you'),
- new \DateTime($intro->datetime, new \DateTimeZone('UTC')),
+ $this->l10n->t('{0} wants to follow you'),
+ $intro->datetime,
new Uri($this->baseUrl->get() . '/notifications/intros/' . $intro->id)
);
}