Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/spreed.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2019-07-24 09:48:54 +0300
committerDaniel Calviño Sánchez <danxuliu@gmail.com>2019-08-28 11:28:30 +0300
commit1136b70ec2d441cbb72345f51ac5ef43b49f7167 (patch)
treee798e377c3b604b6cac307ababcc8624c8f68dff /lib
parentf56ab8fe9083955b7b4d2910a3108b3aeb6d1a52 (diff)
Fix the system message when the timer was reached
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/Chat/Parser/SystemMessage.php2
-rw-r--r--lib/Chat/SystemMessage/Listener.php4
-rw-r--r--lib/Room.php7
3 files changed, 10 insertions, 3 deletions
diff --git a/lib/Chat/Parser/SystemMessage.php b/lib/Chat/Parser/SystemMessage.php
index f29e999e4..d56d37663 100644
--- a/lib/Chat/Parser/SystemMessage.php
+++ b/lib/Chat/Parser/SystemMessage.php
@@ -138,6 +138,8 @@ class SystemMessage {
if ($currentUserIsActor) {
$parsedMessage = $this->l->t('You locked the conversation');
}
+ } else if ($message === 'lobby_timer_reached') {
+ $parsedMessage = $this->l->t('The conversation is now open to everyone');
} else if ($message === 'lobby_all_participants') {
$parsedMessage = $this->l->t('{actor} opened the conversation to everyone');
if ($currentUserIsActor) {
diff --git a/lib/Chat/SystemMessage/Listener.php b/lib/Chat/SystemMessage/Listener.php
index 2df3b119b..abfab3ba1 100644
--- a/lib/Chat/SystemMessage/Listener.php
+++ b/lib/Chat/SystemMessage/Listener.php
@@ -171,7 +171,9 @@ class Listener {
/** @var self $listener */
$listener = \OC::$server->query(self::class);
- if ($arguments['newState'] === Webinary::ALL_PARTICIPANTS) {
+ if ($arguments['timerReached']) {
+ $listener->sendSystemMessage($room, 'lobby_timer_reached', $event->getArguments());
+ } else if ($arguments['newState'] === Webinary::ALL_PARTICIPANTS) {
$listener->sendSystemMessage($room, 'lobby_all_participants', $event->getArguments());
} else if ($arguments['newState'] === Webinary::MODERATORS_ONLY) {
$listener->sendSystemMessage($room, 'lobby_moderators_only', $event->getArguments());
diff --git a/lib/Room.php b/lib/Room.php
index 45f483158..0b3c40c4b 100644
--- a/lib/Room.php
+++ b/lib/Room.php
@@ -165,7 +165,7 @@ class Room {
protected function validateTimer(): void {
if ($this->lobbyTimer !== null && $this->lobbyTimer < $this->timeFactory->getDateTime()) {
- $this->setLobby(Webinary::ALL_PARTICIPANTS, null);
+ $this->setLobby(Webinary::ALL_PARTICIPANTS, null, true);
}
}
@@ -527,9 +527,10 @@ class Room {
* Also it's not allowed in one-to-one conversations,
* file conversations and password request conversations.
* @param \DateTime|null $dateTime
+ * @param bool $timerReached
* @return bool True when the change was valid, false otherwise
*/
- public function setLobby(int $newState, ?\DateTime $dateTime): bool {
+ public function setLobby(int $newState, ?\DateTime $dateTime, bool $timerReached = false): bool {
$oldState = $this->lobbyState;
if (!in_array($this->getType(), [self::GROUP_CALL, self::PUBLIC_CALL], true)) {
@@ -548,6 +549,7 @@ class Room {
'newState' => $newState,
'oldState' => $oldState,
'lobbyTimer' => $dateTime,
+ 'timerReached' => $timerReached,
]));
$query = $this->db->getQueryBuilder();
@@ -563,6 +565,7 @@ class Room {
'newState' => $newState,
'oldState' => $oldState,
'lobbyTimer' => $dateTime,
+ 'timerReached' => $timerReached,
]));
return true;