From 8f6a31737dfc296c638aa9e2ce969bb4a8a42d80 Mon Sep 17 00:00:00 2001
From: Antonin <antonin.murtin@gmail.com>
Date: Tue, 6 Dec 2016 15:34:10 +0100
Subject: [PATCH] Merge branch 'fix/Some_fixes_on_comments' into 'master'

Some fixes on comments

Fix #205

See merge request !161
---
 app/classes/Framadate/Services/NotificationService.php | 6 +++++-
 app/classes/Framadate/Utils.php                        | 1 +
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/app/classes/Framadate/Services/NotificationService.php b/app/classes/Framadate/Services/NotificationService.php
index f1f181cb..e59c5c1d 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';
diff --git a/app/classes/Framadate/Utils.php b/app/classes/Framadate/Utils.php
index 87bc546b..f60a592b 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);
-- 
GitLab