]> git.mxchange.org Git - friendica.git/blobdiff - src/Navigation/Notifications/ValueObject/FormattedNavNotification.php
Merge branch 'develop' into show_image_upload_limit
[friendica.git] / src / Navigation / Notifications / ValueObject / FormattedNavNotification.php
index 4a11fa616f59fe140bd409e6184478af8d147946..04c1f6143e51bb77af577fd1655119c2803f4038 100644 (file)
 
 namespace Friendica\Navigation\Notifications\ValueObject;
 
-use Friendica\BaseDataTransferObject;
+use Friendica\BaseEntity;
 
 /**
  * A view-only object for printing item notifications to the frontend
  */
-class FormattedNavNotification extends BaseDataTransferObject
+class FormattedNavNotification extends BaseEntity
 {
        /** @var array */
        protected $contact;
@@ -42,16 +42,23 @@ class FormattedNavNotification extends BaseDataTransferObject
        protected $seen;
 
        /**
-        * @param array  $contact   Contact array with the following keys: name, url, photo
-        * @param string $timestamp Unix timestamp
-        * @param string $plaintext Localized notification message with the placeholder replaced by the contact name
-        * @param string $html      Full HTML string of the notification menu element
-        * @param string $href      Absolute URL this notification should send the user to when interacted with
-        * @param bool   $seen      Whether the user interacted with this notification once
+        * @param string $contact_name  Contact display name
+        * @param string $contact_url   Contact profile URL
+        * @param string $contact_photo Contact picture URL
+        * @param string $timestamp     Unix timestamp
+        * @param string $plaintext     Localized notification message with the placeholder replaced by the contact name
+        * @param string $html          Full HTML string of the notification menu element
+        * @param string $href          Absolute URL this notification should send the user to when interacted with
+        * @param bool   $seen          Whether the user interacted with this notification once
         */
-       public function __construct(array $contact, string $timestamp, string $plaintext, string $html, string $href, bool $seen)
+       public function __construct(string $contact_name, string $contact_url, string $contact_photo, string $timestamp, string $plaintext, string $html, string $href, bool $seen)
        {
-               $this->contact   = $contact;
+               // Properties differ from constructor because this structure is used in the "nav-update" Javascript event listener
+               $this->contact = [
+                       'name'  => $contact_name,
+                       'url'   => $contact_url,
+                       'photo' => $contact_photo,
+               ];
                $this->timestamp = $timestamp;
                $this->plaintext = $plaintext;
                $this->html      = $html;