Merge branch 'unblock' of https://github.com/queso/Telescope into queso-unblock

This commit is contained in:
Sacha Greif 2015-12-30 15:26:42 +09:00
commit 155c1157e9
4 changed files with 24 additions and 2 deletions

View file

@ -184,6 +184,9 @@ Meteor.methods({
post.userId = user._id; post.userId = user._id;
} }
post.user_ip = this.connection.clientAddress;
post.user_agent = this.connection.httpHeaders["user-agent"];
return Posts.submit(post); return Posts.submit(post);
}, },

View file

@ -201,6 +201,21 @@ Posts.schema = new SimpleSchema({
type: Boolean, type: Boolean,
optional: true optional: true
}, },
/**
Save info for later spam checking on a post. We will use this for the akismet package
*/
user_ip: {
type: String,
optional: true
},
user_agent: {
type: String,
optional: true
},
referrer: {
type: String,
optional: true
},
/** /**
The post author's name The post author's name
*/ */

View file

@ -3,7 +3,7 @@ Posts._ensureIndex({"status": 1, "postedAt": 1});
// Publish a list of posts // Publish a list of posts
Meteor.publish('postsList', function(terms) { Meteor.publish('postsList', function(terms) {
this.unblock();
terms.userId = this.userId; // add userId to terms terms.userId = this.userId; // add userId to terms
if(Users.can.viewById(this.userId)){ if(Users.can.viewById(this.userId)){
@ -20,6 +20,7 @@ Meteor.publish('postsList', function(terms) {
Meteor.publish('postsListUsers', function(terms) { Meteor.publish('postsListUsers', function(terms) {
this.unblock();
terms.userId = this.userId; // add userId to terms terms.userId = this.userId; // add userId to terms
if(Users.can.viewById(this.userId)){ if(Users.can.viewById(this.userId)){
@ -44,6 +45,7 @@ Meteor.publish('postsListUsers', function(terms) {
Meteor.publish('singlePost', function(postId) { Meteor.publish('singlePost', function(postId) {
check(postId, String); check(postId, String);
this.unblock();
if (Users.can.viewById(this.userId)){ if (Users.can.viewById(this.userId)){
return Posts.find(postId); return Posts.find(postId);
@ -56,6 +58,7 @@ Meteor.publish('singlePost', function(postId) {
Meteor.publish('postUsers', function(postId) { Meteor.publish('postUsers', function(postId) {
check(postId, String); check(postId, String);
this.unblock();
if (Users.can.viewById(this.userId)){ if (Users.can.viewById(this.userId)){
// publish post author and post commenters // publish post author and post commenters

View file

@ -14,7 +14,8 @@ Package.onUse(function (api) {
'telescope:i18n@0.25.6', 'telescope:i18n@0.25.6',
'telescope:settings@0.25.6', 'telescope:settings@0.25.6',
'telescope:users@0.25.6', 'telescope:users@0.25.6',
'telescope:comments@0.25.6' 'telescope:comments@0.25.6',
'meteorhacks:unblock'
]); ]);
api.addFiles([ api.addFiles([