Merge pull request #12731 from annando/api-quotes
Quote for notifications
This commit is contained in:
commit
4e98f5a1df
|
@ -47,11 +47,12 @@ class Notification extends BaseFactory
|
|||
|
||||
/**
|
||||
* @param Notifications\Entity\Notification $Notification
|
||||
* @param bool $display_quote Display quoted posts
|
||||
*
|
||||
* @return MstdnNotification
|
||||
* @throws UnexpectedNotificationTypeException
|
||||
*/
|
||||
public function createFromNotification(Notifications\Entity\Notification $Notification): MstdnNotification
|
||||
public function createFromNotification(Notifications\Entity\Notification $Notification, bool $display_quotes): MstdnNotification
|
||||
{
|
||||
$type = self::getType($Notification);
|
||||
if (empty($type)) {
|
||||
|
@ -62,7 +63,7 @@ class Notification extends BaseFactory
|
|||
|
||||
if ($Notification->targetUriId) {
|
||||
try {
|
||||
$status = $this->mstdnStatusFactory->createFromUriId($Notification->targetUriId, $Notification->uid);
|
||||
$status = $this->mstdnStatusFactory->createFromUriId($Notification->targetUriId, $Notification->uid, $display_quotes);
|
||||
} catch (\Throwable $th) {
|
||||
$status = null;
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ class Notifications extends BaseApi
|
|||
$id = $this->parameters['id'];
|
||||
try {
|
||||
$notification = DI::notification()->selectOneForUser($uid, ['id' => $id]);
|
||||
System::jsonExit(DI::mstdnNotification()->createFromNotification($notification));
|
||||
System::jsonExit(DI::mstdnNotification()->createFromNotification($notification, self::appSupportsQuotes()));
|
||||
} catch (\Exception $e) {
|
||||
DI::mstdnError()->RecordNotFound();
|
||||
}
|
||||
|
@ -134,7 +134,7 @@ class Notifications extends BaseApi
|
|||
|
||||
foreach($Notifications as $Notification) {
|
||||
try {
|
||||
$mstdnNotifications[] = DI::mstdnNotification()->createFromNotification($Notification);
|
||||
$mstdnNotifications[] = DI::mstdnNotification()->createFromNotification($Notification, self::appSupportsQuotes());
|
||||
self::setBoundaries($Notification->id);
|
||||
} catch (\Exception $e) {
|
||||
// Skip this notification
|
||||
|
|
Loading…
Reference in a new issue