mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-07 18:14:35 +00:00
PHRAS-3442_optimize-list-notifications_4.1-bis
WIP fix tests todo : mark read notifications (button ? click ?)
This commit is contained in:
0
cache/.gitkeep
vendored
Normal file → Executable file
0
cache/.gitkeep
vendored
Normal file → Executable file
@@ -47,22 +47,12 @@ class SessionController extends Controller
|
|||||||
];
|
];
|
||||||
|
|
||||||
$authenticator = $this->getAuthenticator();
|
$authenticator = $this->getAuthenticator();
|
||||||
// every request is catched by SessionManagerSubscriber, which handles disconnect
|
|
||||||
// so this code is probably useless
|
if (!$authenticator->isAuthenticated()) {
|
||||||
/*
|
|
||||||
if ($authenticator->isAuthenticated()) {
|
|
||||||
$usr_id = $authenticator->getUser()->getId();
|
|
||||||
if ($usr_id != $request->request->get('usr')) { // I logged with another user
|
|
||||||
$ret['status'] = 'disconnected';
|
$ret['status'] = 'disconnected';
|
||||||
|
|
||||||
return $this->app->json($ret);
|
return $this->app->json($ret);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
$ret['status'] = 'disconnected';
|
|
||||||
|
|
||||||
return $this->app->json($ret);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$this->getApplicationBox()->get_connection();
|
$this->getApplicationBox()->get_connection();
|
||||||
|
@@ -70,8 +70,12 @@ class SessionManagerSubscriber implements EventSubscriberInterface
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$moduleIName= $this->getModuleName($request->getPathInfo());
|
||||||
$moduleId = $this->getModuleId($request->getPathInfo());
|
$moduleId = $this->getModuleId($request->getPathInfo());
|
||||||
|
|
||||||
|
if(is_null($moduleId) && $moduleIName !== "login") {
|
||||||
|
return;
|
||||||
|
}
|
||||||
// if we are already disconnected (ex. from another window), quit immediately
|
// if we are already disconnected (ex. from another window), quit immediately
|
||||||
//
|
//
|
||||||
if (!($this->app->getAuthenticator()->isAuthenticated())) {
|
if (!($this->app->getAuthenticator()->isAuthenticated())) {
|
||||||
|
@@ -211,6 +211,10 @@ class eventsmanager_broker
|
|||||||
|
|
||||||
public function get_notifications(int $offset=0, int $limit=10, $readFilter = self::READ | self::UNREAD, \Alchemy\Phrasea\Utilities\Stopwatch $stopwatch = null)
|
public function get_notifications(int $offset=0, int $limit=10, $readFilter = self::READ | self::UNREAD, \Alchemy\Phrasea\Utilities\Stopwatch $stopwatch = null)
|
||||||
{
|
{
|
||||||
|
if(!$this->app->getAuthenticatedUser()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if($stopwatch) $stopwatch->lap("broker start");
|
if($stopwatch) $stopwatch->lap("broker start");
|
||||||
|
|
||||||
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
@@ -6,17 +6,17 @@ use Alchemy\Phrasea\Application;
|
|||||||
use Alchemy\Phrasea\Core\Configuration\Configuration;
|
use Alchemy\Phrasea\Core\Configuration\Configuration;
|
||||||
use Alchemy\Phrasea\Core\Configuration\HostConfiguration;
|
use Alchemy\Phrasea\Core\Configuration\HostConfiguration;
|
||||||
use Alchemy\Phrasea\Core\Configuration\PropertyAccess;
|
use Alchemy\Phrasea\Core\Configuration\PropertyAccess;
|
||||||
|
use Symfony\Component\BrowserKit\Cookie as BrowserCookie;
|
||||||
|
use Symfony\Component\BrowserKit\CookieJar;
|
||||||
|
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||||
|
use Symfony\Component\HttpFoundation\Cookie;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
use Symfony\Component\HttpFoundation\Cookie;
|
|
||||||
use Symfony\Component\HttpFoundation\ResponseHeaderBag;
|
use Symfony\Component\HttpFoundation\ResponseHeaderBag;
|
||||||
use Symfony\Component\HttpKernel\Client;
|
use Symfony\Component\HttpKernel\Client;
|
||||||
use Symfony\Component\BrowserKit\CookieJar;
|
|
||||||
use Symfony\Component\BrowserKit\Cookie as BrowserCookie;
|
|
||||||
use Symfony\Component\Routing\Generator\UrlGenerator;
|
|
||||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
|
||||||
use Symfony\Component\HttpKernel\KernelEvents;
|
|
||||||
use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent;
|
use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent;
|
||||||
|
use Symfony\Component\HttpKernel\KernelEvents;
|
||||||
|
use Symfony\Component\Routing\Generator\UrlGenerator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @group functional
|
* @group functional
|
||||||
@@ -143,24 +143,6 @@ class ApplicationTest extends \PhraseanetTestCase
|
|||||||
$this->assertEquals('en_USA', $client->getResponse()->getContent());
|
$this->assertEquals('en_USA', $client->getResponse()->getContent());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @covers Alchemy\Phrasea\Application
|
|
||||||
*/
|
|
||||||
public function testFlashSession()
|
|
||||||
{
|
|
||||||
$app = new Application(Application::ENV_TEST);
|
|
||||||
$sessionId = null;
|
|
||||||
$app->post('/prod/upload/', function (Application $app) use (&$sessionId) {
|
|
||||||
$sessionId = $app['session']->getId();
|
|
||||||
return "";
|
|
||||||
});
|
|
||||||
|
|
||||||
$client = new Client($app);
|
|
||||||
|
|
||||||
$client->request('POST', '/prod/upload/', ['php_session_id'=>'123456'], [], ['HTTP_USER_AGENT'=>'flash']);
|
|
||||||
$this->assertEquals('123456', $sessionId);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testGeneratePath()
|
public function testGeneratePath()
|
||||||
{
|
{
|
||||||
$generator = $this->getMockBuilder('Symfony\Component\Routing\Generator\UrlGenerator')
|
$generator = $this->getMockBuilder('Symfony\Component\Routing\Generator\UrlGenerator')
|
||||||
|
Reference in New Issue
Block a user