From 79ae5bb77def107d106e9455ae84903ab36d430d Mon Sep 17 00:00:00 2001 From: Olivier PEREZ Date: Mon, 14 Nov 2016 23:35:04 +0100 Subject: [PATCH 1/2] Fix the code that checks if we should send notification regarding type of notification --- app/classes/Framadate/Services/NotificationService.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/classes/Framadate/Services/NotificationService.php b/app/classes/Framadate/Services/NotificationService.php index f1f181c..e59c5c1 100644 --- a/app/classes/Framadate/Services/NotificationService.php +++ b/app/classes/Framadate/Services/NotificationService.php @@ -34,7 +34,11 @@ class NotificationService { $_SESSION['mail_sent'] = []; } - if ($poll->receiveNewVotes) { + $isVoteAndCanSendIt = ($type == self::UPDATE_VOTE || $type == self::ADD_VOTE) && $poll->receiveNewVotes; + $isCommentAndCanSendIt = $type == self::ADD_COMMENT && $poll->receiveNewComments; + $isOtherType = $type != self::UPDATE_VOTE && $type != self::ADD_VOTE && $type != self::ADD_COMMENT; + + if ($isVoteAndCanSendIt || $isCommentAndCanSendIt || $isOtherType) { if (self::isParticipation($type)) { $translationString = 'Poll\'s participation: %s'; From cf21a10314cb90d327e2dd236a5aa47d3d847b38 Mon Sep 17 00:00:00 2001 From: Olivier PEREZ Date: Mon, 14 Nov 2016 23:41:57 +0100 Subject: [PATCH 2/2] Remove '/action' when calculating server URL --- app/classes/Framadate/Utils.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/classes/Framadate/Utils.php b/app/classes/Framadate/Utils.php index 045f632..fc3242c 100644 --- a/app/classes/Framadate/Utils.php +++ b/app/classes/Framadate/Utils.php @@ -28,6 +28,7 @@ class Utils { $dirname = dirname($_SERVER['SCRIPT_NAME']); $dirname = $dirname === '\\' ? '/' : $dirname . '/'; $dirname = str_replace('/admin', '', $dirname); + $dirname = str_replace('/action', '', $dirname); $server_name = (defined('APP_URL') ? APP_URL : $_SERVER['SERVER_NAME']) . $port . $dirname; return $scheme . '://' . preg_replace('#//+#', '/', $server_name);