stream notifications types
This commit is contained in:
@@ -113,6 +113,7 @@ return array (
|
||||
'assignmentNotificationsEntityList' => ['Meeting', 'Call', 'Task', 'Email'],
|
||||
"portalStreamEmailNotifications" => true,
|
||||
'streamEmailNotificationsEntityList' => ['Case'],
|
||||
'streamEmailNotificationsTypeList' => ['Post', 'Status', 'EmailReceived'],
|
||||
'emailMessageMaxSize' => 10,
|
||||
'notificationsCheckInterval' => 10,
|
||||
'disabledCountQueryEntityList' => ['Email'],
|
||||
|
||||
@@ -61,6 +61,7 @@
|
||||
"streamEmailNotifications": "Notifications about updates in Stream for internal users",
|
||||
"portalStreamEmailNotifications": "Notifications about updates in Stream for portal users",
|
||||
"streamEmailNotificationsEntityList": "Stream email notifications scopes",
|
||||
"streamEmailNotificationsTypeList": "What to notify about",
|
||||
"b2cMode": "B2C Mode",
|
||||
"avatarsDisabled": "Disable Avatars",
|
||||
"followCreatedEntities": "Follow created records",
|
||||
@@ -103,6 +104,11 @@
|
||||
"currencyFormat": {
|
||||
"1": "10 USD",
|
||||
"2": "$10"
|
||||
},
|
||||
"streamEmailNotificationsTypeList": {
|
||||
"Post": "Posts",
|
||||
"Status": "Status updates",
|
||||
"EmailReceived": "Received emails"
|
||||
}
|
||||
},
|
||||
"tooltips": {
|
||||
@@ -140,7 +146,7 @@
|
||||
"aclStrictMode": "Enabled: Access to scopes will be forbidden if it's not specified in roles.\n\nDisabled: Access to scopes will be allowed if it's not specified in roles.",
|
||||
"aclAllowDeleteCreated": "Users will be able to remove records they created even if they don't have a delete access.",
|
||||
"textFilterUseContainsForVarchar": "If not checked then 'starts with' operator is used. You can use the wildcard '%'.",
|
||||
"streamEmailNotificationsEntityList": "Email notifications about stream updates of followed records.",
|
||||
"streamEmailNotificationsEntityList": "Email notifications about stream updates of followed records. Users will receive email notifications only for specified entity types.",
|
||||
"authTokenPreventConcurrent": "Users won't be able to be logged in on multiple devices simultaneously."
|
||||
},
|
||||
"labels": {
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
[{"name": "assignmentEmailNotifications"}, {"name": "mentionEmailNotifications"}],
|
||||
[{"name": "assignmentEmailNotificationsEntityList"}, false],
|
||||
[{"name": "streamEmailNotifications"}, {"name": "portalStreamEmailNotifications"}],
|
||||
[{"name": "streamEmailNotificationsEntityList"}, false]
|
||||
[{"name": "streamEmailNotificationsEntityList"}, {"name": "streamEmailNotificationsTypeList"}]
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -303,6 +303,10 @@
|
||||
"view": "views/settings/fields/stream-email-notifications-entity-list",
|
||||
"tooltip": true
|
||||
},
|
||||
"streamEmailNotificationsTypeList": {
|
||||
"type": "multiEnum",
|
||||
"options": ["Post", "Status", "EmailReceived"]
|
||||
},
|
||||
"b2cMode": {
|
||||
"type": "bool",
|
||||
"default": false,
|
||||
|
||||
@@ -49,12 +49,11 @@ class EmailNotification extends \Espo\Core\Services\Base
|
||||
'fileManager',
|
||||
'selectManagerFactory',
|
||||
'templateFileManager',
|
||||
'injectableFactory'
|
||||
'injectableFactory',
|
||||
'config'
|
||||
]);
|
||||
}
|
||||
|
||||
protected $noteNotificationTypeList = ['Post', 'Status', 'EmailReceived'];
|
||||
|
||||
protected $emailNotificationEntityHandlerHash = array();
|
||||
|
||||
protected function getMailSender()
|
||||
@@ -77,6 +76,11 @@ class EmailNotification extends \Espo\Core\Services\Base
|
||||
return $this->getInjection('dateTime');
|
||||
}
|
||||
|
||||
protected function getConfig()
|
||||
{
|
||||
return $this->getInjection('config');
|
||||
}
|
||||
|
||||
protected function getTemplateFileManager()
|
||||
{
|
||||
return $this->getInjection('templateFileManager');
|
||||
@@ -227,6 +231,8 @@ class EmailNotification extends \Espo\Core\Services\Base
|
||||
|
||||
protected function getNotificationSelectParamsNote()
|
||||
{
|
||||
$noteNotificationTypeList = $this->getConfig()->get('streamEmailNotificationsTypeList', []);
|
||||
|
||||
$selectManager = $this->getInjection('selectManagerFactory')->create('Notification');
|
||||
|
||||
$selectParams = $selectManager->getEmptySelectParams();
|
||||
@@ -236,7 +242,7 @@ class EmailNotification extends \Espo\Core\Services\Base
|
||||
|
||||
$selectParams['customJoin'] .= ' JOIN note ON notification.related_id = note.id';
|
||||
|
||||
$selectParams['whereClause']['note.type'] = $this->noteNotificationTypeList;
|
||||
$selectParams['whereClause']['note.type'] = $noteNotificationTypeList;
|
||||
|
||||
$entityList = $this->getConfig()->get('streamEmailNotificationsEntityList');
|
||||
|
||||
@@ -346,7 +352,10 @@ class EmailNotification extends \Espo\Core\Services\Base
|
||||
|
||||
$note = $this->getEntityManager()->getEntity('Note', $notification->get('relatedId'));
|
||||
if (!$note) return;
|
||||
if (!in_array($note->get('type'), $this->noteNotificationTypeList)) return;
|
||||
|
||||
$noteNotificationTypeList = $this->getConfig()->get('streamEmailNotificationsTypeList', []);
|
||||
|
||||
if (!in_array($note->get('type'), $noteNotificationTypeList)) return;
|
||||
|
||||
if (!$notification->get('userId')) return;
|
||||
$userId = $notification->get('userId');
|
||||
@@ -574,6 +583,13 @@ class EmailNotification extends \Espo\Core\Services\Base
|
||||
$parentId = $note->get('parentId');
|
||||
$parentType = $note->get('parentType');
|
||||
|
||||
$allowedEntityTypeList = $this->getConfig()->get('streamEmailNotificationsEmailReceivedEntityTypeList');
|
||||
if (
|
||||
is_array($allowedEntityTypeList)
|
||||
&&
|
||||
!in_array($parentType, $allowedEntityTypeList)
|
||||
) return;
|
||||
|
||||
$emailAddress = $user->get('emailAddress');
|
||||
if (!$emailAddress) return;
|
||||
|
||||
|
||||
@@ -81,8 +81,10 @@ Espo.define('views/admin/notifications', 'views/settings/record/edit', function
|
||||
controlStreamEmailNotificationsEntityList: function () {
|
||||
if (this.model.get('streamEmailNotifications') || this.model.get('portalStreamEmailNotifications')) {
|
||||
this.showField('streamEmailNotificationsEntityList');
|
||||
this.showField('streamEmailNotificationsTypeList');
|
||||
} else {
|
||||
this.hideField('streamEmailNotificationsEntityList');
|
||||
this.hideField('streamEmailNotificationsTypeList');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user