mirror of
https://github.com/vale981/Vulcan
synced 2025-03-10 12:36:39 -04:00

* Telescope.notifications.create -> import { createNotifications } from 'meteor/nova:notifications' ; * leverage Meteor's weak dependencies on packages & move code related to emails / notifications from nova:posts et al. to nova:notifications
74 lines
1.7 KiB
JavaScript
74 lines
1.7 KiB
JavaScript
import Users from 'meteor/nova:users';
|
|
|
|
// note: leverage weak dependencies on packages
|
|
const Comments = Package['nova:comments'] ? Package['nova:comments'].default : null;
|
|
|
|
const notificationsGroup = {
|
|
name: "notifications",
|
|
order: 2
|
|
};
|
|
|
|
// Add notifications options to user profile settings
|
|
Users.addField([
|
|
{
|
|
fieldName: 'notifications_users',
|
|
fieldSchema: {
|
|
label: 'New users',
|
|
type: Boolean,
|
|
optional: true,
|
|
defaultValue: false,
|
|
control: "checkbox",
|
|
viewableBy: ['guests'],
|
|
insertableBy: ['admins'],
|
|
editableBy: ['admins'],
|
|
group: notificationsGroup,
|
|
}
|
|
},
|
|
{
|
|
fieldName: 'notifications_posts',
|
|
fieldSchema: {
|
|
label: 'New posts',
|
|
type: Boolean,
|
|
optional: true,
|
|
defaultValue: false,
|
|
control: "checkbox",
|
|
viewableBy: ['guests'],
|
|
insertableBy: ['members'],
|
|
editableBy: ['members'],
|
|
group: notificationsGroup,
|
|
}
|
|
}
|
|
]);
|
|
|
|
if (!!Comments) {
|
|
Users.addField([
|
|
{
|
|
fieldName: 'notifications_comments',
|
|
fieldSchema: {
|
|
label: 'Comments on my posts',
|
|
type: Boolean,
|
|
optional: true,
|
|
defaultValue: false,
|
|
control: "checkbox",
|
|
viewableBy: ['guests'],
|
|
insertableBy: ['members'],
|
|
editableBy: ['members'],
|
|
group: notificationsGroup,
|
|
}
|
|
},
|
|
{
|
|
fieldName: 'notifications_replies',
|
|
fieldSchema: {
|
|
label: 'Replies to my comments',
|
|
type: Boolean,
|
|
optional: true,
|
|
defaultValue: false,
|
|
control: "checkbox",
|
|
viewableBy: ['guests'],
|
|
insertableBy: ['members'],
|
|
editableBy: ['members'],
|
|
group: notificationsGroup,
|
|
}
|
|
}
|
|
]);
|
|
}
|