Skip to content
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

Merged
merged 2 commits into from
Jun 22, 2020
Merged

Conversation

micbar
Copy link
Contributor

@micbar micbar commented Jun 18, 2020

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?

  • manually

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Database schema changes (next release will require increase of minor version instead of patch)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Technical debt
  • Tests only (no source changes)

Checklist:

  • Code changes
  • Unit tests added
  • Acceptance tests added
  • Documentation ticket raised:
  • Changelog item, see TEMPLATE

Tasks

  • Needs Changelog item
  • Needs manual testing

@update-docs
Copy link

update-docs bot commented Jun 18, 2020

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.

@micbar micbar self-assigned this Jun 18, 2020
@micbar micbar added this to the development milestone Jun 18, 2020
@micbar micbar added sev2-high p1-urgent Critical issue, need to consider hotfix with just that issue labels Jun 18, 2020
@@ -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());
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch.

Copy link
Contributor Author

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

@karakayasemi
Copy link
Contributor

Units tests also need to be adjusted. @micbar if you prefer, I can take over this one.

@karakayasemi
Copy link
Contributor

karakayasemi commented Jun 18, 2020

@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
Copy link

codecov bot commented Jun 18, 2020

Codecov Report

Merging #37555 into master will increase coverage by 0.00%.
The diff coverage is 83.33%.

Impacted file tree graph

@@            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           
Flag Coverage Δ Complexity Δ
#javascript 54.03% <ø> (ø) 0.00 <ø> (ø)
#phpunit 65.83% <83.33%> (+<0.01%) 19343.00 <0.00> (ø)
Impacted Files Coverage Δ Complexity Δ
..._sharing/lib/Controller/NotificationController.php 42.10% <0.00%> (ø) 14.00 <0.00> (ø)
lib/private/Share/MailNotifications.php 95.74% <100.00%> (+0.09%) 33.00 <0.00> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 187bd0d...0042812. Read the comment docs.

@codecov
Copy link

codecov bot commented Jun 18, 2020

Codecov Report

Merging #37555 into master will increase coverage by 0.00%.
The diff coverage is 83.33%.

Impacted file tree graph

@@            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           
Flag Coverage Δ Complexity Δ
#javascript 54.03% <ø> (ø) 0.00 <ø> (ø)
#phpunit 65.83% <83.33%> (+<0.01%) 19343.00 <0.00> (ø)
Impacted Files Coverage Δ Complexity Δ
..._sharing/lib/Controller/NotificationController.php 42.10% <0.00%> (ø) 14.00 <0.00> (ø)
lib/private/Share/MailNotifications.php 95.74% <100.00%> (+0.09%) 33.00 <0.00> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f0b2901...5de0aab. Read the comment docs.

@micbar micbar requested a review from karakayasemi June 18, 2020 16:06
@karakayasemi
Copy link
Contributor

Changelog added.

Copy link
Contributor Author

@micbar micbar left a 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);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not $share->getNodeId()?

Copy link
Contributor

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.

// 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;

@micbar micbar merged commit 9b395f0 into master Jun 22, 2020
@delete-merged-branch delete-merged-branch bot deleted the fix/mail-resource-path branch June 22, 2020 08:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p1-urgent Critical issue, need to consider hotfix with just that issue sev2-high Type:Bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants