Use the token instead of the id to identify the room objects

Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
Joas Schilling 2018-07-09 14:52:09 +02:00
Родитель a05afab2ad
Коммит 0c338c914c
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 7076EA9751AACDDA
2 изменённых файлов: 10 добавлений и 6 удалений

Просмотреть файл

@ -68,7 +68,7 @@ class Hooks {
try {
$notification->setApp('spreed')
->setDateTime($dateTime)
->setObject('room', $room->getId())
->setObject('room', $room->getToken())
->setSubject('invitation', [
'actorId' => $actor->getUID(),
]);
@ -111,7 +111,7 @@ class Hooks {
try {
// Remove all old notifications for this room
$notification->setApp('spreed')
->setObject('room', $room->getId());
->setObject('room', $room->getToken());
$this->notificationManager->markProcessed($notification);
$notification->setObject('call', $room->getId());

Просмотреть файл

@ -33,7 +33,6 @@ use OCP\L10N\IFactory;
use OCP\Notification\INotification;
use OCP\Notification\INotifier;
use OCP\RichObjectStrings\Definitions;
use OCP\RichObjectStrings\InvalidObjectExeption;
class Notifier implements INotifier {
@ -82,10 +81,15 @@ class Notifier implements INotifier {
$l = $this->lFactory->get('spreed', $languageCode);
try {
$room = $this->manager->getRoomById((int) $notification->getObjectId());
$room = $this->manager->getRoomByToken((int) $notification->getObjectId());
} catch (RoomNotFoundException $e) {
// Room does not exist
throw new \InvalidArgumentException('Invalid room');
try {
// Before 3.2.3 the id was passed in notifications
$room = $this->manager->getRoomById((int) $notification->getObjectId());
} catch (RoomNotFoundException $e) {
// Room does not exist
throw new \InvalidArgumentException('Invalid room');
}
}
$notification