Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Process call recordings and call transcriptions notifications independently #10468

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions lib/Controller/RecordingController.php
Original file line number Diff line number Diff line change
Expand Up @@ -331,12 +331,13 @@ public function store(string $owner): DataResponse {

#[NoAdminRequired]
#[RequireModeratorParticipant]
public function notificationDismiss(int $timestamp): DataResponse {
public function notificationDismiss(int $timestamp, string $subject): DataResponse {
try {
$this->recordingService->notificationDismiss(
$this->getRoom(),
$this->participant,
$timestamp
$timestamp,
$subject
);
} catch (InvalidArgumentException $e) {
return new DataResponse(['error' => $e->getMessage()], Http::STATUS_BAD_REQUEST);
Expand All @@ -346,13 +347,14 @@ public function notificationDismiss(int $timestamp): DataResponse {

#[NoAdminRequired]
#[RequireModeratorParticipant]
public function shareToChat(int $fileId, int $timestamp): DataResponse {
public function shareToChat(int $fileId, int $timestamp, string $subject): DataResponse {
try {
$this->recordingService->shareToChat(
$this->getRoom(),
$this->participant,
$fileId,
$timestamp
$timestamp,
$subject
);
} catch (InvalidArgumentException $e) {
return new DataResponse(['error' => $e->getMessage()], Http::STATUS_BAD_REQUEST);
Expand Down
4 changes: 3 additions & 1 deletion lib/Notification/Notifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,8 @@ protected function parseStoredRecording(
'apiVersion' => 'v1',
'fileId' => $file->getId(),
'timestamp' => $notification->getDateTime()->getTimestamp(),
'token' => $room->getToken()
'token' => $room->getToken(),
'subject' => $notification->getSubject()
]
),
IAction::TYPE_POST
Expand All @@ -347,6 +348,7 @@ protected function parseStoredRecording(
'apiVersion' => 'v1',
'token' => $room->getToken(),
'timestamp' => $notification->getDateTime()->getTimestamp(),
'subject' => $notification->getSubject()
]
),
IAction::TYPE_DELETE
Expand Down
14 changes: 6 additions & 8 deletions lib/Service/RecordingService.php
Original file line number Diff line number Diff line change
Expand Up @@ -330,17 +330,15 @@ public function notifyStoredTranscript(Room $room, Participant $participant, Fil
$this->notificationManager->notify($notification);
}

public function notificationDismiss(Room $room, Participant $participant, int $timestamp): void {
public function notificationDismiss(Room $room, Participant $participant, int $timestamp, string $subject): void {
$notification = $this->notificationManager->createNotification();
$notification->setApp('spreed')
->setObject('recording', $room->getToken())
->setDateTime($this->timeFactory->getDateTime('@' . $timestamp))
->setUser($participant->getAttendee()->getActorId());
->setUser($participant->getAttendee()->getActorId())
->setSubject($subject);

foreach (['record_file_stored', 'transcript_file_stored'] as $subject) {
$notification->setSubject($subject);
$this->notificationManager->markProcessed($notification);
}
$this->notificationManager->markProcessed($notification);
}

private function getTypeOfShare(string $mimetype): string {
Expand All @@ -350,7 +348,7 @@ private function getTypeOfShare(string $mimetype): string {
return 'record-audio';
}

public function shareToChat(Room $room, Participant $participant, int $fileId, int $timestamp): void {
public function shareToChat(Room $room, Participant $participant, int $fileId, int $timestamp, string $subject): void {
try {
$userFolder = $this->rootFolder->getUserFolder(
$participant->getAttendee()->getActorId()
Expand Down Expand Up @@ -399,6 +397,6 @@ public function shareToChat(Room $room, Participant $participant, int $fileId, i
$this->logger->error($e->getMessage(), ['exception' => $e]);
throw new InvalidArgumentException('system');
}
$this->notificationDismiss($room, $participant, $timestamp);
$this->notificationDismiss($room, $participant, $timestamp, $subject);
}
}
Loading