2016-08-08 11:18:21 +09:00
|
|
|
|
import Telescope from 'meteor/nova:lib';
|
2016-06-23 11:40:35 +09:00
|
|
|
|
import Posts from "meteor/nova:posts";
|
2016-06-23 12:17:39 +09:00
|
|
|
|
import Comments from "meteor/nova:comments";
|
2016-06-23 15:00:58 +09:00
|
|
|
|
import Users from 'meteor/nova:users';
|
2016-06-23 11:40:35 +09:00
|
|
|
|
|
2015-05-17 15:38:02 +09:00
|
|
|
|
Users.addField({
|
2016-11-10 14:22:47 +01:00
|
|
|
|
fieldName: '__isDummy',
|
2015-05-10 14:36:47 +09:00
|
|
|
|
fieldSchema: {
|
2015-05-08 11:45:09 +09:00
|
|
|
|
type: Boolean,
|
|
|
|
|
optional: true,
|
2016-11-18 10:03:01 +01:00
|
|
|
|
hidden: true // never show this
|
2015-04-22 07:50:11 +09:00
|
|
|
|
}
|
2015-05-08 11:45:09 +09:00
|
|
|
|
});
|
2015-04-22 07:50:11 +09:00
|
|
|
|
|
2015-05-17 15:38:02 +09:00
|
|
|
|
Posts.addField({
|
2015-05-10 14:36:47 +09:00
|
|
|
|
fieldName: 'dummySlug',
|
|
|
|
|
fieldSchema: {
|
2015-05-08 11:45:09 +09:00
|
|
|
|
type: String,
|
|
|
|
|
optional: true,
|
2016-11-18 10:03:01 +01:00
|
|
|
|
hidden: true // never show this
|
2015-04-22 07:50:11 +09:00
|
|
|
|
}
|
2015-05-08 11:45:09 +09:00
|
|
|
|
});
|
2015-04-22 07:50:11 +09:00
|
|
|
|
|
2015-05-17 15:38:02 +09:00
|
|
|
|
Posts.addField({
|
2015-05-10 14:36:47 +09:00
|
|
|
|
fieldName: 'isDummy',
|
|
|
|
|
fieldSchema: {
|
2015-05-08 11:45:09 +09:00
|
|
|
|
type: Boolean,
|
|
|
|
|
optional: true,
|
2016-11-18 10:03:01 +01:00
|
|
|
|
hidden: true // never show this
|
2015-04-22 07:50:11 +09:00
|
|
|
|
}
|
2015-05-08 11:45:09 +09:00
|
|
|
|
});
|
|
|
|
|
|
2015-05-17 15:38:02 +09:00
|
|
|
|
Comments.addField({
|
2016-11-08 13:49:41 +01:00
|
|
|
|
fieldName: 'isDummy',
|
|
|
|
|
fieldSchema: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
optional: true,
|
2016-11-18 10:03:01 +01:00
|
|
|
|
hidden: true // never show this
|
2015-05-08 11:45:09 +09:00
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
/**
|
2016-11-10 14:22:47 +01:00
|
|
|
|
* @summary Copy over profile.isDummy to __isDummy on user creation
|
2015-05-08 11:45:09 +09:00
|
|
|
|
* @param {Object} user – the user object being iterated on and returned
|
|
|
|
|
* @param {Object} options – user options
|
|
|
|
|
*/
|
|
|
|
|
function copyDummyProperty (user, options) {
|
|
|
|
|
if (typeof user.profile.isDummy !== "undefined") {
|
2016-11-10 14:22:47 +01:00
|
|
|
|
user.__isDummy = user.profile.isDummy;
|
2015-05-08 11:45:09 +09:00
|
|
|
|
}
|
|
|
|
|
return user;
|
|
|
|
|
}
|
2016-11-10 22:18:36 +01:00
|
|
|
|
Telescope.callbacks.add("users.new.sync", copyDummyProperty);
|