mirror of
https://github.com/nextcloud/spreed.git
synced 2025-12-18 05:20:50 +01:00
Better notifications for password shares
Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
parent
62e7465a6d
commit
d612e845f9
2 changed files with 7 additions and 22 deletions
|
|
@ -116,18 +116,6 @@ class PublicShareAuthController extends OCSController {
|
|||
'participantType' => Participant::OWNER,
|
||||
]);
|
||||
|
||||
// Notify the owner
|
||||
$notification = $this->notificationManager->createNotification();
|
||||
$notification
|
||||
->setApp('spreed')
|
||||
->setObject('room', $room->getToken())
|
||||
->setUser($sharerUser->getUID())
|
||||
->setSubject('share:password', [
|
||||
'sharedWith' => $share->getSharedWith(),
|
||||
])
|
||||
->setDateTime(new \DateTime());
|
||||
$this->notificationManager->notify($notification);
|
||||
|
||||
return new DataResponse([
|
||||
'token' => $room->getToken(),
|
||||
'name' => $room->getName(),
|
||||
|
|
|
|||
|
|
@ -112,14 +112,14 @@ class Notifier implements INotifier {
|
|||
return $this->parseInvitation($notification, $room, $l);
|
||||
}
|
||||
if ($subject === 'call') {
|
||||
if ($room->getObjectType() === 'share:password') {
|
||||
return $this->parsePasswordRequest($notification, $room, $l);
|
||||
}
|
||||
return $this->parseCall($notification, $room, $l);
|
||||
}
|
||||
if ($subject === 'mention' || $subject === 'chat') {
|
||||
return $this->parseChatMessage($notification, $room, $l);
|
||||
}
|
||||
if ($subject === 'share:password') {
|
||||
return $this->parsePasswordRequest($notification, $room, $l);
|
||||
}
|
||||
|
||||
throw new \InvalidArgumentException('Unknown subject');
|
||||
}
|
||||
|
|
@ -445,18 +445,15 @@ class Notifier implements INotifier {
|
|||
* @return INotification
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
protected function parsePasswordRequest(INotification $notification, Room $room, IL10N $l) {
|
||||
if ($notification->getObjectType() !== 'room') {
|
||||
protected function parsePasswordRequest(INotification $notification, Room $room, IL10N $l): INotification {
|
||||
if ($notification->getObjectType() !== 'call') {
|
||||
throw new \InvalidArgumentException('Unknown object type');
|
||||
}
|
||||
|
||||
$parameters = $notification->getSubjectParameters();
|
||||
$sharedWith = $parameters['sharedWith'];
|
||||
$sharedWith = $room->getName();
|
||||
|
||||
$notification
|
||||
->setParsedSubject(
|
||||
$l->t('Password request by %s', [$sharedWith])
|
||||
)
|
||||
->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' => [
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue