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

Port isTargetAllowed to share 2.0 #26615

Merged
merged 1 commit into from
Nov 29, 2016
Merged

Port isTargetAllowed to share 2.0 #26615

merged 1 commit into from
Nov 29, 2016

Conversation

PVince81
Copy link
Contributor

Description

  • move isTargetAllowed to SharedMount and return false in moveMount
  • replace getItemShared() call with ShareManager->getSharesByPath()
  • implement ShareManager->getSharesByPath() by calling the provider

Related Issue

#22209 (comment)

Motivation and Context

Get rid of calls to old share API.

How Has This Been Tested?

TODO: explain

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Tech debt

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

TODOs

  • move tests for isTargetAllowed to the tests for SharedMount
  • fix unit tests
  • see FIXME in code

@mention-bot
Copy link

@PVince81, thanks for your PR! By analyzing the history of the files in this pull request, we identified @schiessle, @icewind1991 and @rullzer to be potential reviewers.

@PVince81
Copy link
Contributor Author

PVince81 commented Nov 14, 2016

I could of course modify the test to use a View again...

@PVince81
Copy link
Contributor Author

Rebased and adjusted test.

Please review @jvillafanez @VicDeo

* @return boolean
*/
private function isTargetAllowed($target) {
private function isTargetAllowed(MoveableMount $mount1, $target) {
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure if we should rename this method (or the one in the Mount class) or not. I got confused with both.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I could give that one here another name and keep MoveableMount::isTargetAllowed(), might remove confusion.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

renamed to "canMove()" now

}

// in most cases it's the same provider
if ($providers[0] === $providers[1]) {
Copy link
Member

Choose a reason for hiding this comment

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

use array_unique or something similar instead?. It might won't happen, but if at some point we get 3 or more providers this will give trouble.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Indeed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Boo, array_unique only works for strings, PHP tries to convert these to strings.

I'll try and do it differently using provider id as keys

@PVince81
Copy link
Contributor Author

Adjusted and squashed.

I also added a test for getSharesByPath after realizing that there wasn't one.

@jvillafanez rereview ?

@jvillafanez
Copy link
Member

Changes look good 👍

@PVince81 PVince81 merged commit bebf120 into master Nov 29, 2016
@PVince81 PVince81 deleted the share20-istargetallowed branch November 29, 2016 17:36
@lock
Copy link

lock bot commented Aug 4, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Aug 4, 2019
This pull request was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants