-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
use relative path in shared_by_email activity #37555
Conversation
Thanks for opening this pull request! The maintainers of this repository would appreciate it if you would create a changelog item based on your changes. |
1e46b91
to
576a9b7
Compare
@@ -272,7 +279,8 @@ public function sendLinkShareMail($sender, $recipients, $link, $personalNote = n | |||
$failedRecipients = $this->sendLinkShareMailFromBody($recipients, $subject, $htmlBody, $textBody, $from, $replyTo); | |||
if (empty($failedRecipients)) { | |||
$event = $this->activityManager->generateEvent(); | |||
$path = $shareNode->getPath(); | |||
$userFolder = $this->rootFolder->getUserFolder($sender->getUID()); | |||
$path = $userFolder->getRelativePath($shareNode->getPath()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For reshare case, since the node path is outside of the re-sharer folder, $path
will be null.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what could we do? We are not allowed to have a userid here
Units tests also need to be adjusted. @micbar if you prefer, I can take over this one. |
@micbar The code now gets the actual file node of the sender. In this way, I believe the relative path calculated correctly. I manually tested the code with both re-share and the normal case, everything worked without problem. Also, unit tests adjusted. |
Codecov Report
@@ Coverage Diff @@
## master #37555 +/- ##
=========================================
Coverage 64.66% 64.66%
Complexity 19343 19343
=========================================
Files 1279 1279
Lines 75600 75604 +4
Branches 1333 1333
=========================================
+ Hits 48885 48889 +4
Misses 26323 26323
Partials 392 392
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #37555 +/- ##
=========================================
Coverage 64.66% 64.66%
Complexity 19343 19343
=========================================
Files 1279 1279
Lines 75600 75604 +4
Branches 1333 1333
=========================================
+ Hits 48885 48889 +4
Misses 26323 26323
Partials 392 392
Continue to review full report at Codecov.
|
0042812
to
5de0aab
Compare
Changelog added. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do not merge yet. We need to decide if we release it woth 10.5.0
$path = $shareNode->getPath(); | ||
// it can be a re-share, get actual share file node | ||
$userFolder = $this->rootFolder->getUserFolder($sender->getUID()); | ||
$shareFileNodes = $userFolder->getById($shareNode->getId(), true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not $share->getNodeId()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No difference. $shareNode
already defined in above, no drawback to using it also. There is similar actual share node detection logic in the share manager. Copied it from there.
core/lib/private/Share20/Manager.php
Lines 358 to 361 in f0b2901
// retrieve received share node $shareFileNode being reshared with $share | |
$userFolder = $this->rootFolder->getUserFolder($share->getSharedBy()); | |
$shareFileNodes = $userFolder->getById($shareNode->getId(), true); | |
$shareFileNode = $shareFileNodes[0] ?? null; |
Description
Do not use the absolute Webdav Path for the
shared_by_email
activity.Related Issue
Motivation and Context
Do not display unecessary information.
How Has This Been Tested?
Screenshots (if appropriate):
Types of changes
Checklist:
Tasks