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

Show pending remote shares at the 'Shared with you' tab #37022

Merged
merged 5 commits into from
Mar 18, 2020
Merged

Conversation

VicDeo
Copy link
Member

@VicDeo VicDeo commented Feb 26, 2020

Description

  • Remove deprecated static API class usage in favor of OcsController
  • Display pending remote shares at the Shared with you tab
  • Adapt accept/decline process to the remote shares

Related Issue

Motivation and Context

Shared with should include pending remote shares

How Has This Been Tested?

  1. A create several federated shares
  2. As a recipient browse to the shared with you tab and accept/decline them

Screenshots (if appropriate):

shared with you

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

@VicDeo VicDeo added this to the development milestone Feb 26, 2020
@VicDeo VicDeo self-assigned this Feb 26, 2020
@update-docs
Copy link

update-docs bot commented Feb 26, 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.

@VicDeo VicDeo force-pushed the bugfix/3793 branch 8 times, most recently from adf5f9d to 450ceb2 Compare February 27, 2020 14:51
@owncloud owncloud deleted a comment from codecov bot Mar 2, 2020
@owncloud owncloud deleted a comment from codecov bot Mar 2, 2020
@owncloud owncloud deleted a comment from codecov bot Mar 2, 2020
@owncloud owncloud deleted a comment from codecov bot Mar 2, 2020
@codecov
Copy link

codecov bot commented Mar 2, 2020

Codecov Report

Merging #37022 into master will increase coverage by 0.06%.
The diff coverage is 71.42%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #37022      +/-   ##
============================================
+ Coverage     64.78%   64.85%   +0.06%     
- Complexity    19130    19135       +5     
============================================
  Files          1267     1267              
  Lines         74912    74893      -19     
  Branches       1328     1331       +3     
============================================
+ Hits          48533    48573      +40     
+ Misses        25989    25928      -61     
- Partials        390      392       +2     
Flag Coverage Δ Complexity Δ
#javascript 54.14% <28.57%> (-0.05%) 0.00 <0.00> (ø)
#phpunit 66.05% <79.22%> (+0.08%) 19135.00 <16.00> (+5.00)
Impacted Files Coverage Δ Complexity Δ
apps/files_sharing/appinfo/routes.php 92.85% <ø> (-4.52%) 0.00 <0.00> (ø)
apps/files_sharing/js/sharedfilelist.js 82.96% <ø> (ø) 0.00 <0.00> (ø)
apps/files_sharing/lib/AppInfo/Application.php 48.62% <7.14%> (-6.12%) 7.00 <0.00> (+1.00) ⬇️
apps/files_sharing/js/app.js 70.12% <28.57%> (-3.26%) 0.00 <0.00> (ø)
...les_sharing/lib/Controller/RemoteOcsController.php 95.23% <95.23%> (ø) 16.00 <16.00> (?)
lib/private/Share20/Manager.php 96.31% <0.00%> (+<0.01%) 273.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 f503c3a...8a4db46. Read the comment docs.

@VicDeo VicDeo changed the title Shared with you and remote shares Show pending remote shares at the 'Shared with you' tab Mar 13, 2020
apps/files_sharing/js/sharedfilelist.js Outdated Show resolved Hide resolved
$server->getEventDispatcher(),
$uid
),
$uid
Copy link
Member

Choose a reason for hiding this comment

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

I'd prefer to inject the userSession object in order to follow what has been done in other places, but taking into account that the "Manager" being injected uses the uid, it might be problematic: if the userSession changes, the manager would still use the previous user id.
In addition, I'm not sure how it will behave under this "change the user session" scenario with the Filesystem objects being injected.

Worst case, we could end up with a static controller, but being a controller it might not be a big problem

Copy link
Member Author

Choose a reason for hiding this comment

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

tried that, not possible - everything breaks down.

apps/files_sharing/lib/Controller/RemoteOcsController.php Outdated Show resolved Hide resolved
}

// Make sure the user has no notification for something that does not exist anymore.
$this->externalManager->processNotification((int) $id);
Copy link
Member

Choose a reason for hiding this comment

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

At the moment, it's a bit unclear if the processNotification will be called (or should be called) if the share is accepted.
If the function is automatically called after the share is accepted, include a code comment here.

Copy link
Member Author

Choose a reason for hiding this comment

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

Make sure the user has no notification for something that does not exist anymore.

Copy link
Member Author

Choose a reason for hiding this comment

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

when the share is accepted we don't care about notification.

}

// Make sure the user has no notification for something that does not exist anymore.
$this->externalManager->processNotification((int) $id);
Copy link
Member

Choose a reason for hiding this comment

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

Same here.

Copy link
Member Author

Choose a reason for hiding this comment

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

same as above. this is a sanity measure 'for something that does not exist anymore'

* @return Result
*/
public function getAllShares() {
return $this->getShares(true);
Copy link
Member

Choose a reason for hiding this comment

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

Technically, I'd prefer to have a private method such as getSharesPrivate($includePending=false) in order to make both functions getShares and getAllShares to explicitly return a Result.

Copy link
Member Author

Choose a reason for hiding this comment

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

Not essential IMO

apps/files_sharing/lib/Controller/RemoteOcsController.php Outdated Show resolved Hide resolved
* @throws \Exception
*/
protected function getFileInfo($mountpoint) {
$view = new View('/' . $this->uid . '/files/');
Copy link
Member

Choose a reason for hiding this comment

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

Any better alternative? Maybe we can inject an IRootFolder and get the info from there? This might be a problem for testing.

Copy link
Member Author

@VicDeo VicDeo Mar 18, 2020

Choose a reason for hiding this comment

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

Not a problem for testing as this method was added exactly to make testing possible.
Moreover, RemoteOcsController has coverage 95.23% and is based on the code from a deleted apps/files_sharing/lib/API/Remote.php file that had 0% coverage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants