summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2021-10-18 16:17:11 +0200
committerJoas Schilling <coding@schilljs.com>2021-10-18 16:17:11 +0200
commit9e8d94d58f4cf230e08fbca95393040c44acbd50 (patch)
tree6f9d9afa013e3a4c7a9d92ca5dc52d7e00ffb2f8
parent8c18fc16cb5ea5044f7f0d67b0693fe60b2e2eae (diff)
Replace old type constants with new ones
Signed-off-by: Joas Schilling <coding@schilljs.com>
-rw-r--r--lib/Activity/Listener.php2
-rw-r--r--lib/Activity/Provider/Base.php8
-rw-r--r--lib/Chat/AutoComplete/SearchPlugin.php2
-rw-r--r--lib/Chat/Notifier.php4
-rw-r--r--lib/Chat/Parser/UserMention.php6
-rw-r--r--lib/Chat/SystemMessage/Listener.php12
-rw-r--r--lib/Collaboration/Resources/ConversationProvider.php8
-rw-r--r--lib/Command/Room/Add.php2
-rw-r--r--lib/Command/Room/Create.php2
-rw-r--r--lib/Command/Room/Delete.php2
-rw-r--r--lib/Command/Room/Demote.php2
-rw-r--r--lib/Command/Room/Promote.php2
-rw-r--r--lib/Command/Room/Remove.php2
-rw-r--r--lib/Command/Room/TRoomCommand.php6
-rw-r--r--lib/Command/Room/Update.php2
-rw-r--r--lib/Controller/ChatController.php4
-rw-r--r--lib/Controller/FilesIntegrationController.php4
-rw-r--r--lib/Controller/PageController.php8
-rw-r--r--lib/Controller/PublicShareAuthController.php2
-rw-r--r--lib/Controller/RoomController.php46
-rw-r--r--lib/Listener/UserDeletedListener.php2
-rw-r--r--lib/Manager.php24
-rw-r--r--lib/Migration/Version2001Date20170707115443.php2
-rw-r--r--lib/Notification/Notifier.php22
-rw-r--r--lib/Room.php30
-rw-r--r--lib/Search/ConversationSearch.php8
-rw-r--r--lib/Search/MessageSearch.php4
-rw-r--r--lib/Service/ParticipantService.php6
-rw-r--r--lib/Service/RoomService.php8
-rw-r--r--lib/Share/Helper/ShareAPIController.php2
-rw-r--r--lib/Share/RoomShareProvider.php2
-rw-r--r--tests/php/Activity/Provider/BaseTest.php12
-rw-r--r--tests/php/Chat/Parser/UserMentionTest.php2
-rw-r--r--tests/php/Chat/SystemMessage/ListenerTest.php14
-rw-r--r--tests/php/Collaboration/Collaborators/RoomPluginTest.php62
-rw-r--r--tests/php/Controller/SignalingControllerTest.php30
-rw-r--r--tests/php/Notification/NotifierTest.php74
-rw-r--r--tests/php/RoomTest.php2
-rw-r--r--tests/php/Service/RoomServiceTest.php16
-rw-r--r--tests/php/Signaling/BackendNotifierTest.php28
40 files changed, 238 insertions, 238 deletions
diff --git a/lib/Activity/Listener.php b/lib/Activity/Listener.php
index 65d98bbed..78f62dad1 100644
--- a/lib/Activity/Listener.php
+++ b/lib/Activity/Listener.php
@@ -124,7 +124,7 @@ class Listener {
$message = 'call_ended';
if ((\count($userIds) + $numGuests) === 1) {
- if ($room->getType() !== Room::ONE_TO_ONE_CALL) {
+ if ($room->getType() !== Room::TYPE_ONE_TO_ONE) {
// Single user pinged or guests only => no summary/activity
$room->resetActiveSince();
return false;
diff --git a/lib/Activity/Provider/Base.php b/lib/Activity/Provider/Base.php
index a61a16f01..b1803ceaf 100644
--- a/lib/Activity/Provider/Base.php
+++ b/lib/Activity/Provider/Base.php
@@ -110,13 +110,13 @@ abstract class Base implements IProvider {
protected function getRoom(Room $room, string $userId): array {
switch ($room->getType()) {
- case Room::ONE_TO_ONE_CALL:
+ case Room::TYPE_ONE_TO_ONE:
$stringType = 'one2one';
break;
- case Room::GROUP_CALL:
+ case Room::TYPE_GROUP:
$stringType = 'group';
break;
- case Room::PUBLIC_CALL:
+ case Room::TYPE_PUBLIC:
default:
$stringType = 'public';
break;
@@ -136,7 +136,7 @@ abstract class Base implements IProvider {
'type' => 'call',
'id' => $roomId,
'name' => $l->t('a conversation'),
- 'call-type' => Room::UNKNOWN_CALL,
+ 'call-type' => Room::TYPE_UNKNOWN,
];
}
diff --git a/lib/Chat/AutoComplete/SearchPlugin.php b/lib/Chat/AutoComplete/SearchPlugin.php
index 347593269..aed0b589c 100644
--- a/lib/Chat/AutoComplete/SearchPlugin.php
+++ b/lib/Chat/AutoComplete/SearchPlugin.php
@@ -93,7 +93,7 @@ class SearchPlugin implements ISearchPlugin {
}
$userIds = $guestAttendees = [];
- if ($this->room->getType() === Room::ONE_TO_ONE_CALL) {
+ if ($this->room->getType() === Room::TYPE_ONE_TO_ONE) {
// Add potential leavers of one-to-one rooms again.
$participants = json_decode($this->room->getName(), true);
foreach ($participants as $userId) {
diff --git a/lib/Chat/Notifier.php b/lib/Chat/Notifier.php
index deb8eb5f5..10382dfd6 100644
--- a/lib/Chat/Notifier.php
+++ b/lib/Chat/Notifier.php
@@ -184,7 +184,7 @@ class Notifier {
}
// Also notify default participants in one2one chats or when the admin default is "always"
- if ($this->getDefaultGroupNotification() === Participant::NOTIFY_ALWAYS || $chat->getType() === Room::ONE_TO_ONE_CALL) {
+ if ($this->getDefaultGroupNotification() === Participant::NOTIFY_ALWAYS || $chat->getType() === Room::TYPE_ONE_TO_ONE) {
$participants = $this->participantService->getParticipantsByNotificationLevel($chat, Participant::NOTIFY_DEFAULT);
foreach ($participants as $participant) {
if (!$this->shouldParticipantBeNotified($participant, $comment, $alreadyNotifiedUsers)) {
@@ -335,7 +335,7 @@ class Notifier {
$participant = $room->getParticipant($userId, false);
$notificationLevel = $participant->getAttendee()->getNotificationLevel();
if ($notificationLevel === Participant::NOTIFY_DEFAULT) {
- if ($room->getType() === Room::ONE_TO_ONE_CALL) {
+ if ($room->getType() === Room::TYPE_ONE_TO_ONE) {
$notificationLevel = Participant::NOTIFY_ALWAYS;
} else {
$notificationLevel = $this->getDefaultGroupNotification();
diff --git a/lib/Chat/Parser/UserMention.php b/lib/Chat/Parser/UserMention.php
index 269c6f20e..743fb2caa 100644
--- a/lib/Chat/Parser/UserMention.php
+++ b/lib/Chat/Parser/UserMention.php
@@ -174,11 +174,11 @@ class UserMention {
*/
protected function getRoomType(Room $room): string {
switch ($room->getType()) {
- case Room::ONE_TO_ONE_CALL:
+ case Room::TYPE_ONE_TO_ONE:
return 'one2one';
- case Room::GROUP_CALL:
+ case Room::TYPE_GROUP:
return 'group';
- case Room::PUBLIC_CALL:
+ case Room::TYPE_PUBLIC:
return 'public';
default:
throw new \InvalidArgumentException('Unknown room type');
diff --git a/lib/Chat/SystemMessage/Listener.php b/lib/Chat/SystemMessage/Listener.php
index 67eb04c1c..31f5a4ba6 100644
--- a/lib/Chat/SystemMessage/Listener.php
+++ b/lib/Chat/SystemMessage/Listener.php
@@ -159,15 +159,15 @@ class Listener implements IEventListener {
$dispatcher->addListener(Room::EVENT_AFTER_TYPE_SET, static function (ModifyRoomEvent $event) {
$room = $event->getRoom();
- if ($event->getOldValue() === Room::ONE_TO_ONE_CALL) {
+ if ($event->getOldValue() === Room::TYPE_ONE_TO_ONE) {
return;
}
- if ($event->getNewValue() === Room::PUBLIC_CALL) {
+ if ($event->getNewValue() === Room::TYPE_PUBLIC) {
/** @var self $listener */
$listener = \OC::$server->query(self::class);
$listener->sendSystemMessage($room, 'guests_allowed');
- } elseif ($event->getNewValue() === Room::GROUP_CALL) {
+ } elseif ($event->getNewValue() === Room::TYPE_GROUP) {
/** @var self $listener */
$listener = \OC::$server->query(self::class);
$listener->sendSystemMessage($room, 'guests_disallowed');
@@ -176,7 +176,7 @@ class Listener implements IEventListener {
$dispatcher->addListener(Room::EVENT_AFTER_READONLY_SET, static function (ModifyRoomEvent $event) {
$room = $event->getRoom();
- if ($room->getType() === Room::CHANGELOG_CONVERSATION) {
+ if ($room->getType() === Room::TYPE_CHANGELOG) {
return;
}
@@ -224,7 +224,7 @@ class Listener implements IEventListener {
$dispatcher->addListener(Room::EVENT_AFTER_USERS_ADD, static function (AddParticipantsEvent $event) {
$room = $event->getRoom();
- if ($room->getType() === Room::ONE_TO_ONE_CALL) {
+ if ($room->getType() === Room::TYPE_ONE_TO_ONE) {
return;
}
@@ -260,7 +260,7 @@ class Listener implements IEventListener {
$dispatcher->addListener(Room::EVENT_AFTER_USER_REMOVE, static function (RemoveUserEvent $event) {
$room = $event->getRoom();
- if ($room->getType() === Room::ONE_TO_ONE_CALL) {
+ if ($room->getType() === Room::TYPE_ONE_TO_ONE) {
return;
}
diff --git a/lib/Collaboration/Resources/ConversationProvider.php b/lib/Collaboration/Resources/ConversationProvider.php
index c2ed1ed02..3c30b1428 100644
--- a/lib/Collaboration/Resources/ConversationProvider.php
+++ b/lib/Collaboration/Resources/ConversationProvider.php
@@ -61,7 +61,7 @@ class ConversationProvider implements IProvider {
$iconURL = $this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('spreed', 'app-dark.svg'));
/**
* Disabled for now, because it would show a square avatar
- * if ($room->getType() === Room::ONE_TO_ONE_CALL) {
+ * if ($room->getType() === Room::TYPE_ONE_TO_ONE) {
* $iconURL = $this->urlGenerator->linkToRouteAbsolute('core.avatar.getAvatar', ['userId' => 'admin', 'size' => 32]);
* }
*/
@@ -113,11 +113,11 @@ class ConversationProvider implements IProvider {
*/
protected function getRoomType(Room $room): string {
switch ($room->getType()) {
- case Room::ONE_TO_ONE_CALL:
+ case Room::TYPE_ONE_TO_ONE:
return 'one2one';
- case Room::GROUP_CALL:
+ case Room::TYPE_GROUP:
return 'group';
- case Room::PUBLIC_CALL:
+ case Room::TYPE_PUBLIC:
return 'public';
default:
throw new \InvalidArgumentException('Unknown room type');
diff --git a/lib/Command/Room/Add.php b/lib/Command/Room/Add.php
index 556b9fba4..377741b37 100644
--- a/lib/Command/Room/Add.php
+++ b/lib/Command/Room/Add.php
@@ -71,7 +71,7 @@ class Add extends Base {
return 1;
}
- if (!in_array($room->getType(), [Room::GROUP_CALL, Room::PUBLIC_CALL], true)) {
+ if (!in_array($room->getType(), [Room::TYPE_GROUP, Room::TYPE_PUBLIC], true)) {
$output->writeln('<error>Room is no group call.</error>');
return 1;
}
diff --git a/lib/Command/Room/Create.php b/lib/Command/Room/Create.php
index 8e992aaf3..4b5208e2e 100644
--- a/lib/Command/Room/Create.php
+++ b/lib/Command/Room/Create.php
@@ -120,7 +120,7 @@ class Create extends Base {
return 1;
}
- $roomType = $public ? Room::PUBLIC_CALL : Room::GROUP_CALL;
+ $roomType = $public ? Room::TYPE_PUBLIC : Room::TYPE_GROUP;
try {
$room = $this->roomService->createConversation($roomType, $name);
} catch (InvalidArgumentException $e) {
diff --git a/lib/Command/Room/Delete.php b/lib/Command/Room/Delete.php
index 7135277dd..3f5907415 100644
--- a/lib/Command/Room/Delete.php
+++ b/lib/Command/Room/Delete.php
@@ -57,7 +57,7 @@ class Delete extends Base {
return 1;
}
- if (!in_array($room->getType(), [Room::GROUP_CALL, Room::PUBLIC_CALL], true)) {
+ if (!in_array($room->getType(), [Room::TYPE_GROUP, Room::TYPE_PUBLIC], true)) {
$output->writeln('<error>Room is no group call.</error>');
return 1;
}
diff --git a/lib/Command/Room/Demote.php b/lib/Command/Room/Demote.php
index a7f6a91d8..a150529af 100644
--- a/lib/Command/Room/Demote.php
+++ b/lib/Command/Room/Demote.php
@@ -63,7 +63,7 @@ class Demote extends Base {
return 1;
}
- if (!in_array($room->getType(), [Room::GROUP_CALL, Room::PUBLIC_CALL], true)) {
+ if (!in_array($room->getType(), [Room::TYPE_GROUP, Room::TYPE_PUBLIC], true)) {
$output->writeln('<error>Room is no group call.</error>');
return 1;
}
diff --git a/lib/Command/Room/Promote.php b/lib/Command/Room/Promote.php
index 945dff62e..72088457b 100644
--- a/lib/Command/Room/Promote.php
+++ b/lib/Command/Room/Promote.php
@@ -63,7 +63,7 @@ class Promote extends Base {
return 1;
}
- if (!in_array($room->getType(), [Room::GROUP_CALL, Room::PUBLIC_CALL], true)) {
+ if (!in_array($room->getType(), [Room::TYPE_GROUP, Room::TYPE_PUBLIC], true)) {
$output->writeln('<error>Room is no group call.</error>');
return 1;
}
diff --git a/lib/Command/Room/Remove.php b/lib/Command/Room/Remove.php
index 4424307e0..38a7ca4af 100644
--- a/lib/Command/Room/Remove.php
+++ b/lib/Command/Room/Remove.php
@@ -63,7 +63,7 @@ class Remove extends Base {
return 1;
}
- if (!in_array($room->getType(), [Room::GROUP_CALL, Room::PUBLIC_CALL], true)) {
+ if (!in_array($room->getType(), [Room::TYPE_GROUP, Room::TYPE_PUBLIC], true)) {
$output->writeln('<error>Room is no group call.</error>');
return 1;
}
diff --git a/lib/Command/Room/TRoomCommand.php b/lib/Command/Room/TRoomCommand.php
index ecfa28d9d..b878fbb2e 100644
--- a/lib/Command/Room/TRoomCommand.php
+++ b/lib/Command/Room/TRoomCommand.php
@@ -127,11 +127,11 @@ trait TRoomCommand {
* @throws InvalidArgumentException
*/
protected function setRoomPublic(Room $room, bool $public): void {
- if ($public === ($room->getType() === Room::PUBLIC_CALL)) {
+ if ($public === ($room->getType() === Room::TYPE_PUBLIC)) {
return;
}
- if (!$room->setType($public ? Room::PUBLIC_CALL : Room::GROUP_CALL)) {
+ if (!$room->setType($public ? Room::TYPE_PUBLIC : Room::TYPE_GROUP)) {
throw new InvalidArgumentException('Unable to change room type.');
}
}
@@ -179,7 +179,7 @@ trait TRoomCommand {
return;
}
- if (($password !== '') && ($room->getType() !== Room::PUBLIC_CALL)) {
+ if (($password !== '') && ($room->getType() !== Room::TYPE_PUBLIC)) {
throw new InvalidArgumentException('Unable to add password protection to private room.');
}
diff --git a/lib/Command/Room/Update.php b/lib/Command/Room/Update.php
index a32797455..d8abc64f0 100644
--- a/lib/Command/Room/Update.php
+++ b/lib/Command/Room/Update.php
@@ -121,7 +121,7 @@ class Update extends Base {
return 1;
}
- if (!in_array($room->getType(), [Room::GROUP_CALL, Room::PUBLIC_CALL], true)) {
+ if (!in_array($room->getType(), [Room::TYPE_GROUP, Room::TYPE_PUBLIC], true)) {
$output->writeln('<error>Room is no group call.</error>');
return 1;
}
diff --git a/lib/Controller/ChatController.php b/lib/Controller/ChatController.php
index 920e6dd57..c0bb8d628 100644
--- a/lib/Controller/ChatController.php
+++ b/lib/Controller/ChatController.php
@@ -566,7 +566,7 @@ 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::ONE_TO_ONE_CALL)) {
+ || $this->room->getType() === Room::TYPE_ONE_TO_ONE)) {
// Actor is not a moderator or not the owner of the message
return new DataResponse([], Http::STATUS_FORBIDDEN);
}
@@ -620,7 +620,7 @@ class ChatController extends AEnvironmentAwareController {
public function clearHistory(): DataResponse {
$attendee = $this->participant->getAttendee();
if (!$this->participant->hasModeratorPermissions(false)
- || $this->room->getType() === Room::ONE_TO_ONE_CALL) {
+ || $this->room->getType() === Room::TYPE_ONE_TO_ONE) {
// Actor is not a moderator or not the owner of the message
return new DataResponse([], Http::STATUS_FORBIDDEN);
}
diff --git a/lib/Controller/FilesIntegrationController.php b/lib/Controller/FilesIntegrationController.php
index bf38b6431..eeb1a841a 100644
--- a/lib/Controller/FilesIntegrationController.php
+++ b/lib/Controller/FilesIntegrationController.php
@@ -148,7 +148,7 @@ class FilesIntegrationController extends OCSController {
} catch (RoomNotFoundException $e) {
$name = $node->getName();
$name = $this->roomService->prepareConversationName($name);
- $room = $this->roomService->createConversation(Room::PUBLIC_CALL, $name, null, 'file', $fileId);
+ $room = $this->roomService->createConversation(Room::TYPE_PUBLIC, $name, null, 'file', $fileId);
}