]> git.mxchange.org Git - friendica.git/commitdiff
Fix for sending content via connectors
authorMichael <heluecht@pirati.ca>
Sun, 16 May 2021 14:30:15 +0000 (14:30 +0000)
committerMichael <heluecht@pirati.ca>
Sun, 16 May 2021 14:30:15 +0000 (14:30 +0000)
src/Model/Item.php
src/Module/Api/Mastodon/Statuses.php

index c57e6799b0894072df35e990e939e9e67a023e01..d937430c39a5762014260d897c3a0f9dab195e0e 100644 (file)
@@ -932,7 +932,25 @@ class Item
                if ($notify) {
                        $item['edit'] = false;
                        $item['parent'] = $parent_id;
+
+                       // Trigger automatic reactions for addons
+                       $item['api_source'] = true;
+
+                       // We have to tell the hooks who we are - this really should be improved
+                       if (!local_user()) {
+                               $_SESSION['authenticated'] = true;
+                               $_SESSION['uid'] = $uid;
+                               $dummy_session = true;
+                       } else {
+                               $dummy_session = false;
+                       }
+
                        Hook::callAll('post_local', $item);
+
+                       if ($dummy_session) {
+                               unset($_SESSION['authenticated']);
+                               unset($_SESSION['uid']);
+                       }
                } else {
                        Hook::callAll('post_remote', $item);
                }
@@ -1971,13 +1989,6 @@ class Item
                        $result = true;
                }
 
-               // Trigger automatic reactions for addons
-               $datarray['api_source'] = true;
-
-               // We have to tell the hooks who we are - this really should be improved
-               $_SESSION['authenticated'] = true;
-               $_SESSION['uid'] = $contact['uid'];
-
                return (bool)$result;
        }
 
index e40709fe5b5c032203c483b1607cf30d4ebd7faa..9bbc3bf6361515446b3b649a7206a14c7be5875f 100644 (file)
@@ -29,6 +29,7 @@ use Friendica\DI;
 use Friendica\Model\Contact;
 use Friendica\Model\Group;
 use Friendica\Model\Item;
+use Friendica\Model\Photo;
 use Friendica\Model\Post;
 use Friendica\Model\User;
 use Friendica\Module\BaseApi;
@@ -156,6 +157,8 @@ class Statuses extends BaseApi
                                        continue;
                                }
 
+                               Photo::setPermissionForRessource($media[0]['resource-id'], $uid, $item['allow_cid'], $item['allow_gid'], $item['deny_cid'], $item['deny_gid']);
+
                                $ressources[] = $media[0]['resource-id'];
                                $phototypes = Images::supportedTypes();
                                $ext = $phototypes[$media[0]['type']];