diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Activity/Listener.php | 2 | ||||
-rw-r--r-- | lib/Activity/Provider/Base.php | 1 | ||||
-rw-r--r-- | lib/Chat/Parser/UserMention.php | 1 | ||||
-rw-r--r-- | lib/Collaboration/Reference/TalkReferenceProvider.php | 3 | ||||
-rw-r--r-- | lib/Collaboration/Resources/ConversationProvider.php | 1 | ||||
-rw-r--r-- | lib/Controller/ChatController.php | 6 | ||||
-rw-r--r-- | lib/Controller/PollController.php | 3 | ||||
-rw-r--r-- | lib/Controller/RoomController.php | 17 | ||||
-rw-r--r-- | lib/Dashboard/TalkWidget.php | 6 | ||||
-rw-r--r-- | lib/Manager.php | 5 | ||||
-rw-r--r-- | lib/Notification/Notifier.php | 15 | ||||
-rw-r--r-- | lib/Room.php | 1 | ||||
-rw-r--r-- | lib/Search/ConversationSearch.php | 2 | ||||
-rw-r--r-- | lib/Search/MessageSearch.php | 2 | ||||
-rw-r--r-- | lib/Service/AvatarService.php | 6 | ||||
-rw-r--r-- | lib/Service/ParticipantService.php | 2 | ||||
-rw-r--r-- | lib/Service/RoomService.php | 19 |
17 files changed, 60 insertions, 32 deletions
diff --git a/lib/Activity/Listener.php b/lib/Activity/Listener.php index d56a416cd..d4706637c 100644 --- a/lib/Activity/Listener.php +++ b/lib/Activity/Listener.php @@ -137,7 +137,7 @@ class Listener { $message = 'call_ended'; if ($endForEveryone) { $message = 'call_ended_everyone'; - } elseif ($room->getType() === Room::TYPE_ONE_TO_ONE && \count($userIds) === 1) { + } elseif (($room->getType() === Room::TYPE_ONE_TO_ONE || $room->getType() === Room::TYPE_ONE_TO_ONE_FORMER) && \count($userIds) === 1) { $message = 'call_missed'; } diff --git a/lib/Activity/Provider/Base.php b/lib/Activity/Provider/Base.php index 6944ae852..be7def0b0 100644 --- a/lib/Activity/Provider/Base.php +++ b/lib/Activity/Provider/Base.php @@ -113,6 +113,7 @@ abstract class Base implements IProvider { protected function getRoom(Room $room, string $userId): array { switch ($room->getType()) { case Room::TYPE_ONE_TO_ONE: + case Room::TYPE_ONE_TO_ONE_FORMER: $stringType = 'one2one'; break; case Room::TYPE_GROUP: diff --git a/lib/Chat/Parser/UserMention.php b/lib/Chat/Parser/UserMention.php index 7962a0de5..f767343ab 100644 --- a/lib/Chat/Parser/UserMention.php +++ b/lib/Chat/Parser/UserMention.php @@ -172,6 +172,7 @@ class UserMention { protected function getRoomType(Room $room): string { switch ($room->getType()) { case Room::TYPE_ONE_TO_ONE: + case Room::TYPE_ONE_TO_ONE_FORMER: return 'one2one'; case Room::TYPE_GROUP: return 'group'; diff --git a/lib/Collaboration/Reference/TalkReferenceProvider.php b/lib/Collaboration/Reference/TalkReferenceProvider.php index 10a77cf8f..d4e428da8 100644 --- a/lib/Collaboration/Reference/TalkReferenceProvider.php +++ b/lib/Collaboration/Reference/TalkReferenceProvider.php @@ -202,7 +202,7 @@ class TalkReferenceProvider implements IReferenceProvider { $description = str_replace($placeholders, $replacements, $message->getMessage()); $titleLine = $this->l->t('Message of {user} in {conversation}'); - if ($room->getType() === Room::TYPE_ONE_TO_ONE) { + if ($room->getType() === Room::TYPE_ONE_TO_ONE || $room->getType() === Room::TYPE_ONE_TO_ONE_FORMER) { $titleLine = $this->l->t('Message of {user}'); } @@ -264,6 +264,7 @@ class TalkReferenceProvider implements IReferenceProvider { protected function getRoomType(Room $room): string { switch ($room->getType()) { case Room::TYPE_ONE_TO_ONE: + case Room::TYPE_ONE_TO_ONE_FORMER: return 'one2one'; case Room::TYPE_GROUP: return 'group'; diff --git a/lib/Collaboration/Resources/ConversationProvider.php b/lib/Collaboration/Resources/ConversationProvider.php index f989141fe..5543c8e94 100644 --- a/lib/Collaboration/Resources/ConversationProvider.php +++ b/lib/Collaboration/Resources/ConversationProvider.php @@ -118,6 +118,7 @@ class ConversationProvider implements IProvider { protected function getRoomType(Room $room): string { switch ($room->getType()) { case Room::TYPE_ONE_TO_ONE: + case Room::TYPE_ONE_TO_ONE_FORMER: return 'one2one'; case Room::TYPE_GROUP: return 'group'; diff --git a/lib/Controller/ChatController.php b/lib/Controller/ChatController.php index 99cd22b4a..6de8268b7 100644 --- a/lib/Controller/ChatController.php +++ b/lib/Controller/ChatController.php @@ -645,7 +645,8 @@ class ChatController extends AEnvironmentAwareController { $isOwnMessage = $isOwnMessage || ($message->getActorType() === Attendee::ACTOR_BRIDGED && $attendee->getActorId() === MatterbridgeManager::BRIDGE_BOT_USERID); if (!$isOwnMessage && (!$this->participant->hasModeratorPermissions(false) - || $this->room->getType() === Room::TYPE_ONE_TO_ONE)) { + || $this->room->getType() === Room::TYPE_ONE_TO_ONE + || $this->room->getType() === Room::TYPE_ONE_TO_ONE_FORMER)) { // Actor is not a moderator or not the owner of the message return new DataResponse([], Http::STATUS_FORBIDDEN); } @@ -702,7 +703,8 @@ class ChatController extends AEnvironmentAwareController { public function clearHistory(): DataResponse { $attendee = $this->participant->getAttendee(); if (!$this->participant->hasModeratorPermissions(false) - || $this->room->getType() === Room::TYPE_ONE_TO_ONE) { + || $this->room->getType() === Room::TYPE_ONE_TO_ONE + || $this->room->getType() === Room::TYPE_ONE_TO_ONE_FORMER) { // Actor is not a moderator or not the owner of the message return new DataResponse([], Http::STATUS_FORBIDDEN); } diff --git a/lib/Controller/PollController.php b/lib/Controller/PollController.php index cfebd9a14..b4950692a 100644 --- a/lib/Controller/PollController.php +++ b/lib/Controller/PollController.php @@ -77,7 +77,8 @@ class PollController extends AEnvironmentAwareController { * @return DataResponse */ public function createPoll(string $question, array $options, int $resultMode, int $maxVotes): DataResponse { - if ($this->room->getType() === Room::TYPE_ONE_TO_ONE) { + if ($this->room->getType() === Room::TYPE_ONE_TO_ONE + || $this->room->getType() === Room::TYPE_ONE_TO_ONE_FORMER) { return new DataResponse([], Http::STATUS_BAD_REQUEST); } diff --git a/lib/Controller/RoomController.php b/lib/Controller/RoomController.php index b4415d0a1..4b561ec76 100644 --- a/lib/Controller/RoomController.php +++ b/lib/Controller/RoomController.php @@ -524,7 +524,7 @@ class RoomController extends AEnvironmentAwareController { if ($roomData['notificationLevel'] === Participant::NOTIFY_DEFAULT) { if ($currentParticipant->isGuest()) { $roomData['notificationLevel'] = Participant::NOTIFY_NEVER; - } elseif ($room->getType() === Room::TYPE_ONE_TO_ONE) { + } elseif ($room->getType() === Room::TYPE_ONE_TO_ONE || $room->getType() === Room::TYPE_ONE_TO_ONE_FORMER) { $roomData['notificationLevel'] = Participant::NOTIFY_ALWAYS; } else { $adminSetting = (int) $this->config->getAppValue('spreed', 'default_group_notification', (string) Participant::NOTIFY_DEFAULT); @@ -574,6 +574,7 @@ class RoomController extends AEnvironmentAwareController { $roomData['lastReadMessage'] = $lastReadMessage; $roomData['canDeleteConversation'] = $room->getType() !== Room::TYPE_ONE_TO_ONE + && $room->getType() !== Room::TYPE_ONE_TO_ONE_FORMER && $currentParticipant->hasModeratorPermissions(false); $roomData['canLeaveConversation'] = true; $roomData['canEnableSIP'] = @@ -920,7 +921,7 @@ class RoomController extends AEnvironmentAwareController { * @return DataResponse */ public function renameRoom(string $roomName): DataResponse { - if ($this->room->getType() === Room::TYPE_ONE_TO_ONE) { + if ($this->room->getType() === Room::TYPE_ONE_TO_ONE || $this->room->getType() === Room::TYPE_ONE_TO_ONE_FORMER) { return new DataResponse([], Http::STATUS_BAD_REQUEST); } @@ -942,7 +943,7 @@ class RoomController extends AEnvironmentAwareController { * @return DataResponse */ public function setDescription(string $description): DataResponse { - if ($this->room->getType() === Room::TYPE_ONE_TO_ONE) { + if ($this->room->getType() === Room::TYPE_ONE_TO_ONE || $this->room->getType() === Room::TYPE_ONE_TO_ONE_FORMER) { return new DataResponse([], Http::STATUS_BAD_REQUEST); } @@ -962,7 +963,7 @@ class RoomController extends AEnvironmentAwareController { * @return DataResponse */ public function deleteRoom(): DataResponse { - if ($this->room->getType() === Room::TYPE_ONE_TO_ONE) { + if ($this->room->getType() === Room::TYPE_ONE_TO_ONE || $this->room->getType() === Room::TYPE_ONE_TO_ONE_FORMER) { return new DataResponse([], Http::STATUS_BAD_REQUEST); } @@ -1118,7 +1119,9 @@ class RoomController extends AEnvironmentAwareController { * @return DataResponse */ public function addParticipantToRoom(string $newParticipant, string $source = 'users'): DataResponse { - if ($this->room->getType() === Room::TYPE_ONE_TO_ONE || $this->room->getObjectType() === 'share:password') { + if ($this->room->getType() === Room::TYPE_ONE_TO_ONE + || $this->room->getType() === Room::TYPE_ONE_TO_ONE_FORMER + || $this->room->getObjectType() === 'share:password') { return new DataResponse([], Http::STATUS_BAD_REQUEST); } @@ -1269,7 +1272,7 @@ class RoomController extends AEnvironmentAwareController { } protected function removeSelfFromRoomLogic(Room $room, Participant $participant): DataResponse { - if ($room->getType() !== Room::TYPE_ONE_TO_ONE) { + if ($room->getType() !== Room::TYPE_ONE_TO_ONE && $room->getType() !== Room::TYPE_ONE_TO_ONE_FORMER) { if ($participant->hasModeratorPermissions(false) && $this->participantService->getNumberOfUsers($room) > 1 && $this->participantService->getNumberOfModerators($room) === 1) { @@ -1318,7 +1321,7 @@ class RoomController extends AEnvironmentAwareController { return new DataResponse([], Http::STATUS_NOT_FOUND); } - if ($this->room->getType() === Room::TYPE_ONE_TO_ONE) { + if ($this->room->getType() === Room::TYPE_ONE_TO_ONE || $this->room->getType() === Room::TYPE_ONE_TO_ONE_FORMER) { return new DataResponse([], Http::STATUS_BAD_REQUEST); } diff --git a/lib/Dashboard/TalkWidget.php b/lib/Dashboard/TalkWidget.php index 6137585a3..d5f21c4e1 100644 --- a/lib/Dashboard/TalkWidget.php +++ b/lib/Dashboard/TalkWidget.php @@ -164,7 +164,11 @@ class TalkWidget implements IAPIWidget, IIconWidget, IButtonWidget, IOptionWidge $attendee = $participant->getAttendee(); return $room->getCallFlag() !== Participant::FLAG_DISCONNECTED || $attendee->getLastMentionMessage() > $attendee->getLastReadMessage() - || ($room->getType() === Room::TYPE_ONE_TO_ONE && $room->getLastMessage() && $room->getLastMessage()->getId() > $attendee->getLastReadMessage()); + || ( + ($room->getType() === Room::TYPE_ONE_TO_ONE || $room->getType() === Room::TYPE_ONE_TO_ONE_FORMER) + && $room->getLastMessage() + && $room->getLastMessage()->getId() > $attendee->getLastReadMessage() + ); }); uasort($rooms, [$this, 'sortRooms']); diff --git a/lib/Manager.php b/lib/Manager.php index 4beb0b47c..83d406557 100644 --- a/lib/Manager.php +++ b/lib/Manager.php @@ -432,12 +432,13 @@ class Manager { $leftRooms = $this->getLeftOneToOneRoomsForUser($user->getUID()); foreach ($leftRooms as $room) { - // We are changing the room type and name so a potential follow up + // We are changing the room type and name so a potential follow-up // user with the same user-id can not reopen the one-to-one conversation. /** @var RoomService $roomService */ $roomService = Server::get(RoomService::class); - $roomService->setType($room, Room::TYPE_GROUP, true); + $roomService->setType($room, Room::TYPE_ONE_TO_ONE_FORMER, true); $roomService->setName($room, $user->getDisplayName(), ''); + $roomService->setReadOnly($room, Room::READ_ONLY); } } diff --git a/lib/Notification/Notifier.php b/lib/Notification/Notifier.php index b9e65147e..07fae5d02 100644 --- a/lib/Notification/Notifier.php +++ b/lib/Notification/Notifier.php @@ -503,7 +503,7 @@ class Notifier implements INotifier { 'id' => $message->getComment()->getId(), 'name' => $shortenMessage, ]; - if ($room->getType() === Room::TYPE_ONE_TO_ONE) { + if ($room->getType() === Room::TYPE_ONE_TO_ONE || $room->getType() === Room::TYPE_ONE_TO_ONE_FORMER) { $subject = "{user}\n{message}"; } elseif ($richSubjectUser) { $subject = $l->t('{user} in {call}') . "\n{message}"; @@ -518,7 +518,7 @@ class Notifier implements INotifier { } } } elseif ($notification->getSubject() === 'chat') { - if ($room->getType() === Room::TYPE_ONE_TO_ONE) { + if ($room->getType() === Room::TYPE_ONE_TO_ONE || $room->getType() === Room::TYPE_ONE_TO_ONE_FORMER) { $subject = $l->t('{user} sent you a private message'); } elseif ($richSubjectUser) { $subject = $l->t('{user} sent a message in conversation {call}'); @@ -533,7 +533,7 @@ class Notifier implements INotifier { } } } elseif ($notification->getSubject() === 'reply') { - if ($room->getType() === Room::TYPE_ONE_TO_ONE) { + if ($room->getType() === Room::TYPE_ONE_TO_ONE || $room->getType() === Room::TYPE_ONE_TO_ONE_FORMER) { $subject = $l->t('{user} replied to your private message'); } elseif ($richSubjectUser) { $subject = $l->t('{user} replied to your message in conversation {call}'); @@ -554,7 +554,7 @@ class Notifier implements INotifier { 'name' => $subjectParameters['reaction'], ]; - if ($room->getType() === Room::TYPE_ONE_TO_ONE) { + if ($room->getType() === Room::TYPE_ONE_TO_ONE || $room->getType() === Room::TYPE_ONE_TO_ONE_FORMER) { $subject = $l->t('{user} reacted with {reaction} to your private message'); } elseif ($richSubjectUser) { $subject = $l->t('{user} reacted with {reaction} to your message in conversation {call}'); @@ -568,7 +568,7 @@ class Notifier implements INotifier { $subject = $l->t('A guest reacted with {reaction} to your message in conversation {call}'); } } - } elseif ($room->getType() === Room::TYPE_ONE_TO_ONE) { + } elseif ($room->getType() === Room::TYPE_ONE_TO_ONE || $room->getType() === Room::TYPE_ONE_TO_ONE_FORMER) { $subject = $l->t('{user} mentioned you in a private conversation'); } elseif ($richSubjectUser) { $subject = $l->t('{user} mentioned you in conversation {call}'); @@ -628,6 +628,7 @@ class Notifier implements INotifier { protected function getRoomType(Room $room): string { switch ($room->getType()) { case Room::TYPE_ONE_TO_ONE: + case Room::TYPE_ONE_TO_ONE_FORMER: return 'one2one'; case Room::TYPE_GROUP: return 'group'; @@ -660,7 +661,7 @@ class Notifier implements INotifier { } $roomName = $room->getDisplayName($notification->getUser()); - if ($room->getType() === Room::TYPE_ONE_TO_ONE) { + if ($room->getType() === Room::TYPE_ONE_TO_ONE || $room->getType() === Room::TYPE_ONE_TO_ONE_FORMER) { $subject = $l->t('{user} invited you to a private conversation'); if ($this->participantService->hasActiveSessionsInCall($room)) { $notification = $this->addActionButton($notification, $l->t('Join call')); @@ -731,7 +732,7 @@ class Notifier implements INotifier { } $roomName = $room->getDisplayName($notification->getUser()); - if ($room->getType() === Room::TYPE_ONE_TO_ONE) { + if ($room->getType() === Room::TYPE_ONE_TO_ONE || $room->getType() === Room::TYPE_ONE_TO_ONE_FORMER) { $parameters = $notification->getSubjectParameters(); $calleeId = $parameters['callee']; $userDisplayName = $this->userManager->getDisplayName($calleeId); diff --git a/lib/Room.php b/lib/Room.php index e5a7e6b3e..d1cacff27 100644 --- a/lib/Room.php +++ b/lib/Room.php @@ -54,6 +54,7 @@ class Room { public const TYPE_GROUP = 2; public const TYPE_PUBLIC = 3; public const TYPE_CHANGELOG = 4; + public const TYPE_ONE_TO_ONE_FORMER = 5; public const RECORDING_NONE = 0; public const RECORDING_VIDEO = 1; diff --git a/lib/Searc |