Skip to content
Snippets Groups Projects
Commit 22a9e5ec authored by VESSILLER's avatar VESSILLER
Browse files

FIX notification and activity labels

parent 69135f2a
No related branches found
No related tags found
No related merge requests found
...@@ -38,7 +38,7 @@ class Provider implements IProvider { ...@@ -38,7 +38,7 @@ class Provider implements IProvider {
/** @var string */ /** @var string */
protected $lastType = ''; protected $lastType = '';
const SUBJECT_ARCHIVES_PROCESSED = 'job_processed'; const SUBJECT_ARCHIVES_PROCESSED_ACTIVITY = 'job_processed_activity';
/** /**
* @param IFactory $languageFactory * @param IFactory $languageFactory
...@@ -116,7 +116,7 @@ class Provider implements IProvider { ...@@ -116,7 +116,7 @@ class Provider implements IProvider {
$parameters = $event->getSubjectParameters(); $parameters = $event->getSubjectParameters();
switch ($subject) { switch ($subject) {
case self::SUBJECT_ARCHIVES_PROCESSED: case self::SUBJECT_ARCHIVES_PROCESSED_ACTIVITY:
return [ return [
'nb_success' => $parameters[0], 'nb_success' => $parameters[0],
'nb_total' => $parameters[1], 'nb_total' => $parameters[1],
......
...@@ -19,6 +19,8 @@ use Exception; ...@@ -19,6 +19,8 @@ use Exception;
use OCA\Dematpayslip\Db\DematpayslipArchive; use OCA\Dematpayslip\Db\DematpayslipArchive;
use OCA\Dematpayslip\Db\DematpayslipArchiveMapper; use OCA\Dematpayslip\Db\DematpayslipArchiveMapper;
use OCA\Dematpayslip\Db\DematpayslipUserMapper; use OCA\Dematpayslip\Db\DematpayslipUserMapper;
use OCA\Dematpayslip\Activity\Provider;
use OCA\Dematpayslip\Notification\Notifier;
/** /**
...@@ -283,7 +285,7 @@ class ArchiveProcess extends TimedJob { ...@@ -283,7 +285,7 @@ class ArchiveProcess extends TimedJob {
->setType('job_processed') ->setType('job_processed')
->setAffectedUser($userId) ->setAffectedUser($userId)
->setTimestamp($dateTimeNow->getTimestamp()) ->setTimestamp($dateTimeNow->getTimestamp())
->setSubject('job_processed', [$nbSuccess, $nbTotal]); ->setSubject(Provider::SUBJECT_ARCHIVES_PROCESSED_ACTIVITY, [$nbSuccess, $nbTotal]);
//->setLink($folderLink) //->setLink($folderLink)
//->setObject('folder', $folder->getId(), $folder->getUuid()); //->setObject('folder', $folder->getId(), $folder->getUuid());
$this->_activityManager->publish($event); $this->_activityManager->publish($event);
...@@ -292,7 +294,7 @@ class ArchiveProcess extends TimedJob { ...@@ -292,7 +294,7 @@ class ArchiveProcess extends TimedJob {
$this->_log('Notification add : archives processed'); $this->_log('Notification add : archives processed');
$notification = $this->_notificationManager->createNotification(); $notification = $this->_notificationManager->createNotification();
$notification->setApp($this->_appName) $notification->setApp($this->_appName)
->setSubject('job_processed', ['nb_success' => $nbSuccess, 'nb_total' => $nbTotal]) ->setSubject(Notifier::SUBJECT_JOB_PROCESSED_NOTIFY, ['nb_success' => $nbSuccess, 'nb_total' => $nbTotal])
->setObject('dematpayslip_process', $dateTimeNow->getTimestamp()) ->setObject('dematpayslip_process', $dateTimeNow->getTimestamp())
->setUser($userId); ->setUser($userId);
//->setIcon($this->_urlGenerator->getAbsoluteURL($this->_urlGenerator->imagePath($this->_appName, 'folder.png'))) //->setIcon($this->_urlGenerator->getAbsoluteURL($this->_urlGenerator->imagePath($this->_appName, 'folder.png')))
......
...@@ -22,9 +22,11 @@ use OCA\Dematpayslip\Db\DematpayslipArchiveMapper; ...@@ -22,9 +22,11 @@ use OCA\Dematpayslip\Db\DematpayslipArchiveMapper;
use OCA\Dematpayslip\Db\DematpayslipProcessMapper; use OCA\Dematpayslip\Db\DematpayslipProcessMapper;
use OCA\Dematpayslip\Db\DematpayslipProcessSkipMapper; use OCA\Dematpayslip\Db\DematpayslipProcessSkipMapper;
use OCA\Dematpayslip\Db\DematpayslipUserMapper; use OCA\Dematpayslip\Db\DematpayslipUserMapper;
use OCA\Dematpayslip\Activity\Provider;
use OCA\Dematpayslip\Notification\Notifier;
/** /**
* Clean up all file locks that are expired for the DB file locking provider * Clean up all file locks that are expired for the DB file locking provider
*/ */
class IndexationProcess extends TimedJob { class IndexationProcess extends TimedJob {
...@@ -296,7 +298,7 @@ class IndexationProcess extends TimedJob { ...@@ -296,7 +298,7 @@ class IndexationProcess extends TimedJob {
->setType('job_processed') ->setType('job_processed')
->setAffectedUser($userId) ->setAffectedUser($userId)
->setTimestamp($dateTimeNow->getTimestamp()) ->setTimestamp($dateTimeNow->getTimestamp())
->setSubject('job_processed', [$nbSuccess, $nbTotal]); ->setSubject(Provider::SUBJECT_ARCHIVES_PROCESSED_ACTIVITY, [$nbSuccess, $nbTotal]);
//->setLink($folderLink) //->setLink($folderLink)
//->setObject('folder', $folder->getId(), $folder->getUuid()); //->setObject('folder', $folder->getId(), $folder->getUuid());
$this->_activityManager->publish($event); $this->_activityManager->publish($event);
...@@ -305,7 +307,7 @@ class IndexationProcess extends TimedJob { ...@@ -305,7 +307,7 @@ class IndexationProcess extends TimedJob {
$this->_log('Notification add : indexation processed'); $this->_log('Notification add : indexation processed');
$notification = $this->_notificationManager->createNotification(); $notification = $this->_notificationManager->createNotification();
$notification->setApp($this->_appName) $notification->setApp($this->_appName)
->setSubject('job_processed', ['nb_success' => $nbSuccess, 'nb_total' => $nbTotal]) ->setSubject(Notifier::SUBJECT_JOB_PROCESSED_NOTIFY, ['nb_success' => $nbSuccess, 'nb_total' => $nbTotal])
->setObject('dematpayslip_process', $dateTimeNow->getTimestamp()) ->setObject('dematpayslip_process', $dateTimeNow->getTimestamp())
->setUser($userId); ->setUser($userId);
//->setIcon($this->_urlGenerator->getAbsoluteURL($this->_urlGenerator->imagePath($this->_appName, 'folder.png'))) //->setIcon($this->_urlGenerator->getAbsoluteURL($this->_urlGenerator->imagePath($this->_appName, 'folder.png')))
......
...@@ -43,7 +43,7 @@ class Notifier implements INotifier { ...@@ -43,7 +43,7 @@ class Notifier implements INotifier {
/** @var IURLGenerator */ /** @var IURLGenerator */
protected $url; protected $url;
const SUBJECT_ARCHIVES_PROCESSED = 'job_processed'; const SUBJECT_JOB_PROCESSED_NOTIFY = 'job_processed_notify';
/** /**
* @param IFactory $factory * @param IFactory $factory
...@@ -93,7 +93,7 @@ class Notifier implements INotifier { ...@@ -93,7 +93,7 @@ class Notifier implements INotifier {
} }
switch ($notification->getSubject()) { switch ($notification->getSubject()) {
case self::SUBJECT_ARCHIVES_PROCESSED: case self::SUBJECT_JOB_PROCESSED_NOTIFY:
$subject = $this->getSubject($notification, $languageCode); $subject = $this->getSubject($notification, $languageCode);
if ($subject === '') { if ($subject === '') {
// Everything done, mark the notification as processed... // Everything done, mark the notification as processed...
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment