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:
authorJoas Schilling <coding@schilljs.com>2016-11-25 17:41:18 +0300
committerGitHub <noreply@github.com>2016-11-25 17:41:18 +0300
commitee08a37513704164bf00c8eebbdc69b00fb3221a (patch)
tree91e3c9cb1303f7f16540ae5c8f322b8dc4851769
parent3574185184d8853a9c40ee5c467716c1cbd6411c (diff)
parentf5adbc303e856ef2e9322a3e90ea795b2d129d94 (diff)
Merge pull request #145 from nextcloud/kill-notifications-already-when-entering-the-room
Kill notifications already when entering the room, not on first ping
-rw-r--r--lib/Controller/ApiController.php10
-rw-r--r--lib/Controller/PageController.php17
2 files changed, 16 insertions, 11 deletions
diff --git a/lib/Controller/ApiController.php b/lib/Controller/ApiController.php
index b586bb4c0..cc9a817bd 100644
--- a/lib/Controller/ApiController.php
+++ b/lib/Controller/ApiController.php
@@ -479,16 +479,8 @@ class ApiController extends Controller {
}
$sessionId = $this->session->get('spreed-session');
-
- if ($this->userId !== null) {
- $notification = $this->notificationManager->createNotification();
- $notification->setApp('spreed')
- ->setUser($this->userId)
- ->setObject('room', (string) $roomId);
- $this->notificationManager->markProcessed($notification);
- }
-
$room->ping($this->userId, $sessionId, time());
+
return new JSONResponse();
}
diff --git a/lib/Controller/PageController.php b/lib/Controller/PageController.php
index 0a8f16b9d..7013a5db4 100644
--- a/lib/Controller/PageController.php
+++ b/lib/Controller/PageController.php
@@ -29,12 +29,12 @@ use OCA\Spreed\Manager;
use OCA\Spreed\Room;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http\ContentSecurityPolicy;
-use OCP\AppFramework\Http\RedirectResponse;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\IDBConnection;
use OCP\IL10N;
use OCP\IRequest;
use OCP\IURLGenerator;
+use OCP\Notification\IManager;
use OCP\Security\ISecureRandom;
class PageController extends Controller {
@@ -50,6 +50,8 @@ class PageController extends Controller {
private $manager;
/** @var ISecureRandom */
private $secureRandom;
+ /** @var IManager */
+ private $notificationManager;
/**
* @param string $appName
@@ -60,6 +62,7 @@ class PageController extends Controller {
* @param IL10N $l10n
* @param Manager $manager
* @param ISecureRandom $secureRandom
+ * @param IManager $notificationManager
*/
public function __construct($appName,
IRequest $request,
@@ -68,7 +71,8 @@ class PageController extends Controller {
IURLGenerator $url,
IL10N $l10n,
Manager $manager,
- ISecureRandom $secureRandom) {
+ ISecureRandom $secureRandom,
+ IManager $notificationManager) {
parent::__construct($appName, $request);
$this->userId = $UserId;
$this->dbConnection = $dbConnection;
@@ -76,6 +80,7 @@ class PageController extends Controller {
$this->l10n = $l10n;
$this->manager = $manager;
$this->secureRandom = $secureRandom;
+ $this->notificationManager = $notificationManager;
}
/**
@@ -105,6 +110,14 @@ class PageController extends Controller {
$roomId = 0;
}
}
+
+ if ($this->userId !== null) {
+ $notification = $this->notificationManager->createNotification();
+ $notification->setApp('spreed')
+ ->setUser($this->userId)
+ ->setObject('room', (string) $roomId);
+ $this->notificationManager->markProcessed($notification);
+ }
}
$params = [