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
diff options
context:
space:
mode:
authorIvan Sein <ivan@struktur.de>2018-03-23 11:47:59 +0300
committerGitHub <noreply@github.com>2018-03-23 11:47:59 +0300
commit5916ee796f94c4c719f325c2d41805dd1c11aae8 (patch)
treef2475145d1e47624c4151d72d4f807b9e87c8bb7
parente1923b03f6383563878e4dce0befd7f7484135d7 (diff)
parentc81acda8ef4c8bbe86c78c70b9b62b0bb4c41eaf (diff)
Merge branch 'stable13' into backport/706/chat-guest-handling
-rw-r--r--appinfo/info.xml2
-rw-r--r--js/models/chatmessagecollection.js2
-rw-r--r--js/models/participantcollection.js4
-rw-r--r--js/models/roomcollection.js2
-rw-r--r--js/views/callinfoview.js8
-rw-r--r--js/views/chatview.js2
-rw-r--r--js/views/sidebarview.js14
-rw-r--r--js/views/tabview.js20
-rw-r--r--l10n/fi.js2
-rw-r--r--l10n/fi.json2
-rw-r--r--l10n/sr.js5
-rw-r--r--l10n/sr.json5
-rw-r--r--lib/BackgroundJob/RemoveEmptyRooms.php72
-rw-r--r--lib/BackgroundJob/ResetInCallFlags.php77
-rw-r--r--lib/Controller/CallController.php9
-rw-r--r--lib/Controller/RoomController.php2
-rw-r--r--lib/Manager.php13
-rw-r--r--lib/Room.php10
-rw-r--r--lib/Signaling/BackendNotifier.php10
19 files changed, 222 insertions, 39 deletions
diff --git a/appinfo/info.xml b/appinfo/info.xml
index a0dc76335..0cdeb1807 100644
--- a/appinfo/info.xml
+++ b/appinfo/info.xml
@@ -49,6 +49,8 @@ And in the works for the [coming versions](https://github.com/nextcloud/spreed/m
<background-jobs>
<job>OCA\Spreed\BackgroundJob\ExpireSignalingMessage</job>
+ <job>OCA\Spreed\BackgroundJob\RemoveEmptyRooms</job>
+ <job>OCA\Spreed\BackgroundJob\ResetInCallFlags</job>
</background-jobs>
<settings>
diff --git a/js/models/chatmessagecollection.js b/js/models/chatmessagecollection.js
index 1f7ef182f..ed94237c2 100644
--- a/js/models/chatmessagecollection.js
+++ b/js/models/chatmessagecollection.js
@@ -117,7 +117,7 @@
* automatically stopped. Note, however, that "receiveMessages" must be
* explicitly called if needed.
*
- * @param string|null token the token of the room.
+ * @param {?string} token the token of the room.
*/
setRoomToken: function(token) {
this.stopReceivingMessages();
diff --git a/js/models/participantcollection.js b/js/models/participantcollection.js
index ccad1bd6e..8768011e9 100644
--- a/js/models/participantcollection.js
+++ b/js/models/participantcollection.js
@@ -65,8 +65,8 @@
* - Online status
* - Alphabetic
*
- * @param modelA
- * @param modelB
+ * @param {OCA.SpreedMe.Models.Participant} modelA
+ * @param {OCA.SpreedMe.Models.Participant} modelB
* @returns {*}
*/
comparator: function(modelA, modelB) {
diff --git a/js/models/roomcollection.js b/js/models/roomcollection.js
index c76bb5108..0d96e0783 100644
--- a/js/models/roomcollection.js
+++ b/js/models/roomcollection.js
@@ -33,7 +33,7 @@
},
url: OC.linkToOCS('apps/spreed/api/v1', 2) + 'room',
/**
- * @param result
+ * @param {Array} result
* @returns {Array}
*/
parse: function(result) {
diff --git a/js/views/callinfoview.js b/js/views/callinfoview.js
index 531f1fb97..b13f079c0 100644
--- a/js/views/callinfoview.js
+++ b/js/views/callinfoview.js
@@ -53,7 +53,7 @@
' <div class="clipboard-button"><span class="icon icon-clippy"></span></div>' +
' <div class="password-button"><span class="icon {{#if hasPassword}}icon-password"{{else}}icon-no-password{{/if}}"></span></div>' +
' <div class="password-option">' +
- ' <input class="password-input" maxlength="200" type="password"' +
+ ' <input class="password-input" maxlength="200" type="password" autocomplete="new-password"' +
' placeholder="{{#if hasPassword}}' + t('spreed', 'Change password') + '{{else}}' + t('spreed', 'Set password') + '{{/if}}">'+
' <div class="icon icon-confirm password-confirm"></div>'+
' </div>' +
@@ -68,6 +68,7 @@
template: Handlebars.compile(TEMPLATE),
renderTimeout: undefined,
+ passwordInputIsShown: false,
templateContext: function() {
var canModerate = this._canModerate();
@@ -169,7 +170,7 @@
},
renderWhenInactive: function() {
- if (this.ui.passwordInput.length === 0 || this.ui.passwordInput.val() === '') {
+ if (this.ui.passwordInput.length === 0 || !this.passwordInputIsShown || this.ui.passwordInput.val() === '') {
this.render();
return;
}
@@ -277,6 +278,7 @@
* Password
*/
showPasswordInput: function() {
+ this.passwordInputIsShown = true;
this.ui.passwordButton.hide();
this.ui.passwordOption.show();
this.ui.passwordInput.focus();
@@ -291,6 +293,7 @@
password: newPassword
},
success: function() {
+ this.passwordInputIsShown = false;
this.ui.passwordInput.val('');
this.ui.passwordOption.hide();
this.ui.passwordButton.show();
@@ -308,6 +311,7 @@
this.confirmPassword();
} else if (e.keyCode === 27) {
// ESC
+ this.passwordInputIsShown = false;
this.ui.passwordInput.val('');
this.ui.passwordOption.hide();
this.ui.passwordButton.show();
diff --git a/js/views/chatview.js b/js/views/chatview.js
index 020198705..117d71385 100644
--- a/js/views/chatview.js
+++ b/js/views/chatview.js
@@ -162,7 +162,7 @@
* the tooltip elements will be appended as siblings of the element for
* which they are shown.
*
- * @param jQuery tooltipContainer the element to append the tooltip
+ * @param {jQuery} tooltipContainer the element to append the tooltip
* elements to
*/
setTooltipContainer: function(tooltipContainer) {
diff --git a/js/views/sidebarview.js b/js/views/sidebarview.js
index 8c5c81458..c5a79a8bc 100644
--- a/js/views/sidebarview.js
+++ b/js/views/sidebarview.js
@@ -144,7 +144,7 @@
* Once set, the SidebarView takes ownership of the view, and it will
* destroy it if a new one is set.
*
- * @param Marionette.View callInfoView the view to set.
+ * @param {Marionette.View} callInfoView the view to set.
*/
setCallInfoView: function(callInfoView) {
this._callInfoView = callInfoView;
@@ -170,10 +170,10 @@
* will destroy it when the SidebarView is destroyed, except if the
* content view is removed first.
*
- * @param string tabId the ID of the tab.
- * @param Object tabHeaderOptions the options for the constructor of the
+ * @param {string} tabId the ID of the tab.
+ * @param {Object} tabHeaderOptions the options for the constructor of the
* TabHeaderView that will be added as the header of the tab.
- * @param Marionette.View tabContentView the View to be shown when the
+ * @param {Marionette.View} tabContentView the View to be shown when the
* tab is selected.
*/
addTab: function(tabId, tabHeaderOptions, tabContentView) {
@@ -183,7 +183,7 @@
/**
* Select the tab associated to the given tabId.
*
- * @param string tabId the ID of the tab to select.
+ * @param {string} tabId the ID of the tab to select.
*/
selectTab: function(tabId) {
this._tabView.selectTab(tabId);
@@ -203,8 +203,8 @@
* content view, and thus the content view must be explicitly destroyed
* when no longer needed.
*
- * @param string tabId the ID of the tab to remove.
- * @return Marionette.View the content view of the removed tab.
+ * @param {string} tabId the ID of the tab to remove.
+ * @return {Marionette.View} the content view of the removed tab.
*/
removeTab: function(tabId) {
return this._tabView.removeTab(tabId);
diff --git a/js/views/tabview.js b/js/views/tabview.js
index cea0193fc..a3ba98030 100644
--- a/js/views/tabview.js
+++ b/js/views/tabview.js
@@ -126,8 +126,8 @@
* priorities; if the priority is the same as one or more of the current
* tab headers the new tab header goes after the last of them.
*
- * @param int priority the priority to get its insertion index.
- * @return int the insertion index.
+ * @param {int} priority the priority to get its insertion index.
+ * @return {int} the insertion index.
*/
_getIndexForTabHeaderPriority: function(priority) {
// _.map creates an array, so "currentPriorities" will contain a
@@ -155,7 +155,7 @@
* insertion order) is automatically selected; if the tab header to be
* removed is the last one, then the previous one is selected instead.
*
- * @param string tabId the ID of the tab.
+ * @param {string} tabId the ID of the tab.
*/
removeTabHeader: function(tabId) {
var tabIdIndex = _.indexOf(this._tabIds, tabId);
@@ -246,10 +246,10 @@
* destroy it when the TabView is destroyed, except if the content view
* is removed first.
*
- * @param string tabId the ID of the tab.
- * @param Object tabHeaderOptions the options for the constructor of the
+ * @param {string} tabId the ID of the tab.
+ * @param {Object} tabHeaderOptions the options for the constructor of the
* TabHeaderView that will be added as the header of the tab.
- * @param Marionette.View tabContentView the View to be shown when the
+ * @param {Marionette.View} tabContentView the View to be shown when the
* tab is selected.
*/
addTab: function(tabId, tabHeaderOptions, tabContentView) {
@@ -281,8 +281,8 @@
* view, and thus the content view must be explicitly destroyed when no
* longer needed.
*
- * @param string tabId the ID of the tab to remove.
- * @return Marionette.View the content view of the removed tab.
+ * @param {string} tabId the ID of the tab to remove.
+ * @return {Marionette.View} the content view of the removed tab.
*/
removeTab: function(tabId) {
if (!this._tabContentViews.hasOwnProperty(tabId)) {
@@ -309,7 +309,7 @@
/**
* Select the tab associated to the given tabId.
*
- * @param string tabId the ID of the tab to select.
+ * @param {string} tabId the ID of the tab to select.
*/
selectTab: function(tabId) {
if (!this._tabContentViews.hasOwnProperty(tabId)) {
@@ -324,7 +324,7 @@
*
* Only for internal use as an event handler.
*
- * @param string tabId the ID of the selected tab.
+ * @param {string} tabId the ID of the selected tab.
*/
onChildviewSelectTabHeader: function(tabId) {
if (this._selectedTabExtraClass) {
diff --git a/l10n/fi.js b/l10n/fi.js
index f3447ea5c..d8aabaa0c 100644
--- a/l10n/fi.js
+++ b/l10n/fi.js
@@ -59,6 +59,7 @@ OC.L10N.register(
"Copy link" : "Kopioi linkki",
"You" : "Sinä",
"No messages yet, start the conversation!" : "Ei vielä viestejä, aloita keskustelu!",
+ "New message …" : "Uusi viesti …",
"Send" : "Lähetä",
"Guest" : "Vieras",
"[Unknown user name]" : "[Tuntematon käyttäjänimi]",
@@ -96,6 +97,7 @@ OC.L10N.register(
"Guest's screen" : "Vieraan näyttö",
"Your screen" : "Sinun näyttösi",
"No Camera" : "Ei kameraa",
+ "a call" : "puhelu",
"(Duration %s)" : "(Kesto %s)",
"You attended a call with {user1}" : "Osallistuit puheluun käyttäjän {user1} kanssa",
"_%n guest_::_%n guests_" : ["%n vieras","%n vierasta"],
diff --git a/l10n/fi.json b/l10n/fi.json
index a3653068e..d3403311d 100644
--- a/l10n/fi.json
+++ b/l10n/fi.json
@@ -57,6 +57,7 @@
"Copy link" : "Kopioi linkki",
"You" : "Sinä",
"No messages yet, start the conversation!" : "Ei vielä viestejä, aloita keskustelu!",
+ "New message …" : "Uusi viesti …",
"Send" : "Lähetä",
"Guest" : "Vieras",
"[Unknown user name]" : "[Tuntematon käyttäjänimi]",
@@ -94,6 +95,7 @@
"Guest's screen" : "Vieraan näyttö",
"Your screen" : "Sinun näyttösi",
"No Camera" : "Ei kameraa",
+ "a call" : "puhelu",
"(Duration %s)" : "(Kesto %s)",
"You attended a call with {user1}" : "Osallistuit puheluun käyttäjän {user1} kanssa",
"_%n guest_::_%n guests_" : ["%n vieras","%n vierasta"],
diff --git a/l10n/sr.js b/l10n/sr.js
index f7d2320f2..0cc050229 100644
--- a/l10n/sr.js
+++ b/l10n/sr.js
@@ -38,6 +38,7 @@ OC.L10N.register(
"Not supported!" : "Није подржано! ",
"Press ⌘-C to copy." : "Притисни ⌘-C за копирање.",
"Press Ctrl-C to copy." : "Притисни Ctrl-C за копирање.",
+ "Join a conversation or start a new one" : "Придружи се разговору или започни нови",
"This call has ended" : "Позив је завршен",
"Please enter the password for this call" : "Уносите лозинку за овај позив",
"Password required" : "Потребна је лозинка",
@@ -59,6 +60,7 @@ OC.L10N.register(
"Copy link" : "Копирај везу",
"You" : "Ви",
"No messages yet, start the conversation!" : "Још нема порука, започните разговор!",
+ "New message …" : "Нова порука…",
"Send" : "Пошаљи",
"Guest" : "Гост",
"[Unknown user name]" : "[непознато корисничко име]",
@@ -125,6 +127,9 @@ OC.L10N.register(
"{user} mentioned you in a group chat: {call}" : "{user} Вас је споменуо/ла у групном разговору: {call}",
"%s mentioned you in a group chat" : "%s Вас је споменуо/ла у групном разговору",
"{user} mentioned you in a group chat" : "{user} Вас је споменуо/ла у групном разговору",
+ "You were mentioned in a group chat by a user that has since been deleted: %s" : "Поменути сте у групном разговору од стране корисника који је од тада избрисан: %s",
+ "You were mentioned in a group chat by a user that has since been deleted: {call}" : "Поменути сте у групном разговору од стране корисника који је од тада избрисан: {call}",
+ "You were mentioned in a group chat by a user that has since been deleted" : "Поменути сте у групном разговору од стране корисника који је од тада избрисан",
"A guest mentioned you in a group chat: %s" : "Гост Вас је споменуо у групном разговору: %s",
"A guest mentioned you in a group chat: {call}" : "Гост Вас је споменуо у групном разговору: {call}",
"A guest mentioned you in a group chat" : "Гост Вас је споменуо у групном разговору",
diff --git a/l10n/sr.json b/l10n/sr.json
index 73b66aeff..a374d14f7 100644
--- a/l10n/sr.json
+++ b/l10n/sr.json
@@ -36,6 +36,7 @@
"Not supported!" : "Није подржано! ",
"Press ⌘-C to copy." : "Притисни ⌘-C за копирање.",
"Press Ctrl-C to copy." : "Притисни Ctrl-C за копирање.",
+ "Join a conversation or start a new one" : "Придружи се разговору или започни нови",
"This call has ended" : "Позив је завршен",
"Please enter the password for this call" : "Уносите лозинку за овај позив",
"Password required" : "Потребна је лозинка",
@@ -57,6 +58,7 @@
"Copy link" : "Копирај везу",
"You" : "Ви",
"No messages yet, start the conversation!" : "Још нема порука, започните разговор!",
+ "New message …" : "Нова порука…",
"Send" : "Пошаљи",
"Guest" : "Гост",
"[Unknown user name]" : "[непознато корисничко име]",
@@ -123,6 +125,9 @@
"{user} mentioned you in a group chat: {call}" : "{user} Вас је споменуо/ла у групном разговору: {call}",
"%s mentioned you in a group chat" : "%s Вас је споменуо/ла у групном разговору",
"{user} mentioned you in a group chat" : "{user} Вас је споменуо/ла у групном разговору",
+ "You were mentioned in a group chat by a user that has since been deleted: %s" : "Поменути сте у групном разговору од стране корисника који је од тада избрисан: %s",
+ "You were mentioned in a group chat by a user that has since been deleted: {call}" : "Поменути сте у групном разговору од стране корисника који је од тада избрисан: {call}",
+ "You were mentioned in a group chat by a user that has since been deleted" : "Поменути сте у групном разговору од стране корисника који је од тада избрисан",
"A guest mentioned you in a group chat: %s" : "Гост Вас је споменуо у групном разговору: %s",
"A guest mentioned you in a group chat: {call}" : "Гост Вас је споменуо у групном разговору: {call}",
"A guest mentioned you in a group chat" : "Гост Вас је споменуо у групном разговору",
diff --git a/lib/BackgroundJob/RemoveEmptyRooms.php b/lib/BackgroundJob/RemoveEmptyRooms.php
new file mode 100644
index 000000000..203697488
--- /dev/null
+++ b/lib/BackgroundJob/RemoveEmptyRooms.php
@@ -0,0 +1,72 @@
+<?php
+/**
+ * @copyright Copyright (c) 2018 Joas Schilling <coding@schilljs.com>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace OCA\Spreed\BackgroundJob;
+
+use OC\BackgroundJob\TimedJob;
+use OCA\Spreed\Manager;
+use OCA\Spreed\Room;
+use OCP\ILogger;
+
+/**
+ * Class RemoveEmptyRooms
+ *
+ * @package OCA\Spreed\BackgroundJob
+ */
+class RemoveEmptyRooms extends TimedJob {
+
+ /** @var Manager */
+ protected $manager;
+
+ /** @var ILogger */
+ protected $logger;
+
+ protected $numDeletedRooms = 0;
+
+ public function __construct(Manager $manager, ILogger $logger) {
+ // Every 5 minutes
+ $this->setInterval(60 * 5);
+
+ $this->manager = $manager;
+ $this->logger = $logger;
+ }
+
+ protected function run($argument) {
+ $this->manager->forAllRooms([$this, 'callback']);
+
+ if ($this->numDeletedRooms) {
+ $this->logger->info('Deleted {numDeletedRooms} rooms because they were empty', [
+ 'numDeletedRooms' => $this->numDeletedRooms,
+ 'app' => 'spreed',
+ ]);
+ }
+ }
+
+ public function callback(Room $room) {
+ if ($room->getType() === Room::ONE_TO_ONE_CALL && $room->getNumberOfParticipants(false) <= 1) {
+ $room->deleteRoom();
+ $this->numDeletedRooms++;
+ } else if ($room->getNumberOfParticipants(false) === 0) {
+ $room->deleteRoom();
+ $this->numDeletedRooms++;
+ }
+ }
+}
diff --git a/lib/BackgroundJob/ResetInCallFlags.php b/lib/BackgroundJob/ResetInCallFlags.php
new file mode 100644
index 000000000..29006981d
--- /dev/null
+++ b/lib/BackgroundJob/ResetInCallFlags.php
@@ -0,0 +1,77 @@
+<?php
+/**
+ * @copyright Copyright (c) 2018 Joas Schilling <coding@schilljs.com>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace OCA\Spreed\BackgroundJob;
+
+use OC\BackgroundJob\TimedJob;
+use OCA\Spreed\Exceptions\ParticipantNotFoundException;
+use OCA\Spreed\Manager;
+use OCA\Spreed\Room;
+use OCP\AppFramework\Utility\ITimeFactory;
+
+/**
+ * Class ResetInCallFlags
+ *
+ * @package OCA\Spreed\BackgroundJob
+ */
+class ResetInCallFlags extends TimedJob {
+
+ /** @var Manager */
+ protected $manager;
+
+ /** @var int */
+ protected $timeout;
+
+ public function __construct(Manager $manager, ITimeFactory $timeFactory) {
+ // Every 5 minutes
+ $this->setInterval(60 * 5);
+
+ $this->manager = $manager;
+ $this->timeout = $timeFactory->getTime() - 5 * 60;
+ }
+
+
+ protected function run($argument) {
+ $this->manager->forAllRooms([$this, 'callback']);
+ }
+
+ public function callback(Room $room) {
+ if (!$room->hasSessionsInCall()) {
+ return;
+ }
+
+ foreach ($room->getActiveSessions() as $session) {
+ try {
+ $participant = $room->getParticipantBySession($session);
+ } catch (ParticipantNotFoundException $e) {
+ // Participant was just deleted, ignore …
+ continue;
+ }
+
+ if ($participant->getLastPing() < $this->timeout) {
+ // TODO reset session too
+ if ($participant->isInCall()) {
+ $room->changeInCall($session, false);
+ }
+ }
+ }
+ }
+}
diff --git a/lib/Controller/CallController.php b/lib/Controller/CallController.php
index 531b51bf4..5a4801d06 100644
--- a/lib/Controller/CallController.php
+++ b/lib/Controller/CallController.php
@@ -44,8 +44,6 @@ class CallController extends OCSController {
private $session;
/** @var Manager */
private $manager;
- /** @var Messages */
- private $messages;
/**
* @param string $appName
@@ -53,23 +51,18 @@ class CallController extends OCSController {
* @param IRequest $request
* @param IUserManager $userManager
* @param ISession $session
- * @param ILogger $logger
* @param Manager $manager
- * @param Messages $messages
*/
public function __construct($appName,
$UserId,
IRequest $request,
IUserManager $userManager,
ISession $session,
- ILogger $logger,
- Manager $manager,
- Messages $messages) {
+ Manager $manager) {
parent::__construct($appName, $request);
$this->userId = $UserId;
$this->session = $session;
$this->manager = $manager;
- $this->messages = $messages;
}
/**
diff --git a/lib/Controller/RoomController.php b/lib/Controller/RoomController.php
index 0630338e8..30a018a34 100644
--- a/lib/Controller/RoomController.php
+++ b/lib/Controller/RoomController.php
@@ -173,7 +173,7 @@ class RoomController extends OCSController {
'displayName' => $room->getName(),
'participantType' => $participantType,
'participantInCall' => $participantInCall,
- 'count' => $room->getNumberOfParticipants(time() - 30),
+ 'count' => $room->getNumberOfParticipants(false, time() - 30),
'hasPassword' => $room->hasPassword(),
'hasCall' => $room->getActiveSince() instanceof \DateTimeInterface,
];
diff --git a/lib/Manager.php b/lib/Manager.php
index cb71e8643..bceb5a2b5 100644
--- a/lib/Manager.php
+++ b/lib/Manager.php
@@ -61,6 +61,19 @@ class Manager {
$this->hasher = $hasher;
}
+ public function forAllRooms(callable $callback) {
+ $query = $this->db->getQueryBuilder();
+ $query->select('*')
+ ->from('talk_rooms');
+
+ $result = $query->execute();
+ while ($row = $result->fetch()) {
+ $room = $this->createRoomObject($row);
+ $callback($room);
+ }
+ $result->closeCursor();
+ }
+
/**
* @param array $row
* @return Room
diff --git a/lib/Room.php b/lib/Room.php
index 9a22ab85b..69e94e952 100644
--- a/lib/Room.php
+++ b/lib/Room.php
@@ -766,10 +766,11 @@ class Room {
}
/**
+ * @param bool $ignoreGuests
* @param int $lastPing When the last ping is older than the given timestamp, the user is ignored
* @return int
*/
- public function getNumberOfParticipants($lastPing = 0) {
+ public function getNumberOfParticipants($ignoreGuests = true, $lastPing = 0) {
$query = $this->db->getQueryBuilder();
$query->selectAlias($query->createFunction('COUNT(*)'), 'num_participants')
->from('talk_participants')
@@ -779,6 +780,13 @@ class Room {
$query->andWhere($query->expr()->gt('last_ping', $query->createNamedParameter($lastPing, IQueryBuilder::PARAM_INT)));
}
+ if ($ignoreGuests) {
+ $query->andWhere($query->expr()->notIn('participant_type', $query->createNamedParameter([
+ Participant::GUEST,
+ Participant::USER_SELF_JOINED,
+ ], IQueryBuilder::PARAM_INT_ARRAY)));
+ }
+
$result = $query->execute();
$row = $result->fetch();
$result->closeCursor();
diff --git a/lib/Signaling/BackendNotifier.php b/lib/Signaling/BackendNotifier.php
index f5111bfb8..aa9ebf5ec 100644
--- a/lib/Signaling/BackendNotifier.php
+++ b/lib/Signaling/BackendNotifier.php
@@ -131,7 +131,7 @@ class BackendNotifier{
* @throws \Exception
*/
public function roomInvited($room, $users) {
- $this->logger->info('Now invited to ' . $room->getToken() . ': ' . print_r($users, true));
+ $this->logger->info('Now invited to ' . $room->getToken() . ': ' . print_r($users, true), ['app' => 'spreed']);
$userIds = [];
foreach ($users as $user) {
$userIds[] = $user['userId'];
@@ -159,7 +159,7 @@ class BackendNotifier{
* @throws \Exception
*/
public function roomsDisinvited($room, $userIds) {
- $this->logger->info('No longer invited to ' . $room->getToken() . ': ' . print_r($userIds, true));
+ $this->logger->info('No longer invited to ' . $room->getToken() . ': ' . print_r($userIds, true), ['app' => 'spreed']);
$this->backendRequest('/api/v1/room/' . $room->getToken(), [
'type' => 'disinvite',
'disinvite' => [
@@ -182,7 +182,7 @@ class BackendNotifier{
* @throws \Exception
*/
public function roomModified($room) {
- $this->logger->info('Room modified: ' . $room->getToken());
+ $this->logger->info('Room modified: ' . $room->getToken(), ['app' => 'spreed']);
$this->backendRequest('/api/v1/room/' . $room->getToken(), [
'type' => 'update',
'update' => [
@@ -202,7 +202,7 @@ class BackendNotifier{
* @throws \Exception
*/
public function roomDeleted($room, $participants) {
- $this->logger->info('Room deleted: ' . $room->getToken());
+ $this->logger->info('Room deleted: ' . $room->getToken(), ['app' => 'spreed']);
$userIds = array_keys($participants['users']);
$this->backendRequest('/api/v1/room/' . $room->getToken(), [
'type' => 'delete',
@@ -221,7 +221,7 @@ class BackendNotifier{
* @throws \Exception
*/
public function roomInCallChanged($room, $inCall, $sessionIds) {
- $this->logger->info('Room in-call status changed: ' . $room->getToken() . ' ' . $inCall . ' ' . print_r($sessionIds, true));
+ $this->logger->info('Room in-call status changed: ' . $room->getToken() . ' ' . $inCall . ' ' . print_r($sessionIds, true), ['app' => 'spreed']);
$changed = [];
$users = [];
$participants = $room->getParticipants();