diff options
author | Mario Vavti <mario@mariovavti.com> | 2024-11-10 11:40:56 +0100 |
---|---|---|
committer | Mario Vavti <mario@mariovavti.com> | 2024-11-10 11:40:56 +0100 |
commit | e339fbcc464ee2cc2b6caa8e456ca59606828906 (patch) | |
tree | 4d6e5af8d8ea805b3fa6cb1b37db53b3ea1e8c67 /include/photos.php | |
parent | c9d4b068c254bd58e6da5d6349ab8b7ae96b6054 (diff) | |
download | volse-hubzilla-e339fbcc464ee2cc2b6caa8e456ca59606828906.tar.gz volse-hubzilla-e339fbcc464ee2cc2b6caa8e456ca59606828906.tar.bz2 volse-hubzilla-e339fbcc464ee2cc2b6caa8e456ca59606828906.zip |
container fixes for photo and file upload
Diffstat (limited to 'include/photos.php')
-rw-r--r-- | include/photos.php | 40 |
1 files changed, 30 insertions, 10 deletions
diff --git a/include/photos.php b/include/photos.php index 511024107..fe1a500d6 100644 --- a/include/photos.php +++ b/include/photos.php @@ -7,6 +7,7 @@ use Zotlabs\Access\PermissionLimits; use Zotlabs\Lib\Activity; use Zotlabs\Lib\Config; +use Zotlabs\Daemon\Master; require_once('include/permissions.php'); require_once('include/items.php'); @@ -438,13 +439,13 @@ function photo_upload($channel, $observer, $args) { else { $object['to'] = Activity::map_acl(array_merge($ac, ['item_private' => 1 - intval($public)])); } - +/* $target = [ 'type' => 'orderedCollection', 'name' => ((strlen($album)) ? $album : '/'), 'id' => z_root() . '/album/' . $channel['channel_address'] . ((isset($args['directory']['hash'])) ? '/' . $args['directory']['hash'] : EMPTY_STR) ]; - +*/ // Create item container if (isset($args['item'])) { foreach ($args['item'] as $i) { @@ -453,6 +454,11 @@ function photo_upload($channel, $observer, $args) { $force = false; if ($item['mid'] === $item['parent_mid']) { + $target = [ + 'id' => str_replace('/item/', '/conversation/', $item['mid']), + 'type' => 'Collection', + 'attributedTo' => channel_url($channel), + ]; $item['body'] = $summary; $item['mimetype'] = 'text/bbcode'; @@ -462,7 +468,7 @@ function photo_upload($channel, $observer, $args) { $object['diaspora:guid'] = $item['uuid']; $item['obj'] = json_encode($object); - $item['tgt_type'] = 'orderedCollection'; + $item['tgt_type'] = 'Collection'; $item['target'] = json_encode($target); if ($post_tags) { $arr['term'] = $post_tags; @@ -477,15 +483,23 @@ function photo_upload($channel, $observer, $args) { if (($item['edited'] > $r[0]['edited']) || $force) { $item['id'] = $r[0]['id']; $item['uid'] = $channel['channel_id']; - item_store_update($item, false, $deliver); + $result = item_store_update($item, deliver: $deliver); continue; } } else { $item['aid'] = $channel['channel_account_id']; $item['uid'] = $channel['channel_id']; - item_store($item, false, $deliver); + $result = item_store($item, deliver: $deliver); } + + if ($result['success'] && $visible && $deliver) { + Master::Summon(['Notifier', 'wall-new', $result['item_id']]); + if (!empty($result['approval_id'])) { + Master::Summon(['Notifier', 'wall-new', $result['approval_id']]); + } + } + } } else { @@ -496,6 +510,12 @@ function photo_upload($channel, $observer, $args) { $object['id'] = $mid; $object['diaspora:guid'] = $uuid; + $target = [ + 'id' => z_root() . '/conversation/' . $uuid, + 'type' => 'Collection', + 'attributedTo' => channel_url($channel), + ]; + $arr = [ 'aid' => $account_id, 'uid' => $channel_id, @@ -514,9 +534,9 @@ function photo_upload($channel, $observer, $args) { 'deny_gid' => $ac['deny_gid'], 'verb' => 'Create', 'obj_type' => 'Image', - 'obj' => json_encode($object), - 'tgt_type' => 'orderedCollection', - 'target' => json_encode($target), + 'obj' => $object, + 'tgt_type' => 'Collection', + 'target' => $target, 'item_wall' => $visible, 'item_origin' => 1, 'item_thread_top' => 1, @@ -546,9 +566,9 @@ function photo_upload($channel, $observer, $args) { $arr['item_private'] = 1; } - $result = item_store($arr, false, $deliver); + $result = item_store($arr, deliver: $deliver); - if ($visible && $deliver) { + if ($result['success'] && $visible && $deliver) { Master::Summon(['Notifier', 'wall-new', $result['item_id']]); if (!empty($result['approval_id'])) { Master::Summon(['Notifier', 'wall-new', $result['approval_id']]); |