Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fix: use target path for unshare-from-self events
Signed-off-by: Robin Appelman <[email protected]>
  • Loading branch information
icewind1991 committed Aug 14, 2025
commit 030d1f2a70a0b7680787d98dc9c11ef2d2b6066e
12 changes: 7 additions & 5 deletions lib/FilesHooks.php
Original file line number Diff line number Diff line change
Expand Up @@ -827,7 +827,7 @@ public function unShareSelf(IShare $share) {
if ($share->getShareType() === IShare::TYPE_GROUP) {
$this->unshareFromSelfGroup($share);
} else {
$this->unShare($share);
$this->unshareFromUser($share);
}
}
}
Expand Down Expand Up @@ -879,7 +879,7 @@ protected function unshareFromUser(IShare $share) {
*/
protected function selfUnshareFromUser(IShare $share) {
// User performing the share
$this->shareNotificationForSharer('self_unshared', $share->getSharedWith(), $share->getNode());
$this->shareNotificationForSharer('self_unshared', $share->getSharedWith(), $share->getNode(), $share->getTarget());

// Owner
if ($this->currentUser->getUID() !== null) {
Expand Down Expand Up @@ -936,7 +936,7 @@ protected function unshareFromGroup(IShare $share) {
*/
protected function unshareFromSelfGroup(IShare $share) {
// User performing the unshare
$this->shareNotificationForSharer('self_unshared', $this->currentUser->getUID(), $share->getNode());
$this->shareNotificationForSharer('self_unshared', $this->currentUser->getUID(), $share->getNode(), $share->getTarget());

// Owner
if ($this->currentUser->getUID() !== null) {
Expand Down Expand Up @@ -1056,12 +1056,14 @@ protected function fixPathsForShareExceptions(array $affectedUsers, $shareId) {
* @param string $shareWith
* @param Node $fileSource
*/
protected function shareNotificationForSharer(string $subject, string $shareWith, Node $fileSource) {
protected function shareNotificationForSharer(string $subject, string $shareWith, Node $fileSource, ?string $path = null) {
$sharer = $this->currentUser->getUID();
if ($sharer === null) {
return;
}
$path = $this->getUserRelativePath($sharer, $fileSource->getPath());
if (!$path) {
$path = $this->getUserRelativePath($sharer, $fileSource->getPath());
}

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