2016-12-12 10:24:34 +09:00
|
|
|
import { Callbacks } from 'meteor/nova:core';
|
2016-03-27 18:17:20 +09:00
|
|
|
|
|
|
|
function addThumbnailClass (postClass, post) {
|
|
|
|
var thumbnailClass = !!post.thumbnailUrl ? "has-thumbnail" : "no-thumbnail";
|
|
|
|
return postClass + " " + thumbnailClass;
|
|
|
|
}
|
|
|
|
// add callback that adds "has-thumbnail" or "no-thumbnail" CSS classes
|
2016-12-12 10:24:34 +09:00
|
|
|
Callbacks.add("postClass", addThumbnailClass);
|
2016-03-27 18:17:20 +09:00
|
|
|
|
|
|
|
function checkIfPreviouslyPosted (data) {
|
|
|
|
Meteor.call("checkForDuplicates", data.url, function (error, result) {
|
|
|
|
if (error) {
|
2016-11-26 02:46:55 +08:00
|
|
|
// Messages.flash(error.reason + '. <a href="'+FlowRouter.path("postPage", {_id: error.details})+'">'+"go_to_post"+'</a>');
|
2016-03-27 18:17:20 +09:00
|
|
|
}
|
|
|
|
});
|
|
|
|
return data;
|
|
|
|
}
|
2016-12-12 10:24:34 +09:00
|
|
|
Callbacks.add("afterEmbedlyPrefill", checkIfPreviouslyPosted);
|