From 6b13b909ffe4d2d2cf39e82a4b173c84fcc0b493 Mon Sep 17 00:00:00 2001 From: ralf Date: Tue, 15 Oct 2024 14:38:16 +0200 Subject: [PATCH] only history-log and notify, if there were any links deleted --- api/src/Link.php | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/api/src/Link.php b/api/src/Link.php index 2634f14597..914ffcf49c 100644 --- a/api/src/Link.php +++ b/api/src/Link.php @@ -735,16 +735,17 @@ class Link extends Link\Storage $app2 = $link['link_app2']; $id2 = $link['link_id2']; } - if ($app && $app2) + // only history-log and notify, if there were any links deleted + if (($deleted = Link\Storage::unlink($link_id,$app,$id,$owner,$app2 != '!'.self::VFS_APPNAME ? $app2 : '',$id2,$hold_for_purge))) { - Storage\History::static_add($app,$id,$GLOBALS['egw_info']['user']['account_id'],'~link~','',$app2.':'.$id2); - Storage\History::static_add($app2,$id2,$GLOBALS['egw_info']['user']['account_id'],'~link~','',$app.':'.$id); + if ($app && $app2) + { + Storage\History::static_add($app,$id,$GLOBALS['egw_info']['user']['account_id'],'~link~','',$app2.':'.$id2); + Storage\History::static_add($app2,$id2,$GLOBALS['egw_info']['user']['account_id'],'~link~','',$app.':'.$id); + } + // only notify on real links, not the one cached for writing or fileattachments + self::notify_unlink($deleted); } - $deleted = Link\Storage::unlink($link_id,$app,$id,$owner,$app2 != '!'.self::VFS_APPNAME ? $app2 : '',$id2,$hold_for_purge); - - // only notify on real links, not the one cached for writing or fileattachments - self::notify_unlink($deleted); - return count($deleted); } if (!$link_id) $link_id = self::temp_link_id($app2,$id2); // create link_id of temporary link, if not given