Vulcan/packages/vulcan-notifications/lib/custom_fields.js

75 lines
1.7 KiB
JavaScript
Raw Normal View History

2017-03-23 16:27:59 +09:00
import Users from 'meteor/vulcan:users';
2016-06-23 15:00:58 +09:00
// note: leverage weak dependencies on packages
2017-03-23 16:27:59 +09:00
const Comments = Package['vulcan:comments'] ? Package['vulcan: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,
}
}
]);
2016-05-09 13:32:34 +09:00
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,
}
}
]);
}