From bfa2c83fcee9d6b510b608b1c0474fb6c6cf0afb Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 15 Dec 2023 09:37:11 +0100 Subject: feat(shares): Add notifications for caption mentions and replies Signed-off-by: Joas Schilling --- .../features/chat-1/notifications.feature | 42 ++++++++++++++++++++++ tests/php/Chat/ChatManagerTest.php | 4 +-- 2 files changed, 44 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/integration/features/chat-1/notifications.feature b/tests/integration/features/chat-1/notifications.feature index 0549f2b4d..8d66570e2 100644 --- a/tests/integration/features/chat-1/notifications.feature +++ b/tests/integration/features/chat-1/notifications.feature @@ -373,6 +373,48 @@ Feature: chat/notifications | app | object_type | object_id | subject | | spreed | chat | room/Hi @all @participant2 @"group/attendees1" bye | participant1-displayname replied to your message in conversation room | + Scenario: Replying with a captioned file gives a reply notification + When user "participant1" creates room "room" (v4) + | roomType | 2 | + | roomName | room | + And user "participant1" adds user "participant2" to room "room" with 200 (v4) + And user "participant1" adds group "attendees1" to room "room" with 200 (v4) + # Join and leave to clear the invite notification + Given user "participant2" joins room "room" with 200 (v4) + Given user "participant2" leaves room "room" with 200 (v4) + When user "participant2" sends message "Message 1" to room "room" with 201 + Then user "participant1" sees the following messages in room "room" with 200 + | room | actorType | actorId | actorDisplayName | message | messageParameters | parentMessage | + | room | users | participant2 | participant2-displayname | Message 1 | [] | | + When user "participant1" shares "welcome.txt" with room "room" + | talkMetaData.caption | Caption 1-1 | + | talkMetaData.replyTo | Message 1 | + Then user "participant1" sees the following messages in room "room" with 200 + | room | actorType | actorId | actorDisplayName | message | messageParameters | parentMessage | + | room | users | participant1 | participant1-displayname | Caption 1-1 | "IGNORE" | Message 1 | + | room | users | participant2 | participant2-displayname | Message 1 | [] | | + Then user "participant2" has the following notifications + | app | object_type | object_id | subject | + | spreed | chat | room/Caption 1-1 | participant1-displayname replied to your message in conversation room | + + Scenario: Mentions in captions trigger normal mention notifications + When user "participant1" creates room "room" (v4) + | roomType | 2 | + | roomName | room | + And user "participant1" adds user "participant2" to room "room" with 200 (v4) + And user "participant1" adds group "attendees1" to room "room" with 200 (v4) + # Join and leave to clear the invite notification + Given user "participant2" joins room "room" with 200 (v4) + Given user "participant2" leaves room "room" with 200 (v4) + When user "participant1" shares "welcome.txt" with room "room" + | talkMetaData.caption | @participant2 | + Then user "participant1" sees the following messages in room "room" with 200 + | room | actorType | actorId | actorDisplayName | message | messageParameters | parentMessage | + | room | users | participant1 | participant1-displayname | {mention-user1} | "IGNORE" | | + Then user "participant2" has the following notifications + | app | object_type | object_id | subject | + | spreed | chat | room/{mention-user1} | participant1-displayname mentioned you in conversation room | + Scenario: Delete notification when the message is deleted When user "participant1" creates room "one-to-one room" (v4) | roomType | 1 | diff --git a/tests/php/Chat/ChatManagerTest.php b/tests/php/Chat/ChatManagerTest.php index 7ba54a45b..dca10dd31 100644 --- a/tests/php/Chat/ChatManagerTest.php +++ b/tests/php/Chat/ChatManagerTest.php @@ -469,7 +469,7 @@ class ChatManagerTest extends TestCase { $chatManager = $this->getManager(['addSystemMessage']); $chatManager->expects($this->once()) ->method('addSystemMessage') - ->with($chat, Attendee::ACTOR_USERS, 'user', $this->anything(), $this->anything(), false, null, 123456) + ->with($chat, Attendee::ACTOR_USERS, 'user', $this->anything(), $this->anything(), false, null, $comment) ->willReturn($systemMessage); $this->assertSame($systemMessage, $chatManager->deleteMessage($chat, $comment, $participant, $date)); @@ -549,7 +549,7 @@ class ChatManagerTest extends TestCase { $chatManager = $this->getManager(['addSystemMessage']); $chatManager->expects($this->once()) ->method('addSystemMessage') - ->with($chat, Attendee::ACTOR_USERS, 'user', $this->anything(), $this->anything(), false, null, 123456) + ->with($chat, Attendee::ACTOR_USERS, 'user', $this->anything(), $this->anything(), false, null, $comment) ->willReturn($systemMessage); $this->assertSame($systemMessage, $chatManager->deleteMessage($chat, $comment, $participant, $date)); -- cgit v1.2.3