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 reshare public links to the original share owner #36865

Merged
merged 4 commits into from
Mar 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
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
6 changes: 6 additions & 0 deletions changelog/unreleased/36865
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Bugfix: show re-share public links to share-owner

Public links created by share-recipient were not visible to share-owner.
This problem has been resolved.

https://github.com/owncloud/core/pull/36865
8 changes: 0 additions & 8 deletions core/js/shareitemmodel.js
Original file line number Diff line number Diff line change
Expand Up @@ -803,14 +803,6 @@
|| share.item_source === this.get('itemSource'));

if (isShareLink) {
/*
* Ignore reshared link shares for now
* FIXME: Find a way to display properly
*/
if (share.uid_owner !== OC.currentUser) {
return share;
}

linkShares.push(share);
return share;
}
Expand Down
35 changes: 32 additions & 3 deletions tests/acceptance/features/bootstrap/WebUISharingContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -1636,11 +1636,11 @@ public function thePublicShouldSeeAnErrorMessageWhileAccessingLastCreatedPublicL
public function createPublicShareLink($name, $settings = null) {
$this->filesPage->waitTillPageIsloaded($this->getSession());
//close any open sharing dialog
//if there is no dialog open and we try to close it
//an exception will be thrown, but we do not care
try {
$this->filesPage->closeDetailsDialog();
} catch (Exception $e) {
} catch (ElementNotFoundException $e) {
//if there is no dialog open and we try to close it
//an exception will be thrown, but we do not care
}
$session = $this->getSession();
$this->sharingDialog = $this->filesPage->openSharingDialog(
Expand Down Expand Up @@ -1915,4 +1915,33 @@ public function theFollowingResourcesShouldNotHaveShareIndicatorOnTheWebUI(Table
);
}
}

/**
* @Then a public link share with name :arg1 should be visible on the webUI
*
* @param string $expectedLinkEntryName
*
* @return void
*/
public function publicLinkShareWithNameShouldBeVisibleOnTheWebUI($expectedLinkEntryName) {
$actualNamesArrayOfPublicLinks = $this->publicShareTab->getListedPublicLinksNames();
Assert::assertTrue(\in_array($expectedLinkEntryName, $actualNamesArrayOfPublicLinks));
}

/**
* @Then :arg1 public link shares with name :arg2 should be visible on the webUI
*
* @param string $expectedCount
* @param string $expectedLinkEntryName
*
* @return void
*/
public function publicLinkSharesWithNameShouldBeVisibleOnTheWebUI($expectedCount, $expectedLinkEntryName) {
$actualNamesArrayOfPublicLinks = $this->publicShareTab->getListedPublicLinksNames();
Assert::assertTrue(\in_array($expectedLinkEntryName, $actualNamesArrayOfPublicLinks));
Assert::assertEquals(
\array_count_values($actualNamesArrayOfPublicLinks)[$expectedLinkEntryName],
$expectedCount
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class PublicLinkTab extends OwncloudPage {
private $createLinkBtnXpath = ".//button[@class='addLink']";
private $popupXpath = ".//div[@class='oc-dialog' and not(contains(@style,'display: none'))]";
private $linkEntryByNameXpath = ".//*[@class='link-entry--title' and .=%s]/..";
private $linkEntriesNamesXpath = "//div[@id='shareDialogLinkList']//span[@class='link-entry--title']";
private $linkUrlInputXpath = ".//input";
private $publicLinkWarningMessageXpath = ".//*[@class='error-message-global'][last()]";
private $linkEditBtnXpath = "//div[@class='link-entry--icon-button editLink']";
Expand Down Expand Up @@ -345,4 +346,18 @@ private function findLinkEntryByName($name) {
);
return $linkEntry;
}

/**
* gets listed public links names created/re-shares
*
* @return array
*/
public function getListedPublicLinksNames() {
$namesArray = [];
$visibleNamesArray = $this->findAll("xpath", $this->linkEntriesNamesXpath);
foreach ($visibleNamesArray as $entry) {
\array_push($namesArray, $entry->getText());
}
return $namesArray;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -260,3 +260,36 @@ Feature: Sharing files and folders with internal users
And file "textfile.txt" should be listed on the webUI
And the content of "textfile.txt" should be the same as the local "textfile.txt"
And it should not be possible to share file "textfile.txt" using the webUI

Scenario: reshare indicators of public links to the original share owner
Given these users have been created with default attributes and without skeleton files:
| username |
| user0 |
| user1 |
And user "user0" has uploaded file with content "uploaded content" to "lorem.txt"
And user "user0" has shared file "lorem.txt" with user "user1"
And user "user1" has created a public link share with settings
| path | /lorem.txt |
| name | Public link |
And user "user0" has logged in using the webUI
When the user opens the share dialog for file "lorem.txt"
And the user opens the public link share tab
Then a public link share with name "Public link" should be visible on the webUI

Scenario: reshare indicators of multiple public links with same name to the original share owner
Given these users have been created with default attributes and without skeleton files:
| username |
| user0 |
| user1 |
And user "user0" has uploaded file with content "uploaded content" to "lorem.txt"
And user "user0" has shared file "lorem.txt" with user "user1"
And user "user0" has created a public link share with settings
| path | /lorem.txt |
| name | Public link |
And user "user1" has created a public link share with settings
| path | lorem.txt |
| name | Public link |
And user "user0" has logged in using the webUI
When the user opens the share dialog for file "lorem.txt"
And the user opens the public link share tab
Then 2 public link shares with name "Public link" should be visible on the webUI