mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-18 15:33:15 +00:00
mark all notification as read
This commit is contained in:
@@ -13,5 +13,5 @@ module.exports = {
|
|||||||
setupDir: _root + 'tests/setup/node.js',
|
setupDir: _root + 'tests/setup/node.js',
|
||||||
karmaConf: _root + 'config/karma.conf.js',
|
karmaConf: _root + 'config/karma.conf.js',
|
||||||
// change this version when you change JS file for lazy loading
|
// change this version when you change JS file for lazy loading
|
||||||
assetFileVersion: 38
|
assetFileVersion: 39
|
||||||
};
|
};
|
||||||
|
@@ -96,7 +96,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||||||
/******/ if (__webpack_require__.nc) {
|
/******/ if (__webpack_require__.nc) {
|
||||||
/******/ script.setAttribute("nonce", __webpack_require__.nc);
|
/******/ script.setAttribute("nonce", __webpack_require__.nc);
|
||||||
/******/ }
|
/******/ }
|
||||||
/******/ script.src = __webpack_require__.p + "lazy-" + ({}[chunkId]||chunkId) + ".js?v=38";
|
/******/ script.src = __webpack_require__.p + "lazy-" + ({}[chunkId]||chunkId) + ".js?v=39";
|
||||||
/******/ var timeout = setTimeout(onScriptComplete, 120000);
|
/******/ var timeout = setTimeout(onScriptComplete, 120000);
|
||||||
/******/ script.onerror = script.onload = onScriptComplete;
|
/******/ script.onerror = script.onload = onScriptComplete;
|
||||||
/******/ function onScriptComplete() {
|
/******/ function onScriptComplete() {
|
||||||
|
@@ -96,7 +96,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||||||
/******/ if (__webpack_require__.nc) {
|
/******/ if (__webpack_require__.nc) {
|
||||||
/******/ script.setAttribute("nonce", __webpack_require__.nc);
|
/******/ script.setAttribute("nonce", __webpack_require__.nc);
|
||||||
/******/ }
|
/******/ }
|
||||||
/******/ script.src = __webpack_require__.p + "lazy-" + ({}[chunkId]||chunkId) + ".min.js?v=38";
|
/******/ script.src = __webpack_require__.p + "lazy-" + ({}[chunkId]||chunkId) + ".min.js?v=39";
|
||||||
/******/ var timeout = setTimeout(onScriptComplete, 120000);
|
/******/ var timeout = setTimeout(onScriptComplete, 120000);
|
||||||
/******/ script.onerror = script.onload = onScriptComplete;
|
/******/ script.onerror = script.onload = onScriptComplete;
|
||||||
/******/ function onScriptComplete() {
|
/******/ function onScriptComplete() {
|
||||||
|
2
Phraseanet-production-client/dist/commons.js
vendored
2
Phraseanet-production-client/dist/commons.js
vendored
@@ -91,7 +91,7 @@
|
|||||||
/******/ if (__webpack_require__.nc) {
|
/******/ if (__webpack_require__.nc) {
|
||||||
/******/ script.setAttribute("nonce", __webpack_require__.nc);
|
/******/ script.setAttribute("nonce", __webpack_require__.nc);
|
||||||
/******/ }
|
/******/ }
|
||||||
/******/ script.src = __webpack_require__.p + "lazy-" + ({}[chunkId]||chunkId) + ".js?v=38";
|
/******/ script.src = __webpack_require__.p + "lazy-" + ({}[chunkId]||chunkId) + ".js?v=39";
|
||||||
/******/ var timeout = setTimeout(onScriptComplete, 120000);
|
/******/ var timeout = setTimeout(onScriptComplete, 120000);
|
||||||
/******/ script.onerror = script.onload = onScriptComplete;
|
/******/ script.onerror = script.onload = onScriptComplete;
|
||||||
/******/ function onScriptComplete() {
|
/******/ function onScriptComplete() {
|
||||||
|
@@ -91,7 +91,7 @@
|
|||||||
/******/ if (__webpack_require__.nc) {
|
/******/ if (__webpack_require__.nc) {
|
||||||
/******/ script.setAttribute("nonce", __webpack_require__.nc);
|
/******/ script.setAttribute("nonce", __webpack_require__.nc);
|
||||||
/******/ }
|
/******/ }
|
||||||
/******/ script.src = __webpack_require__.p + "lazy-" + ({}[chunkId]||chunkId) + ".min.js?v=38";
|
/******/ script.src = __webpack_require__.p + "lazy-" + ({}[chunkId]||chunkId) + ".min.js?v=39";
|
||||||
/******/ var timeout = setTimeout(onScriptComplete, 120000);
|
/******/ var timeout = setTimeout(onScriptComplete, 120000);
|
||||||
/******/ script.onerror = script.onload = onScriptComplete;
|
/******/ script.onerror = script.onload = onScriptComplete;
|
||||||
/******/ function onScriptComplete() {
|
/******/ function onScriptComplete() {
|
||||||
|
13
Phraseanet-production-client/dist/production.js
vendored
13
Phraseanet-production-client/dist/production.js
vendored
@@ -19402,6 +19402,19 @@ var notifyLayout = function notifyLayout(services) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$notificationDialog.on('click', '.mark-all-read', function (event) {
|
||||||
|
event.preventDefault();
|
||||||
|
_jquery2.default.ajax({
|
||||||
|
type: 'POST',
|
||||||
|
url: '/user/notifications/read-all/',
|
||||||
|
success: function success(data) {
|
||||||
|
if (data.success == true) {
|
||||||
|
print_notifications(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
var markNotificationRead = function markNotificationRead(notification_id, $notification) {
|
var markNotificationRead = function markNotificationRead(notification_id, $notification) {
|
||||||
|
@@ -19402,6 +19402,19 @@ var notifyLayout = function notifyLayout(services) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$notificationDialog.on('click', '.mark-all-read', function (event) {
|
||||||
|
event.preventDefault();
|
||||||
|
_jquery2.default.ajax({
|
||||||
|
type: 'POST',
|
||||||
|
url: '/user/notifications/read-all/',
|
||||||
|
success: function success(data) {
|
||||||
|
if (data.success == true) {
|
||||||
|
print_notifications(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
var markNotificationRead = function markNotificationRead(notification_id, $notification) {
|
var markNotificationRead = function markNotificationRead(notification_id, $notification) {
|
||||||
|
@@ -209,6 +209,20 @@ const notifyLayout = (services) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$notificationDialog.on('click', '.mark-all-read', function(event) {
|
||||||
|
event.preventDefault();
|
||||||
|
$.ajax({
|
||||||
|
type: 'POST',
|
||||||
|
url: '/user/notifications/read-all/',
|
||||||
|
success: function (data) {
|
||||||
|
if (data.success == true) {
|
||||||
|
print_notifications(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const markNotificationRead = (notification_id, $notification) => {
|
const markNotificationRead = (notification_id, $notification) => {
|
||||||
|
@@ -159,6 +159,27 @@ class UserNotificationController extends Controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* mark all notification as read
|
||||||
|
*
|
||||||
|
* @param Request $request
|
||||||
|
* @return JsonResponse
|
||||||
|
*/
|
||||||
|
public function readAllNotification(Request $request)
|
||||||
|
{
|
||||||
|
if (!$request->isXmlHttpRequest()) {
|
||||||
|
$this->app->abort(400);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$this->getEventsManager()->readAll($this->getAuthenticatedUser()->getId());
|
||||||
|
|
||||||
|
return $this->app->json(['success' => true, 'message' => '']);
|
||||||
|
}
|
||||||
|
catch (\Exception $e) {
|
||||||
|
return $this->app->json(['success' => false, 'message' => $e->getMessage()]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get all notifications
|
* Get all notifications
|
||||||
|
@@ -58,6 +58,10 @@ class Notifications implements ControllerProviderInterface, ServiceProviderInter
|
|||||||
->assert('notification_id', '\d+')
|
->assert('notification_id', '\d+')
|
||||||
->bind('set_notifications_readed');
|
->bind('set_notifications_readed');
|
||||||
|
|
||||||
|
/** @uses UserNotificationController::readAllNotification() */
|
||||||
|
$controllers->post('/read-all/', 'controller.user.notifications:readAllNotification')
|
||||||
|
->bind('set_all_notifications_readed');
|
||||||
|
|
||||||
/*
|
/*
|
||||||
/** @uses UserNotificationController::listNotifications * /
|
/** @uses UserNotificationController::listNotifications * /
|
||||||
$controllers->get('/', 'controller.user.notifications:getNotifications')
|
$controllers->get('/', 'controller.user.notifications:getNotifications')
|
||||||
|
@@ -59,7 +59,7 @@ class PhraseanetExtension extends \Twig_Extension
|
|||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
// change this version when you change JS file to force the navigation to reload js file
|
// change this version when you change JS file to force the navigation to reload js file
|
||||||
'assetFileVersion' => 38
|
'assetFileVersion' => 39
|
||||||
];
|
];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -389,6 +389,36 @@ class eventsmanager_broker
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* mark all user notification as read
|
||||||
|
* @param $usr_id
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
|
public function readAll($usr_id)
|
||||||
|
{
|
||||||
|
/** @var Connection $connection */
|
||||||
|
$connection = $this->app->getApplicationBox()->get_connection();
|
||||||
|
$builder = $connection->createQueryBuilder();
|
||||||
|
$builder
|
||||||
|
->update('notifications')
|
||||||
|
->set('unread', '0')
|
||||||
|
->where(
|
||||||
|
$builder->expr()->eq('usr_id', ':usr_id')
|
||||||
|
)
|
||||||
|
->setParameters(
|
||||||
|
[
|
||||||
|
'usr_id' => $usr_id,
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'usr_id' => PDO::PARAM_INT,
|
||||||
|
]
|
||||||
|
)
|
||||||
|
->execute()
|
||||||
|
;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
public function list_notifications_available(User $user)
|
public function list_notifications_available(User $user)
|
||||||
{
|
{
|
||||||
$personal_notifications = [];
|
$personal_notifications = [];
|
||||||
|
@@ -1,5 +1,8 @@
|
|||||||
{# css from resources/www/_shared/styles/_notification.scss #}
|
{# css from resources/www/_shared/styles/_notification.scss #}
|
||||||
<div id="notifications-dialog" style="display: none">
|
<div id="notifications-dialog" style="display: none">
|
||||||
|
<div>
|
||||||
|
<a href="#" class="mark-all-read" style="cursor: pointer;">{{'notification:: mark all notification as read' | trans}}</a>
|
||||||
|
</div>
|
||||||
<div class="notifications">
|
<div class="notifications">
|
||||||
</div>
|
</div>
|
||||||
<div class="navigation">
|
<div class="navigation">
|
||||||
|
Reference in New Issue
Block a user