profile.isDummy -> isDummy; don't try to send email on dummy comments

This commit is contained in:
xavcz 2016-12-02 09:19:41 +01:00
parent 2d42bd5bf3
commit e61e009196
3 changed files with 8 additions and 8 deletions

View file

@ -129,7 +129,7 @@ Telescope.callbacks.add("comments.new.async", CommentsNewUpvoteOwnComment);
// add new comment notification callback on comment submit // add new comment notification callback on comment submit
function CommentsNewNotifications (comment) { function CommentsNewNotifications (comment) {
if (typeof Telescope.notifications !== "undefined") { if (typeof Telescope.notifications !== "undefined" && !comment.isDummy) {
// note: dummy content has disableNotifications set to true // note: dummy content has disableNotifications set to true
if(Meteor.isServer && !comment.disableNotifications){ if(Meteor.isServer && !comment.disableNotifications){

View file

@ -4,7 +4,7 @@ import Comments from "meteor/nova:comments";
import Users from 'meteor/nova:users'; import Users from 'meteor/nova:users';
Users.addField({ Users.addField({
fieldName: '__isDummy', fieldName: 'isDummy',
fieldSchema: { fieldSchema: {
type: Boolean, type: Boolean,
optional: true, optional: true,
@ -40,13 +40,13 @@ Comments.addField({
}); });
/** /**
* @summary Copy over profile.isDummy to __isDummy on user creation * @summary Copy over profile.isDummy to isDummy on user creation
* @param {Object} user the user object being iterated on and returned * @param {Object} user the user object being iterated on and returned
* @param {Object} options user options * @param {Object} options user options
*/ */
function copyDummyProperty (user, options) { function copyDummyProperty (user, options) {
if (typeof user.profile.__isDummy !== "undefined") { if (typeof user.profile.isDummy !== "undefined") {
user.__isDummy = user.profile.__isDummy; user.isDummy = user.profile.isDummy;
} }
return user; return user;
} }

View file

@ -62,21 +62,21 @@ var createDummyUsers = function () {
username: 'Bruce', username: 'Bruce',
email: 'dummyuser1@telescopeapp.org', email: 'dummyuser1@telescopeapp.org',
profile: { profile: {
__isDummy: true isDummy: true
} }
}); });
Accounts.createUser({ Accounts.createUser({
username: 'Arnold', username: 'Arnold',
email: 'dummyuser2@telescopeapp.org', email: 'dummyuser2@telescopeapp.org',
profile: { profile: {
__isDummy: true isDummy: true
} }
}); });
Accounts.createUser({ Accounts.createUser({
username: 'Julia', username: 'Julia',
email: 'dummyuser3@telescopeapp.org', email: 'dummyuser3@telescopeapp.org',
profile: { profile: {
__isDummy: true isDummy: true
} }
}); });
}; };