Fix PHP error when adding a new user with email notification enabled

This commit is contained in:
Frederic Guillot 2015-11-14 16:12:44 -05:00
parent d0925d99e7
commit 2fc402f673
5 changed files with 21 additions and 3 deletions

View File

@ -10,6 +10,7 @@ Bug fixes:
* Loading cs_CZ locale display the wrong language in datetime picker
* Datepicker is closed unexpectedly on blur event
* Fix bug in daily project summary CSV export
* Fix PHP error when adding a new user with email notification enabled
Version 1.0.20
--------------

View File

@ -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.'));

View File

@ -16,6 +16,13 @@ use Kanboard\Model\Subtask;
*/
class Mail extends Base implements NotificationInterface
{
/**
* Notification type
*
* @var string
*/
const TYPE = 'email';
/**
* Send notification to a user
*

View File

@ -12,6 +12,13 @@ use Kanboard\Core\Base;
*/
class Web extends Base implements NotificationInterface
{
/**
* Notification type
*
* @var string
*/
const TYPE = 'web';
/**
* Send notification to a user
*

View File

@ -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;
};