From 2dc6f2a785b5a48e1748777f40ecad887167d3d0 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 19 Mar 2024 16:28:43 +0100 Subject: [PATCH] fix(recording): Fix duplicate share message when sharing a recording or transcript Signed-off-by: Joas Schilling --- lib/Chat/SystemMessage/Listener.php | 2 +- .../features/bootstrap/FeatureContext.php | 6 +++++- .../integration/features/callapi/recording.feature | 13 +++++++++++++ 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/lib/Chat/SystemMessage/Listener.php b/lib/Chat/SystemMessage/Listener.php index 3564de06a23..d03aedf8ded 100644 --- a/lib/Chat/SystemMessage/Listener.php +++ b/lib/Chat/SystemMessage/Listener.php @@ -397,7 +397,7 @@ protected function fixMimeTypeOfVoiceMessage(ShareCreatedEvent|BeforeDuplicateSh return; } - if ($this->request->getParam('_route') === 'ocs.spreed.Recording.shareToChat') { + if (strtolower($this->request->getParam('_route')) === 'ocs.spreed.recording.sharetochat') { return; } $room = $this->manager->getRoomByToken($share->getSharedWith()); diff --git a/tests/integration/features/bootstrap/FeatureContext.php b/tests/integration/features/bootstrap/FeatureContext.php index 00018426ba2..7fa4beb2a80 100644 --- a/tests/integration/features/bootstrap/FeatureContext.php +++ b/tests/integration/features/bootstrap/FeatureContext.php @@ -2650,6 +2650,7 @@ protected function compareDataResponse(TableNode $formData = null) { $includeReactions = in_array('reactions', $formData->getRow(0), true); $includeReactionsSelf = in_array('reactionsSelf', $formData->getRow(0), true); $includeLastEdit = in_array('lastEditActorId', $formData->getRow(0), true); + $includeMessageType = in_array('messageType', $formData->getRow(0), true); $expected = $formData->getHash(); $count = count($expected); @@ -2712,7 +2713,7 @@ protected function compareDataResponse(TableNode $formData = null) { } } - Assert::assertEquals($expected, array_map(function ($message, $expected) use ($includeParents, $includeReferenceId, $includeReactions, $includeReactionsSelf, $includeLastEdit) { + Assert::assertEquals($expected, array_map(function ($message, $expected) use ($includeParents, $includeReferenceId, $includeReactions, $includeReactionsSelf, $includeLastEdit, $includeMessageType) { $data = [ 'room' => self::$tokenToIdentifier[$message['token']], 'actorType' => $message['actorType'], @@ -2730,6 +2731,9 @@ protected function compareDataResponse(TableNode $formData = null) { if ($includeReferenceId) { $data['referenceId'] = $message['referenceId']; } + if ($includeMessageType) { + $data['messageType'] = $message['messageType']; + } if (isset($expected['silent'])) { $data['silent'] = isset($message['silent']) ? json_encode($message['silent']) : '!ISSET'; } diff --git a/tests/integration/features/callapi/recording.feature b/tests/integration/features/callapi/recording.feature index bf819b9885d..cef1d14b6c2 100644 --- a/tests/integration/features/callapi/recording.feature +++ b/tests/integration/features/callapi/recording.feature @@ -467,12 +467,25 @@ Feature: callapi/recording | spreed | recording | room1 | Transcript now available | The transcript for the call in room1 was uploaded to /Talk/Recording/ROOM(room1)/join_call.txt. | | spreed | recording | room1 | Call recording now available | The recording for the call in room1 was uploaded to /Talk/Recording/ROOM(room1)/join_call.ogg. | When user "participant1" shares file from the last notification to room "room1" with 200 (v1) + Then user "participant1" sees the following system messages in room "room1" with 200 (v1) + | room | actorType | actorId | actorDisplayName | systemMessage | + | room1 | users | participant1 | participant1-displayname | conversation_created | + And user "participant1" sees the following messages in room "room1" with 200 (v1) + | room | actorType | actorId | actorDisplayName | messageType | message | messageParameters | + | room1 | users | participant1 | participant1-displayname | record-audio | {file} | "IGNORE" | Then user "participant1" has the following notifications | app | object_type | object_id | subject | message | | spreed | recording | room1 | Transcript now available | The transcript for the call in room1 was uploaded to /Talk/Recording/ROOM(room1)/join_call.txt. | When user "participant1" shares file from the first notification to room "room1" with 200 (v1) Then user "participant1" has the following notifications | app | object_type | object_id | subject | message | + Then user "participant1" sees the following system messages in room "room1" with 200 (v1) + | room | actorType | actorId | actorDisplayName | systemMessage | + | room1 | users | participant1 | participant1-displayname | conversation_created | + And user "participant1" sees the following messages in room "room1" with 200 (v1) + | room | actorType | actorId | actorDisplayName | messageType | message | messageParameters | + | room1 | users | participant1 | participant1-displayname | record-audio | {file} | "IGNORE" | + | room1 | users | participant1 | participant1-displayname | record-audio | {file} | "IGNORE" | Scenario: Store recording with success but fail to transcript Given the following spreed app config is set