From 2a154f8c9a772d61e7dabb5e3fd110ba00cc6007 Mon Sep 17 00:00:00 2001 From: Mario Date: Mon, 14 Dec 2020 11:02:20 +0000 Subject: merge branch files_ng into dev --- Zotlabs/Module/Attach_edit.php | 212 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 212 insertions(+) create mode 100644 Zotlabs/Module/Attach_edit.php (limited to 'Zotlabs/Module/Attach_edit.php') diff --git a/Zotlabs/Module/Attach_edit.php b/Zotlabs/Module/Attach_edit.php new file mode 100644 index 000000000..0a41dbb22 --- /dev/null +++ b/Zotlabs/Module/Attach_edit.php @@ -0,0 +1,212 @@ +set_from_array($_REQUEST); + $x = $acl->get(); + + attach_change_permissions($channel_id, $resource, $x['allow_cid'], $x['allow_gid'], $x['deny_cid'], $x['deny_gid'], $recurse, true); + $actions_done .= 'permissions,'; + + if ($notify) { + attach_store_item($channel, $observer, $resource); + $actions_done .= 'notify,'; + } + } + } + + if (! $admin_delete && $actions_done) { + $sync = attach_export_data($channel, $resource, false); + + if ($sync) { + Libsync::build_sync_packet($channel_id, ['file' => [$sync]]); + } + } + + logger('attach_edit: ' . $actions_done); + + } + + if($dnd || $delete) { + json_return_and_die([ 'success' => true ]); + } + + goaway($return_path); + + } + +} -- cgit v1.2.3 From 8e488e291347857407dbedaf05d63941701d82d2 Mon Sep 17 00:00:00 2001 From: Mario Date: Mon, 14 Dec 2020 21:56:19 +0000 Subject: handle removal of terms in attach_delete() when deleting a ressource --- Zotlabs/Module/Attach_edit.php | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) (limited to 'Zotlabs/Module/Attach_edit.php') diff --git a/Zotlabs/Module/Attach_edit.php b/Zotlabs/Module/Attach_edit.php index 0a41dbb22..667a0b7aa 100644 --- a/Zotlabs/Module/Attach_edit.php +++ b/Zotlabs/Module/Attach_edit.php @@ -110,15 +110,7 @@ class Attach_edit extends Controller { if ($delete) { attach_delete($channel_id, $resource, $is_photo); - - q("DELETE FROM term WHERE uid = %d AND oid = %d AND otype = %d", - intval($channel_id), - intval($attach_id), - intval(TERM_OBJ_FILE) - ); - $actions_done .= 'delete,'; - } if ($copy) { @@ -161,9 +153,8 @@ class Attach_edit extends Controller { store_item_tag($channel_id, $attach_id, TERM_OBJ_FILE, TERM_CATEGORY, $term, $term_link); } } + $actions_done .= 'cat_add,'; } - $actions_done .= 'cat_add,'; - } else { q("DELETE FROM term WHERE uid = %d AND oid = %d AND otype = %d", -- cgit v1.2.3 From 4a902dbbbe79a59d6e434ddb39ff24af93583da3 Mon Sep 17 00:00:00 2001 From: Mario Date: Mon, 14 Dec 2020 22:06:47 +0000 Subject: fix file sync issues --- Zotlabs/Module/Attach_edit.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Zotlabs/Module/Attach_edit.php') diff --git a/Zotlabs/Module/Attach_edit.php b/Zotlabs/Module/Attach_edit.php index 667a0b7aa..5880d8f13 100644 --- a/Zotlabs/Module/Attach_edit.php +++ b/Zotlabs/Module/Attach_edit.php @@ -181,7 +181,7 @@ class Attach_edit extends Controller { } if (! $admin_delete && $actions_done) { - $sync = attach_export_data($channel, $resource, false); + $sync = attach_export_data($channel, $resource, (($delete) ? true : false)); if ($sync) { Libsync::build_sync_packet($channel_id, ['file' => [$sync]]); -- cgit v1.2.3