|
@@ -20,6 +20,16 @@ Meteor.methods({
|
|
|
title: String,
|
|
|
url: String
|
|
|
});
|
|
|
+
|
|
|
+ var postWithSameLink = Posts.findOne({ url: postAttributes.url });
|
|
|
+ if (postWithSameLink) {
|
|
|
+ // Return to skip the insert.
|
|
|
+ return {
|
|
|
+ postExists: true,
|
|
|
+ _id: postWithSameLink._id
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
var user = Meteor.user();
|
|
|
var post = _.extend(postAttributes, {
|
|
|
userId: user._id,
|