From 46bfe380f6e7487c3ee405990600e5f6628713d9 Mon Sep 17 00:00:00 2001 From: cdujeu Date: Tue, 7 Apr 2015 15:16:21 +0200 Subject: [PATCH] Feedstore: forward to parent repository if any. Fix i18n issues for "watch/stop watching" button Ignore notif to delete if already deleted. --- core/src/plugins/action.share/res/i18n/de.php | 4 ++-- core/src/plugins/action.share/res/i18n/es.php | 4 ++-- core/src/plugins/action.share/res/i18n/fr.php | 4 ++-- core/src/plugins/action.share/res/i18n/pt.php | 4 ++-- .../class.AJXP_NotificationCenter.php | 11 +++++++++-- core/src/plugins/feed.sql/class.AJXP_SqlFeedStore.php | 4 ++++ 6 files changed, 21 insertions(+), 10 deletions(-) diff --git a/core/src/plugins/action.share/res/i18n/de.php b/core/src/plugins/action.share/res/i18n/de.php index 9e4810fa87..cbf39861be 100644 --- a/core/src/plugins/action.share/res/i18n/de.php +++ b/core/src/plugins/action.share/res/i18n/de.php @@ -83,8 +83,8 @@ "78"=> "Achtung, Sie sollten nur standard-alphanumerische Zeichen für Benutzernamen verwenden. Die Bezeichnung '%CURRENT%' wird durch '%NEW%' ersetzt.", "79"=> "Benachrichtigung", "80"=> "Sende den Link per Email an die selektierten Nutzer oder Adressen", -"81"=> "beobachtet", -"82"=> "unbeobachtet", +"81"=> "unbeobachten", +"82"=> "beobachten", "83"=> "Beobachtungsstatus ändern um eine/keine Benachrichtigung bei einen Download zu erhalten", "84"=> "Passwort", "85"=> "Dieser Link ist durch ein Passwort geschützt", diff --git a/core/src/plugins/action.share/res/i18n/es.php b/core/src/plugins/action.share/res/i18n/es.php index 97f5d6e937..4548c849c6 100644 --- a/core/src/plugins/action.share/res/i18n/es.php +++ b/core/src/plugins/action.share/res/i18n/es.php @@ -84,8 +84,8 @@ "78"=> "Warning, you should only use standard alphanumerical characters for user names. The identifier '%CURRENT%' will be replaced by '%NEW%'", "79"=> "invite", "80"=> "Send link by email to a selection of users or addresses", -"81"=> "watched", -"82"=> "not watched", +"81"=> "stop watching", +"82"=> "watch", "83"=> "Toggle watch status to receive or not notifications when file is downloaded", "84"=> "password", "85"=> "A protection password is set on this link", diff --git a/core/src/plugins/action.share/res/i18n/fr.php b/core/src/plugins/action.share/res/i18n/fr.php index f71d8e9d76..019cc9df27 100644 --- a/core/src/plugins/action.share/res/i18n/fr.php +++ b/core/src/plugins/action.share/res/i18n/fr.php @@ -86,8 +86,8 @@ "78"=> "Attention, vous ne devez utiliser que des caractères alphanumériques standards pour les noms d'utilisateur. L'identifiant '%CURRENT%' sera remplacé par '%NEW%'", "79"=> "inviter", "80"=> "Envoyer une invitation à des utilisateurs ou des adresses courriel externes.", -"81"=> "non surveillé", -"82"=> "surveillé", +"81"=> "ne pas surveiller", +"82"=> "surveiller", "83"=> "Choisir de recevoir ou non des alertes lorsque le fichier est téléchargé", "84"=> "mot de passe", "85"=> "Une protection par mot de passe est présente sur ce lien", diff --git a/core/src/plugins/action.share/res/i18n/pt.php b/core/src/plugins/action.share/res/i18n/pt.php index 46360c296d..d8c2a9b453 100644 --- a/core/src/plugins/action.share/res/i18n/pt.php +++ b/core/src/plugins/action.share/res/i18n/pt.php @@ -84,8 +84,8 @@ "78"=> "ATENÇÃO: Só deve utilizar caracteres alfa-numéricos padrão para nomes de utilizador. O Identificador '%CURRENT%' será substituído por '%NEW%'", "79"=> "invite", "80"=> "Send link by email to a selection of users or addresses", -"81"=> "watched", -"82"=> "not watched", +"81"=> "stop watching", +"82"=> "watch", "83"=> "Toggle watch status to receive or not notifications when file is downloaded", "84"=> "password", "85"=> "A protection password is set on this link", diff --git a/core/src/plugins/core.notifications/class.AJXP_NotificationCenter.php b/core/src/plugins/core.notifications/class.AJXP_NotificationCenter.php index aa48d158dc..4108228e3e 100755 --- a/core/src/plugins/core.notifications/class.AJXP_NotificationCenter.php +++ b/core/src/plugins/core.notifications/class.AJXP_NotificationCenter.php @@ -75,12 +75,19 @@ protected function parseSpecificContributions(&$contribNode) public function persistNotificationToAlerts(AJXP_Notification &$notification) { if ($this->eventStore) { + $this->eventStore->persistAlert($notification); AJXP_Controller::applyHook("msg.instant",array( "", $notification->getNode()->getRepositoryId(), $notification->getTarget() )); - $this->eventStore->persistAlert($notification); + if($notification->getNode()->getRepository() != null && $notification->getNode()->getRepository()->hasParent()){ + AJXP_Controller::applyHook("msg.instant",array( + "", + $notification->getNode()->getRepository()->getParentId(), + $notification->getTarget() + )); + } } } @@ -315,7 +322,7 @@ public function loadUserAlerts($actionName, $httpVars, $fileVars) $contentFilter = $nodeRepo->getContentFilter(); if(isSet($contentFilter)){ $nodePath = $contentFilter->filterExternalPath($node->getPath()); - if($nodePath == "/"){ + if(empty($nodePath) || $nodePath == "/"){ $k = array_keys($contentFilter->filters); $nodePath = $k[0]; } diff --git a/core/src/plugins/feed.sql/class.AJXP_SqlFeedStore.php b/core/src/plugins/feed.sql/class.AJXP_SqlFeedStore.php index 8d99ea07db..6430f54b0a 100644 --- a/core/src/plugins/feed.sql/class.AJXP_SqlFeedStore.php +++ b/core/src/plugins/feed.sql/class.AJXP_SqlFeedStore.php @@ -224,6 +224,10 @@ public function dismissAlertById($alertId, $occurrences = 1) } $startEventNotif = new AJXP_Notification(); $startEventNotif = unserialize($startEventRow->content); + if(empty($startEventNotif)) { + // Ignore, empty notif; + return; + } $url = $startEventNotif->getNode()->getUrl(); $date = $startEventRow->edate; $newRes = dibi::query("SELECT [id] FROM [ajxp_feed] WHERE [etype] = %s AND [user_id] = %s AND [edate] <= %s AND [index_path] = %s ORDER BY [edate] DESC %lmt", "alert", $userId, $date, $url, $occurrences);