mirror of
https://github.com/nextcloud/spreed.git
synced 2025-12-18 05:20:50 +01:00
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>
This commit is contained in:
parent
86f7c8f0f2
commit
e13571f8f3
3 changed files with 26 additions and 13 deletions
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -227,7 +227,7 @@ class RoomController extends OCSController {
|
|||
|
||||
if ($room->getObjectType() === 'share:password') {
|
||||
// FIXME use an event
|
||||
$roomData['displayName'] = $this->l10n->t('Password request by %s', [$room->getName()]);
|
||||
$roomData['displayName'] = $this->l10n->t('Password request: %s', [$room->getName()]);
|
||||
}
|
||||
|
||||
$currentUser = $this->userManager->get($this->userId);
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ use OCP\L10N\IFactory;
|
|||
use OCP\Notification\INotification;
|
||||
use OCP\Notification\INotifier;
|
||||
use OCP\RichObjectStrings\Definitions;
|
||||
use OCP\Share;
|
||||
use OCP\Share\Exceptions\ShareNotFound;
|
||||
use OCP\Share\IManager as IShareManager;
|
||||
|
||||
|
|
@ -463,19 +464,24 @@ class Notifier implements INotifier {
|
|||
throw new \InvalidArgumentException('Unknown share');
|
||||
}
|
||||
|
||||
$sharedWith = $share->getSharedWith();
|
||||
if ($share->getShareType() === Share::SHARE_TYPE_EMAIL) {
|
||||
$sharedWith = $share->getSharedWith();
|
||||
|
||||
$notification
|
||||
->setParsedSubject(str_replace('{email}', $sharedWith, $l->t('{email} requested the password to access a share')))
|
||||
->setRichSubject(
|
||||
$l->t('{email} requested the password to access a share'), [
|
||||
'email' => [
|
||||
'type' => 'email',
|
||||
'id' => $sharedWith,
|
||||
'name' => $sharedWith,
|
||||
$notification
|
||||
->setParsedSubject(str_replace('{email}', $sharedWith, $l->t('{email} requested the password to access a share')))
|
||||
->setRichSubject(
|
||||
$l->t('{email} requested the password to access a share'), [
|
||||
'email' => [
|
||||
'type' => 'email',
|
||||
'id' => $sharedWith,
|
||||
'name' => $sharedWith,
|
||||
]
|
||||
]
|
||||
]
|
||||
);
|
||||
);
|
||||
} else {
|
||||
$notification
|
||||
->setParsedSubject($l->t('Someone requested the password to access a share'));
|
||||
}
|
||||
|
||||
return $notification;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue