summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2015-11-14 16:12:44 -0500
committerFrederic Guillot <fred@kanboard.net>2015-11-14 16:12:44 -0500
commit2fc402f6733573627ad25394d109b9f848ef04f6 (patch)
treeefc0407ef780742bee91886287bacb0c9b5903c1 /app
parentd0925d99e78843ef3c633aac052880fc271ac299 (diff)
Fix PHP error when adding a new user with email notification enabled
Diffstat (limited to 'app')
-rw-r--r--app/Controller/User.php3
-rw-r--r--app/Notification/Mail.php7
-rw-r--r--app/Notification/Web.php7
-rw-r--r--app/ServiceProvider/ClassProvider.php6
4 files changed, 20 insertions, 3 deletions
diff --git a/app/Controller/User.php b/app/Controller/User.php
index b5f4edeb..8526fb57 100644
--- a/app/Controller/User.php
+++ b/app/Controller/User.php
@@ -3,6 +3,7 @@
namespace Kanboard\Controller;
use Kanboard\Model\NotificationType;
+use Kanboard\Notification\Mail as MailNotification;
/**
* User controller
@@ -95,7 +96,7 @@ class User extends Base
$this->projectPermission->addMember($project_id, $user_id);
if (! empty($values['notifications_enabled'])) {
- $this->userNotificationType->saveSelectedTypes($user_id, array(NotificationType::TYPE_EMAIL));
+ $this->userNotificationType->saveSelectedTypes($user_id, array(MailNotification::TYPE));
}
$this->session->flash(t('User created successfully.'));
diff --git a/app/Notification/Mail.php b/app/Notification/Mail.php
index cd8af852..98bffef2 100644
--- a/app/Notification/Mail.php
+++ b/app/Notification/Mail.php
@@ -17,6 +17,13 @@ use Kanboard\Model\Subtask;
class Mail extends Base implements NotificationInterface
{
/**
+ * Notification type
+ *
+ * @var string
+ */
+ const TYPE = 'email';
+
+ /**
* Send notification to a user
*
* @access public
diff --git a/app/Notification/Web.php b/app/Notification/Web.php
index 989ae06e..9271c193 100644
--- a/app/Notification/Web.php
+++ b/app/Notification/Web.php
@@ -13,6 +13,13 @@ use Kanboard\Core\Base;
class Web extends Base implements NotificationInterface
{
/**
+ * Notification type
+ *
+ * @var string
+ */
+ const TYPE = 'web';
+
+ /**
* Send notification to a user
*
* @access public
diff --git a/app/ServiceProvider/ClassProvider.php b/app/ServiceProvider/ClassProvider.php
index 79bb734f..2699de17 100644
--- a/app/ServiceProvider/ClassProvider.php
+++ b/app/ServiceProvider/ClassProvider.php
@@ -14,6 +14,8 @@ use Kanboard\Core\Tool;
use Kanboard\Core\Http\Client as HttpClient;
use Kanboard\Model\UserNotificationType;
use Kanboard\Model\ProjectNotificationType;
+use Kanboard\Notification\Mail as MailNotification;
+use Kanboard\Notification\Web as WebNotification;
class ClassProvider implements ServiceProviderInterface
{
@@ -141,8 +143,8 @@ class ClassProvider implements ServiceProviderInterface
$container['userNotificationType'] = function ($container) {
$type = new UserNotificationType($container);
- $type->setType('email', t('Email'), '\Kanboard\Notification\Mail');
- $type->setType('web', t('Web'), '\Kanboard\Notification\Web');
+ $type->setType(MailNotification::TYPE, t('Email'), '\Kanboard\Notification\Mail');
+ $type->setType(WebNotification::TYPE, t('Web'), '\Kanboard\Notification\Web');
return $type;
};