diff --git a/src/Model/Item.php b/src/Model/Item.php index c57e6799b..d937430c3 100644 --- a/src/Model/Item.php +++ b/src/Model/Item.php @@ -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; } diff --git a/src/Module/Api/Mastodon/Statuses.php b/src/Module/Api/Mastodon/Statuses.php index e40709fe5..9bbc3bf63 100644 --- a/src/Module/Api/Mastodon/Statuses.php +++ b/src/Module/Api/Mastodon/Statuses.php @@ -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']];