2016-08-07 19:26:08 +09:00
|
|
|
import PublicationUtils from 'meteor/utilities:smart-publications';
|
|
|
|
import Users from "meteor/nova:users";
|
2016-07-27 10:38:43 +02:00
|
|
|
|
2016-08-07 19:26:08 +09:00
|
|
|
Users.addField([
|
|
|
|
{
|
|
|
|
fieldName: 'telescope.subscribedItems',
|
|
|
|
fieldSchema: {
|
|
|
|
type: Object,
|
|
|
|
optional: true,
|
|
|
|
blackbox: true,
|
2016-10-05 08:43:13 +02:00
|
|
|
form: {
|
2016-08-07 19:26:08 +09:00
|
|
|
omit: true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
fieldName: 'telescope.subscribers',
|
|
|
|
fieldSchema: {
|
|
|
|
type: [String],
|
|
|
|
optional: true,
|
2016-10-05 08:43:13 +02:00
|
|
|
form: {
|
2016-08-07 19:26:08 +09:00
|
|
|
omit: true
|
|
|
|
},
|
|
|
|
publish: true,
|
|
|
|
join: {
|
|
|
|
joinAs: "subscribersArray",
|
|
|
|
collection: () => Users
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
fieldName: 'telescope.subscriberCount',
|
|
|
|
fieldSchema: {
|
|
|
|
type: Number,
|
|
|
|
optional: true,
|
2016-10-05 08:43:13 +02:00
|
|
|
form: {
|
2016-08-07 19:26:08 +09:00
|
|
|
omit: true
|
|
|
|
}
|
2016-07-27 10:38:43 +02:00
|
|
|
}
|
|
|
|
}
|
2016-08-07 19:26:08 +09:00
|
|
|
]);
|
2016-08-14 17:59:20 +02:00
|
|
|
PublicationUtils.addToFields(Users.publishedFields.list, ["telescope.subscribedItems", "telescope.subscribers", "telescope.subscriberCount"]);
|
2016-07-27 10:38:43 +02:00
|
|
|
|
2016-08-14 17:59:20 +02:00
|
|
|
// check if nova:posts exists, if yes, add the custom fields to Posts
|
|
|
|
if (typeof Package['nova:posts'] !== "undefined") {
|
|
|
|
import Posts from 'meteor/nova:posts';
|
|
|
|
Posts.addField([
|
|
|
|
{
|
|
|
|
fieldName: 'subscribers',
|
|
|
|
fieldSchema: {
|
|
|
|
type: [String],
|
|
|
|
optional: true,
|
2016-10-05 08:43:13 +02:00
|
|
|
form: {
|
2016-08-14 17:59:20 +02:00
|
|
|
omit: true
|
|
|
|
},
|
|
|
|
publish: true,
|
|
|
|
join: {
|
|
|
|
joinAs: "subscribersArray",
|
|
|
|
collection: () => Users
|
|
|
|
}
|
2016-07-27 10:38:43 +02:00
|
|
|
}
|
2016-08-14 17:59:20 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
fieldName: 'subscriberCount',
|
|
|
|
fieldSchema: {
|
|
|
|
type: Number,
|
|
|
|
optional: true,
|
2016-10-05 08:43:13 +02:00
|
|
|
form: {
|
2016-08-14 17:59:20 +02:00
|
|
|
omit: true
|
|
|
|
}
|
2016-07-27 18:00:40 +02:00
|
|
|
}
|
2016-07-27 10:38:43 +02:00
|
|
|
}
|
2016-08-14 17:59:20 +02:00
|
|
|
]);
|
2016-07-27 10:38:43 +02:00
|
|
|
|
2016-08-14 17:59:20 +02:00
|
|
|
PublicationUtils.addToFields(Posts.publishedFields.list, ["subscribers", "subscriberCount"]);
|
|
|
|
}
|
|
|
|
|
|
|
|
// check if nova:categories exists, if yes, add the custom fields to Categories
|
|
|
|
if (typeof Package['nova:categories'] !== "undefined") {
|
|
|
|
import Categories from 'meteor/nova:categories';
|
|
|
|
Categories.addField([
|
|
|
|
{
|
|
|
|
fieldName: 'subscribers',
|
|
|
|
fieldSchema: {
|
|
|
|
type: [String],
|
|
|
|
optional: true,
|
2016-10-05 08:43:13 +02:00
|
|
|
form: {
|
2016-08-14 17:59:20 +02:00
|
|
|
omit: true
|
|
|
|
},
|
|
|
|
publish: true,
|
|
|
|
join: {
|
|
|
|
joinAs: "subscribersArray",
|
|
|
|
collection: () => Users
|
|
|
|
}
|
2016-08-12 14:33:51 +02:00
|
|
|
}
|
2016-08-14 17:59:20 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
fieldName: 'subscriberCount',
|
|
|
|
fieldSchema: {
|
|
|
|
type: Number,
|
|
|
|
optional: true,
|
2016-10-05 08:43:13 +02:00
|
|
|
form: {
|
2016-08-14 17:59:20 +02:00
|
|
|
omit: true
|
|
|
|
}
|
2016-08-12 14:33:51 +02:00
|
|
|
}
|
|
|
|
}
|
2016-08-14 17:59:20 +02:00
|
|
|
]);
|
2016-08-12 14:33:51 +02:00
|
|
|
|
2016-08-14 17:59:20 +02:00
|
|
|
PublicationUtils.addToFields(Categories.publishedFields.list, ["subscribers", "subscriberCount"]);
|
|
|
|
}
|