]> git.mxchange.org Git - friendica.git/blobdiff - src/Model/Mail.php
Added logging
[friendica.git] / src / Model / Mail.php
index 67d5d1ddca3371a9152ccce1bffe7ae3c369410d..2670a5885f2d8ef57dde74d9fcc0dd723b0ab020 100644 (file)
@@ -84,19 +84,12 @@ class Mail
 
                // send notifications.
                $notif_params = [
-                       'type' => Type::MAIL,
-                       'notify_flags' => $user['notify-flags'],
-                       'language' => $user['language'],
-                       'to_name' => $user['username'],
-                       'to_email' => $user['email'],
-                       'uid' => $user['uid'],
-                       'item' => $msg,
-                       'parent' => $msg['id'],
-                       'source_name' => $msg['from-name'],
-                       'source_link' => $msg['from-url'],
-                       'source_photo' => $msg['from-photo'],
-                       'verb' => Activity::POST,
-                       'otype' => 'mail'
+                       'type'  => Type::MAIL,
+                       'otype' => Notify\ObjectType::MAIL,
+                       'verb'  => Activity::POST,
+                       'uid'   => $user['uid'],
+                       'cid'   => $msg['contact-id'],
+                       'link'  => DI::baseUrl() . '/message/' . $msg['id'],
                ];
 
                notification($notif_params);
@@ -129,9 +122,12 @@ class Mail
                }
 
                $me = DBA::selectFirst('contact', [], ['uid' => local_user(), 'self' => true]);
-               $contact = DBA::selectFirst('contact', [], ['id' => $recipient, 'uid' => local_user()]);
+               if (!DBA::isResult($me)) {
+                       return -2;
+               }
 
-               if (!(count($me) && (count($contact)))) {
+               $contact = DBA::selectFirst('contact', [], ['id' => $recipient, 'uid' => local_user()]);
+               if (!DBA::isResult($contact)) {
                        return -2;
                }