Skip to content

Commit

Permalink
fix(recording): Fix duplicate share message when sharing a recording …
Browse files Browse the repository at this point in the history
…or transcript

Signed-off-by: Joas Schilling <coding@schilljs.com>
  • Loading branch information
nickvergessen committed Mar 19, 2024
1 parent b0e22ad commit 2dc6f2a
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/Chat/SystemMessage/Listener.php
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
6 changes: 5 additions & 1 deletion tests/integration/features/bootstrap/FeatureContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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'],
Expand All @@ -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';
}
Expand Down
13 changes: 13 additions & 0 deletions tests/integration/features/callapi/recording.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 2dc6f2a

Please sign in to comment.