Fix for sending content via connectors

This commit is contained in:
Michael 2021-05-16 14:30:15 +00:00
parent 9c27de3f6d
commit dd16bccbc8
2 changed files with 21 additions and 7 deletions

View 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;
}

View 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']];