Skip to content

Commit 02cac5a

Browse files
committed
fix: use target path for unshare-from-self events
Signed-off-by: Robin Appelman <robin@icewind.nl>
1 parent db380fa commit 02cac5a

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

lib/FilesHooks.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -879,7 +879,7 @@ protected function unshareFromUser(IShare $share) {
879879
*/
880880
protected function selfUnshareFromUser(IShare $share) {
881881
// User performing the share
882-
$this->shareNotificationForSharer('self_unshared', $share->getSharedWith(), $share->getNode());
882+
$this->shareNotificationForSharer('self_unshared', $share->getSharedWith(), $share->getNode(), $share->getTarget());
883883

884884
// Owner
885885
if ($this->currentUser->getUID() !== null) {
@@ -936,7 +936,7 @@ protected function unshareFromGroup(IShare $share) {
936936
*/
937937
protected function unshareFromSelfGroup(IShare $share) {
938938
// User performing the unshare
939-
$this->shareNotificationForSharer('self_unshared', $this->currentUser->getUID(), $share->getNode());
939+
$this->shareNotificationForSharer('self_unshared', $this->currentUser->getUID(), $share->getNode(), $share->getTarget());
940940

941941
// Owner
942942
if ($this->currentUser->getUID() !== null) {
@@ -1056,12 +1056,14 @@ protected function fixPathsForShareExceptions(array $affectedUsers, $shareId) {
10561056
* @param string $shareWith
10571057
* @param Node $fileSource
10581058
*/
1059-
protected function shareNotificationForSharer(string $subject, string $shareWith, Node $fileSource) {
1059+
protected function shareNotificationForSharer(string $subject, string $shareWith, Node $fileSource, ?string $path = null) {
10601060
$sharer = $this->currentUser->getUID();
10611061
if ($sharer === null) {
10621062
return;
10631063
}
1064-
$path = $this->getUserRelativePath($sharer, $fileSource->getPath());
1064+
if (!$path) {
1065+
$path = $this->getUserRelativePath($sharer, $fileSource->getPath());
1066+
}
10651067

10661068
$this->addNotificationsForUser(
10671069
$sharer, $subject, [[$fileSource->getId() => $path], $shareWith],

0 commit comments

Comments
 (0)