diff options
author | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2018-10-26 17:39:53 +0200 |
---|---|---|
committer | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2018-11-08 21:00:36 +0100 |
commit | e13571f8f3bdd58ab8df7610e0107119a4058ab8 (patch) | |
tree | 8e046885fce9e4083275db12edde7d0701480b49 /lib/Controller/PublicShareAuthController.php | |
parent | 86f7c8f0f2cb8fd6c45cdf6124d01c7536cdef17 (diff) |
Add support for link shares in "share:password" rooms
Until now only the e-mail shares had support for sending the password by
Talk. In Nextcloud 15 that feature was added to link shares too, so the
room name and the notification sent for "share:password" rooms has to be
adjusted accordingly.
The display name of "share:password" rooms is generated from the raw
name of the room (the e-mail for mail shares and the file name for link
shares) each time the room information is sent by the server, so the
display name was generalized to accomodate both types of raw names.
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/Controller/PublicShareAuthController.php')
-rw-r--r-- | lib/Controller/PublicShareAuthController.php | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/Controller/PublicShareAuthController.php b/lib/Controller/PublicShareAuthController.php index f30a6604c..c0d61394d 100644 --- a/lib/Controller/PublicShareAuthController.php +++ b/lib/Controller/PublicShareAuthController.php @@ -32,6 +32,7 @@ use OCP\AppFramework\OCSController; use OCP\IRequest; use OCP\IUser; use OCP\IUserManager; +use OCP\Share; use OCP\Share\IManager as ShareManager; use OCP\Share\Exceptions\ShareNotFound; @@ -100,8 +101,14 @@ class PublicShareAuthController extends OCSController { return new DataResponse([], Http::STATUS_NOT_FOUND); } + if ($share->getShareType() === Share::SHARE_TYPE_EMAIL) { + $roomName = $share->getSharedWith(); + } else { + $roomName = trim($share->getTarget(), '/'); + } + // Create the room - $room = $this->manager->createPublicRoom($share->getSharedWith(), 'share:password', $shareToken); + $room = $this->manager->createPublicRoom($roomName, 'share:password', $shareToken); $room->addUsers([ 'userId' => $sharerUser->getUID(), 'participantType' => Participant::OWNER, |