diff options
author | Vitor Mattos <vitor@php.rio> | 2023-01-13 13:44:58 -0300 |
---|---|---|
committer | Vitor Mattos <vitor@php.rio> | 2023-01-14 10:02:23 -0300 |
commit | 71aa1692c51ea845e70e74f498e201748fd10702 (patch) | |
tree | 29ac47a36692f440f5eb2be3ef136369d9e010a4 | |
parent | 2a12d6037a3a9a37bb216f1ae95ac0f08f3622c2 (diff) |
Refactors after code review
Signed-off-by: Vitor Mattos <vitor@php.rio>
-rw-r--r-- | lib/Notification/Notifier.php | 4 | ||||
-rw-r--r-- | lib/Service/RecordingService.php | 22 |
2 files changed, 5 insertions, 21 deletions
diff --git a/lib/Notification/Notifier.php b/lib/Notification/Notifier.php index 52d08a89b..936006a4b 100644 --- a/lib/Notification/Notifier.php +++ b/lib/Notification/Notifier.php @@ -293,7 +293,7 @@ class Notifier implements INotifier { return $temp; } - private function parseStoredRecording(INotification $notification, Room $room, Participant $participant, IL10N $l): INOtification { + private function parseStoredRecording(INotification $notification, Room $room, Participant $participant, IL10N $l): INotification { $shareAction = $notification->createAction() ->setParsedLabel($l->t('Share to chat')) ->setPrimary(true) @@ -310,7 +310,7 @@ class Notifier implements INotifier { $notification ->setRichSubject( - $l->t('Record file of {call}'), + $l->t('Recording for the call in {call} was uploaded.'), [ 'call' => [ 'type' => 'call', diff --git a/lib/Service/RecordingService.php b/lib/Service/RecordingService.php index 944e3c916..a20143d9d 100644 --- a/lib/Service/RecordingService.php +++ b/lib/Service/RecordingService.php @@ -31,6 +31,7 @@ use OCA\Talk\Config; use OCA\Talk\Exceptions\ParticipantNotFoundException; use OCA\Talk\Participant; use OCA\Talk\Room; +use OCP\AppFramework\Utility\ITimeFactory; use OCP\Files\File; use OCP\Files\Folder; use OCP\Files\IMimeTypeDetector; @@ -51,6 +52,7 @@ class RecordingService { private ParticipantService $participantService, private IRootFolder $rootFolder, private IManager $notificationManager, + private ITimeFactory $timeFactory, private Config $config, private RoomService $roomService ) { @@ -159,7 +161,7 @@ class RecordingService { $notification ->setApp('spreed') - ->setDateTime(new \DateTime()) + ->setDateTime($this->timeFactory->getDateTime()) ->setObject('chat', $room->getToken()) ->setUser($attendee->getActorId()) ->setSubject('record_file_stored', [ @@ -169,22 +171,4 @@ class RecordingService { ]); $this->notificationManager->notify($notification); } - - /** - * @param Room $room - * @return string - * @throws \InvalidArgumentException - */ - protected function getRoomType(Room $room): string { - switch ($room->getType()) { - case Room::TYPE_ONE_TO_ONE: - return 'one2one'; - case Room::TYPE_GROUP: - return 'group'; - case Room::TYPE_PUBLIC: - return 'public'; - default: - throw new \InvalidArgumentException('Unknown room type'); - } - } } |