]> git.mxchange.org Git - friendica.git/commitdiff
Use the "real" receiver when possible
authorMichael <heluecht@pirati.ca>
Fri, 29 Dec 2017 20:02:15 +0000 (20:02 +0000)
committerMichael <heluecht@pirati.ca>
Fri, 29 Dec 2017 20:02:15 +0000 (20:02 +0000)
src/Protocol/Diaspora.php

index aa80460cdb8fd920d437ee5dafa4eda37aebbd91..15a30f532e30f433ae7a9ff114a309e2c6675652 100644 (file)
@@ -3243,9 +3243,14 @@ class Diaspora
 
                // Fetch some user id to have a valid handle to transmit the participation.
                // In fact it doesn't matter which user sends this - but it is needed by the protocol.
-               $condition = ['verified' => true, 'blocked' => false, 'account_removed' => false, 'account_expired' => false];
-               $first_user = dba::select('user', ['uid'], $condition, ['limit' => 1]);
-               $owner = User::getOwnerDataById($first_user['uid']);
+               // If the item belongs to a user, we take this user id.
+               if ($item['uid'] == 0) {
+                       $condition = ['verified' => true, 'blocked' => false, 'account_removed' => false, 'account_expired' => false];
+                       $first_user = dba::select('user', ['uid'], $condition, ['limit' => 1]);
+                       $owner = User::getOwnerDataById($first_user['uid']);
+               } else {
+                       $owner = User::getOwnerDataById($item['uid']);
+               }
 
                $author = self::myHandle($owner);