Merge pull request #6644 from nextcloud/techdebt/noid/expose-message-id-for-desktop-clients-and-notifications-quick-reply

Expose message id for desktop client and notifications quick reply
This commit is contained in:
Joas Schilling 2021-12-02 10:18:43 +01:00 коммит произвёл GitHub
Родитель cd50cf7700 ab6dc43ad6
Коммит eda67f731a
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 10 добавлений и 13 удалений

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

@ -392,6 +392,9 @@ class Notifier implements INotifier {
if (!$this->notificationManager->isPreparingPushNotification()) {
$notification->setParsedMessage($parsedMessage);
$notification->setRichMessage($message->getMessage(), $message->getMessageParameters());
// Forward the message ID as well to the clients, so they can quote the message on replies
$notification->setObject('chat', $notification->getObjectId() . '/' . $comment->getId());
}
$richSubjectParameters = [

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

@ -215,8 +215,7 @@ class NotifierTest extends \Test\TestCase {
$n->expects($this->exactly(2))
->method('getObjectType')
->willReturn('room');
$n->expects($this->once())
->method('getObjectId')
$n->method('getObjectId')
->willReturn('roomToken');
$this->notifier->prepare($n, 'de');
@ -333,8 +332,7 @@ class NotifierTest extends \Test\TestCase {
$n->expects($this->exactly(2))
->method('getObjectType')
->willReturn('room');
$n->expects($this->once())
->method('getObjectId')
$n->method('getObjectId')
->willReturn('roomToken');
return $n;
@ -466,8 +464,7 @@ class NotifierTest extends \Test\TestCase {
$n->expects($this->exactly(2))
->method('getObjectType')
->willReturn('room');
$n->expects($this->once())
->method('getObjectId')
$n->method('getObjectId')
->willReturn('roomToken');
$this->notifier->prepare($n, 'de');
@ -1028,8 +1025,7 @@ class NotifierTest extends \Test\TestCase {
$notification->expects($this->exactly(2))
->method('getObjectType')
->willReturn('chat');
$notification->expects($this->once())
->method('getObjectId')
$notification->method('getObjectId')
->willReturn('roomToken');
$notification->expects($this->once())
->method('getMessageParameters')
@ -1043,7 +1039,7 @@ class NotifierTest extends \Test\TestCase {
['Incorrect app', 'invalid-app', null, null, null, null, null],
'User can not use Talk' => [AlreadyProcessedException::class, 'spreed', true, null, null, null, null],
'Invalid room' => [AlreadyProcessedException::class, 'spreed', false, false, null, null, null, '12345'],
'Invalid room' => [AlreadyProcessedException::class, 'spreed', false, false, null, null, null],
'Invalid room without token' => [AlreadyProcessedException::class, 'spreed', false, false, null, null, null],
['Unknown subject', 'spreed', false, true, 'invalid-subject', null, null],
['Unknown object type', 'spreed', false, true, 'invitation', null, 'invalid-object-type'],
'Calling user does not exist anymore' => [AlreadyProcessedException::class, 'spreed', false, true, 'invitation', ['admin'], 'room'],
@ -1075,16 +1071,14 @@ class NotifierTest extends \Test\TestCase {
$room = $this->createMock(Room::class);
$room->expects($this->never())
->method('getType');
$n->expects($this->once())
->method('getObjectId')
$n->method('getObjectId')
->willReturn($token);
$this->manager->expects($this->once())
->method('getRoomByToken')
->with($token)
->willReturn($room);
} elseif ($validRoom === false) {
$n->expects($this->once())
->method('getObjectId')
$n->method('getObjectId')
->willReturn($token);
$this->manager->expects($this->once())
->method('getRoomByToken')