Merge branch 'Discordius-voting' into devel

This commit is contained in:
SachaG 2017-03-12 10:25:51 +09:00
commit b649b52a37
31 changed files with 163 additions and 143 deletions

View file

@ -57,30 +57,30 @@ modules@0.7.9
modules-runtime@0.7.9
mongo@1.1.15
mongo-id@1.0.6
nova:api@1.1.0
nova:base-components@1.1.0
nova:base-styles@1.1.0
nova:categories@1.1.0
nova:comments@1.1.0
nova:core@1.1.0
nova:debug@1.1.0
nova:email@1.1.0
nova:email-templates@1.1.0
nova:embedly@1.1.0
nova:events@1.1.0
nova:forms@1.1.0
nova:getting-started@1.1.0
nova:i18n-en-us@1.1.0
nova:lib@1.1.0
nova:newsletter@1.1.0
nova:notifications@1.1.0
nova:posts@1.1.0
nova:routing@1.1.0
nova:rss@1.1.0
nova:search@1.1.0
nova:subscribe@1.1.0
nova:users@1.1.0
nova:voting@1.1.0
nova:api@1.2.0
nova:base-components@1.2.0
nova:base-styles@1.2.0
nova:categories@1.2.0
nova:comments@1.2.0
nova:core@1.2.0
nova:debug@1.2.0
nova:email@1.2.0
nova:email-templates@1.2.0
nova:embedly@1.2.0
nova:events@1.2.0
nova:forms@1.2.0
nova:getting-started@1.2.0
nova:i18n-en-us@1.2.0
nova:lib@1.2.0
nova:newsletter@1.2.0
nova:notifications@1.2.0
nova:posts@1.2.0
nova:routing@1.2.0
nova:rss@1.2.0
nova:search@1.2.0
nova:subscribe@1.2.0
nova:users@1.2.0
nova:voting@1.2.0
npm-bcrypt@0.9.2
npm-mongo@2.2.16_1
observe-sequence@1.0.15

View file

@ -1,6 +1,6 @@
{
"name": "Nova",
"version": "1.1.0",
"version": "1.2.0",
"engines": {
"npm": "^3.0"
},
@ -11,7 +11,7 @@
},
"dependencies": {
"analytics-node": "^2.1.1",
"apollo-client": "^0.8.1",
"apollo-client": "^0.10.1",
"babel-runtime": "^6.18.0",
"bcrypt": "^0.8.7",
"body-parser": "^1.15.2",
@ -23,12 +23,11 @@
"express": "^4.14.0",
"formsy-react": "^0.18.1",
"formsy-react-components": "^0.8.1",
"graphql": "^0.8.2",
"graphql": "^0.9.1",
"graphql-date": "^1.0.2",
"graphql-server-express": "^0.4.4",
"graphql-subscriptions": "^0.2.1",
"graphql-tag": "^1.2.1",
"graphql-tools": "^0.9.0",
"graphql-server-express": "^0.6.0",
"graphql-tag": "^1.2.4",
"graphql-tools": "^0.10.1",
"graphql-type-json": "^0.1.4",
"handlebars": "^4.0.5",
"history": "^3.0.0",
@ -47,7 +46,7 @@
"optics-agent": "^1.0.5",
"react": "^15.4.1",
"react-addons-pure-render-mixin": "^15.4.1",
"react-apollo": "^0.9.0",
"react-apollo": "^0.13.3",
"react-bootstrap": "^0.30.7",
"react-bootstrap-datetimepicker": "0.0.22",
"react-cookie": "^0.4.6",

View file

@ -1,7 +1,7 @@
Package.describe({
name: "nova:api",
summary: "Telescope API package",
version: "1.1.0",
version: "1.2.0",
git: "https://github.com/TelescopeJS/Telescope.git"
});
@ -9,7 +9,7 @@ Package.onUse(function (api) {
api.versionsFrom(['METEOR@1.0']);
api.use(['nova:core@1.1.0']);
api.use(['nova:core@1.2.0']);
api.mainModule("lib/server.js", "server");
// api.mainModule("lib/client.js", "client");

View file

@ -1,7 +1,7 @@
Package.describe({
name: "nova:base-components",
summary: "Telescope components package",
version: "1.1.0",
version: "1.2.0",
git: "https://github.com/TelescopeJS/Telescope.git"
});
@ -11,11 +11,11 @@ Package.onUse(function (api) {
api.use([
// Nova packages
'nova:core@1.1.0',
'nova:posts@1.1.0',
'nova:users@1.1.0',
'nova:comments@1.1.0',
'nova:voting@1.1.0',
'nova:core@1.2.0',
'nova:posts@1.2.0',
'nova:users@1.2.0',
'nova:comments@1.2.0',
'nova:voting@1.2.0',
// third-party packages
'fortawesome:fontawesome@4.5.0',

View file

@ -1,7 +1,7 @@
Package.describe({
name: "nova:base-styles",
summary: "Nova basic styles package",
version: "1.1.0",
version: "1.2.0",
git: "https://github.com/TelescopeJS/Telescope.git"
});
@ -10,7 +10,7 @@ Package.onUse(function (api) {
api.versionsFrom(['METEOR@1.0']);
api.use([
'nova:core@1.1.0',
'nova:core@1.2.0',
'fourseven:scss',
]);

View file

@ -1,7 +1,7 @@
Package.describe({
name: "nova:categories",
summary: "Telescope tags package",
version: "1.1.0",
version: "1.2.0",
git: "https://github.com/TelescopeJS/telescope-tags.git"
});
@ -10,9 +10,9 @@ Package.onUse(function (api) {
api.versionsFrom("METEOR@1.0");
api.use([
'nova:core@1.1.0',
'nova:posts@1.1.0',
'nova:users@1.1.0'
'nova:core@1.2.0',
'nova:posts@1.2.0',
'nova:users@1.2.0'
]);
api.mainModule("lib/server.js", "server");

View file

@ -1,7 +1,7 @@
Package.describe({
name: 'nova:cloudinary',
summary: 'Telescope file upload package.',
version: "1.1.0",
version: "1.2.0",
git: "https://github.com/TelescopeJS/Telescope.git"
});
@ -10,8 +10,8 @@ Package.onUse(function (api) {
api.versionsFrom(['METEOR@1.0']);
api.use([
'nova:posts@1.1.0',
'nova:core@1.1.0'
'nova:posts@1.2.0',
'nova:core@1.2.0'
]);
api.addFiles([

View file

@ -1,7 +1,7 @@
Package.describe({
name: "nova:comments",
summary: "Telescope comments package",
version: "1.1.0",
version: "1.2.0",
git: "https://github.com/TelescopeJS/Telescope.git"
});
@ -10,9 +10,9 @@ Package.onUse(function (api) {
api.versionsFrom(['METEOR@1.0']);
api.use([
'nova:core@1.1.0',
'nova:posts@1.1.0',
'nova:users@1.1.0'
'nova:core@1.2.0',
'nova:posts@1.2.0',
'nova:users@1.2.0'
]);
api.mainModule("lib/server.js", "server");

View file

@ -1,7 +1,7 @@
Package.describe({
name: "nova:core",
summary: "Telescope core package",
version: "1.1.0",
version: "1.2.0",
git: "https://github.com/TelescopeJS/Telescope.git"
});
@ -10,12 +10,12 @@ Package.onUse(function(api) {
api.versionsFrom("METEOR@1.0");
api.use([
'nova:lib@1.1.0',
'nova:users@1.1.0',
'nova:lib@1.2.0',
'nova:users@1.2.0',
]);
api.imply([
'nova:lib@1.1.0'
'nova:lib@1.2.0'
]);
api.mainModule('lib/server/main.js', 'server');

View file

@ -1,7 +1,7 @@
Package.describe({
name: "nova:debug",
summary: "Telescope debug package",
version: "1.1.0",
version: "1.2.0",
git: "https://github.com/TelescopeJS/Telescope.git"
});
@ -15,11 +15,11 @@ Package.onUse(function (api) {
// Nova packages
'nova:core@1.1.0',
'nova:posts@1.1.0',
'nova:users@1.1.0',
'nova:email@1.1.0',
'nova:comments@1.1.0'
'nova:core@1.2.0',
'nova:posts@1.2.0',
'nova:users@1.2.0',
'nova:email@1.2.0',
'nova:comments@1.2.0'
]);

View file

@ -1,7 +1,7 @@
Package.describe({
name: "nova:email-templates",
summary: "Telescope email templates package",
version: "1.1.0",
version: "1.2.0",
git: "https://github.com/TelescopeJS/Telescope.git"
});
@ -10,11 +10,11 @@ Package.onUse(function (api) {
api.versionsFrom(['METEOR@1.0']);
api.use([
'nova:core@1.1.0',
'nova:posts@1.1.0',
'nova:users@1.1.0',
'nova:comments@1.1.0',
'nova:email@1.1.0'
'nova:core@1.2.0',
'nova:posts@1.2.0',
'nova:users@1.2.0',
'nova:comments@1.2.0',
'nova:email@1.2.0'
]);
api.addFiles([

View file

@ -1,7 +1,7 @@
Package.describe({
name: "nova:email",
summary: "Telescope email package",
version: "1.1.0",
version: "1.2.0",
git: "https://github.com/TelescopeJS/Telescope.git"
});
@ -10,7 +10,7 @@ Package.onUse(function (api) {
api.versionsFrom(['METEOR@1.0']);
api.use([
'nova:lib@1.1.0'
'nova:lib@1.2.0'
]);
api.mainModule("lib/server.js", "server");

View file

@ -1,7 +1,7 @@
Package.describe({
name: "nova:embedly",
summary: "Telescope Embedly module package",
version: "1.1.0",
version: "1.2.0",
git: 'https://github.com/TelescopeJS/telescope-embedly.git'
});
@ -10,9 +10,9 @@ Package.onUse( function(api) {
api.versionsFrom("METEOR@1.0");
api.use([
'nova:core@1.1.0',
'nova:posts@1.1.0',
'nova:users@1.1.0',
'nova:core@1.2.0',
'nova:posts@1.2.0',
'nova:users@1.2.0',
'fourseven:scss'
]);

View file

@ -1,7 +1,7 @@
Package.describe({
name: "nova:events",
summary: "Telescope event tracking package",
version: "1.1.0",
version: "1.2.0",
git: "https://github.com/TelescopeJS/Telescope.git"
});
@ -10,8 +10,8 @@ Package.onUse(function(api) {
api.versionsFrom("METEOR@1.0");
api.use([
'nova:core@1.1.0',
'nova:posts@1.1.0', // needed to track posts click
'nova:core@1.2.0',
'nova:posts@1.2.0', // needed to track posts click
]);
api.mainModule("lib/server.js", "server");

View file

@ -1,7 +1,7 @@
Package.describe({
name: "nova:forms-tags",
summary: "Telescope tag input package",
version: "1.1.0",
version: "1.2.0",
git: 'https://github.com/TelescopeJS/Telescope.git'
});
@ -10,8 +10,8 @@ Package.onUse( function(api) {
api.versionsFrom("METEOR@1.0");
api.use([
'nova:core@1.1.0',
'nova:forms@1.1.0'
'nova:core@1.2.0',
'nova:forms@1.2.0'
]);
api.mainModule("lib/export.js", ["client", "server"]);

View file

@ -1,7 +1,7 @@
Package.describe({
name: "nova:forms",
summary: "Form containers for React",
version: "1.1.0",
version: "1.2.0",
git: "https://github.com/meteor-utilities/react-form-containers.git"
});
@ -10,8 +10,8 @@ Package.onUse(function(api) {
api.versionsFrom("METEOR@1.3");
api.use([
'nova:core@1.1.0',
'nova:users@1.1.0',
'nova:core@1.2.0',
'nova:users@1.2.0',
'ecmascript',
'check',

View file

@ -1,7 +1,7 @@
Package.describe({
name: "nova:getting-started",
summary: "Getting started posts",
version: "1.1.0",
version: "1.2.0",
git: "https://github.com/TelescopeJS/telescope-getting-started.git"
});
@ -14,11 +14,11 @@ Package.onUse(function (api) {
api.versionsFrom(['METEOR@1.0']);
api.use([
'nova:core@1.1.0',
'nova:posts@1.1.0',
'nova:comments@1.1.0',
'nova:users@1.1.0',
'nova:events@1.1.0',
'nova:core@1.2.0',
'nova:posts@1.2.0',
'nova:comments@1.2.0',
'nova:users@1.2.0',
'nova:events@1.2.0',
]);
// both

View file

@ -1,7 +1,7 @@
Package.describe({
name: "nova:i18n-en-us",
summary: "Telescope i18n package (en_US)",
version: "1.1.0",
version: "1.2.0",
git: "https://github.com/TelescopeJS/Telescope.git"
});
@ -10,7 +10,7 @@ Package.onUse(function (api) {
api.versionsFrom("METEOR@1.0");
api.use([
'nova:core@1.1.0'
'nova:core@1.2.0'
]);
api.addFiles([

View file

@ -1,7 +1,7 @@
Package.describe({
name: "nova:kadira",
summary: "Telescope Kadira package",
version: "1.1.0",
version: "1.2.0",
git: "https://github.com/TelescopeJS/Telescope.git"
});
@ -10,7 +10,7 @@ Package.onUse(function (api) {
api.versionsFrom(['METEOR@1.0']);
api.use([
'nova:core@1.1.0',
'nova:core@1.2.0',
'meteorhacks:kadira@2.30.0',
'kadira:debug@3.2.2',
'meteorhacks:kadira-profiler@1.2.1'

View file

@ -1,7 +1,7 @@
Package.describe({
name: 'nova:lib',
summary: 'Telescope libraries.',
version: "1.1.0",
version: "1.2.0",
git: "https://github.com/TelescopeJS/Telescope.git"
});

View file

@ -1,7 +1,7 @@
Package.describe({
name: "nova:newsletter",
summary: "Telescope email newsletter package",
version: "1.1.0",
version: "1.2.0",
git: "https://github.com/TelescopeJS/telescope-newsletter.git"
});
@ -10,12 +10,12 @@ Package.onUse(function (api) {
api.versionsFrom("METEOR@1.0");
api.use([
'nova:core@1.1.0',
'nova:posts@1.1.0',
'nova:comments@1.1.0',
'nova:users@1.1.0',
'nova:categories@1.1.0',
'nova:email@1.1.0'
'nova:core@1.2.0',
'nova:posts@1.2.0',
'nova:comments@1.2.0',
'nova:users@1.2.0',
'nova:categories@1.2.0',
'nova:email@1.2.0'
]);
api.mainModule('lib/server.js', 'server');

View file

@ -1,7 +1,7 @@
Package.describe({
name: "nova:notifications",
summary: "Telescope notifications package",
version: "1.1.0",
version: "1.2.0",
git: "https://github.com/TelescopeJS/telescope-notifications.git"
});
@ -10,14 +10,14 @@ Package.onUse(function (api) {
api.versionsFrom("METEOR@1.0");
api.use([
'nova:core@1.1.0',
'nova:email@1.1.0',
'nova:users@1.1.0'
'nova:core@1.2.0',
'nova:email@1.2.0',
'nova:users@1.2.0'
]);
api.use([
'nova:posts@1.1.0',
'nova:comments@1.1.0',
'nova:posts@1.2.0',
'nova:comments@1.2.0',
], {weak: true});
api.mainModule('lib/modules.js', ['client', 'server']);

View file

@ -1,7 +1,7 @@
Package.describe({
name: "nova:posts",
summary: "Telescope posts package",
version: "1.1.0",
version: "1.2.0",
git: "https://github.com/TelescopeJS/telescope-posts.git"
});
@ -10,8 +10,8 @@ Package.onUse(function (api) {
api.versionsFrom(['METEOR@1.0']);
api.use([
'nova:core@1.1.0',
'nova:users@1.1.0',
'nova:core@1.2.0',
'nova:users@1.2.0',
]);
api.mainModule("lib/server.js", "server");

View file

@ -1,7 +1,7 @@
Package.describe({
name: "nova:routing",
summary: "Nova router package",
version: "1.1.0",
version: "1.2.0",
git: "https://github.com/TelescopeJS/Telescope.git"
});
@ -11,7 +11,7 @@ Package.onUse(function (api) {
api.use([
// Nova packages
'nova:core@1.1.0',
'nova:core@1.2.0',
]);
api.mainModule('lib/server/main.js', 'server');

View file

@ -1,7 +1,7 @@
Package.describe({
name: "nova:rss",
summary: "Telescope RSS package",
version: "1.1.0",
version: "1.2.0",
git: "https://github.com/TelescopeJS/telescope-rss.git"
});
@ -9,7 +9,7 @@ Npm.depends({rss: "1.1.1"});
Package.onUse(function (api) {
api.use(['nova:core@1.1.0']);
api.use(['nova:core@1.2.0']);
api.addFiles(['lib/headtags.js'], ['client', 'server']);

View file

@ -1,7 +1,7 @@
Package.describe({
name: "nova:search",
summary: "Telescope search package",
version: "1.1.0",
version: "1.2.0",
git: "https://github.com/TelescopeJS/telescope-pages.git"
});
@ -9,7 +9,7 @@ Package.onUse(function (api) {
api.versionsFrom("METEOR@1.0");
api.use(['nova:core@1.1.0']);
api.use(['nova:core@1.2.0']);
api.addFiles([
'lib/parameters.js',

View file

@ -1,7 +1,7 @@
Package.describe({
name: "nova:subscribe",
summary: "Subscribe to posts, users, etc. to be notified of new activity",
version: "1.1.0",
version: "1.2.0",
git: "https://github.com/TelescopeJS/telescope-subscribe-to-posts.git"
});
@ -11,16 +11,16 @@ Package.onUse(function (api) {
api.versionsFrom("METEOR@1.0");
api.use([
'nova:core@1.1.0',
'nova:users@1.1.0', // this dep is needed to check users permissions
'nova:notifications@1.1.0',
'nova:core@1.2.0',
'nova:users@1.2.0', // this dep is needed to check users permissions
'nova:notifications@1.2.0',
// dependencies on posts, categories are done with nested imports to reduce explicit dependencies
]);
api.use([
'nova:posts@1.1.0',
'nova:comments@1.1.0',
'nova:categories@1.1.0',
'nova:posts@1.2.0',
'nova:comments@1.2.0',
'nova:categories@1.2.0',
], {weak: true});
api.mainModule("lib/modules.js", ["client"]);

View file

@ -1,7 +1,7 @@
Package.describe({
name: 'nova:users',
summary: 'Telescope permissions.',
version: "1.1.0",
version: "1.2.0",
git: "https://github.com/TelescopeJS/Telescope.git"
});
@ -10,7 +10,7 @@ Package.onUse(function (api) {
api.versionsFrom(['METEOR@1.0']);
api.use([
'nova:lib@1.1.0'
'nova:lib@1.2.0'
]);
api.mainModule("lib/server.js", "server");

View file

@ -47,8 +47,8 @@ export const operateOnItem = function (collection, originalItem, user, operation
// make sure item and user are defined, and user can perform the operation
if (
!item ||
!user ||
!canDo ||
!user ||
!canDo ||
operation === "upvote" && hasUpvotedItem ||
operation === "downvote" && hasDownvotedItem ||
operation === "cancelUpvote" && !hasUpvotedItem ||
@ -58,16 +58,16 @@ export const operateOnItem = function (collection, originalItem, user, operation
}
// ------------------------------ Sync Callbacks ------------------------------ //
item = runCallbacks(operation, item, user, operation, isClient);
/*
voters arrays have different structures on client and server:
- client: [{__typename: "User", _id: 'foo123'}]
- server: ['foo123']
*/
const voter = isClient ? {__typename: "User", _id: user._id} : user._id;
@ -77,7 +77,7 @@ export const operateOnItem = function (collection, originalItem, user, operation
case "upvote":
if (hasDownvotedItem) {
operateOnItem(collection, item, user, "cancelDownvote", isClient);
item = operateOnItem(collection, item, user, "cancelDownvote", isClient);
}
item = update(item, {
@ -85,12 +85,12 @@ export const operateOnItem = function (collection, originalItem, user, operation
upvotes: {$set: item.upvotes + 1},
baseScore: {$set: item.baseScore + votePower},
});
break;
case "downvote":
if (hasUpvotedItem) {
operateOnItem(collection, item, user, "cancelUpvote", isClient);
item = operateOnItem(collection, item, user, "cancelUpvote", isClient);
}
item = update(item, {
@ -98,7 +98,7 @@ export const operateOnItem = function (collection, originalItem, user, operation
downvotes: {$set: item.downvotes + 1},
baseScore: {$set: item.baseScore - votePower},
});
break;
case "cancelUpvote":
@ -113,10 +113,10 @@ export const operateOnItem = function (collection, originalItem, user, operation
item = update(item, {
downvoters: {$set: item.downvoters.filter(filterFunction)},
downvotes: {$set: item.upvotes - 1},
downvotes: {$set: item.downvotes - 1},
baseScore: {$set: item.baseScore + votePower},
});
break;
}
@ -137,7 +137,7 @@ export const mutateItem = function (collection, originalItem, user, operation) {
collection.update({_id: newItem._id}, newItem, {bypassCollection2:true});
// --------------------- Server-Side Async Callbacks --------------------- //
runCallbacksAsync(operation+".async", newItem, user, collection, operation);
runCallbacksAsync(operation+".async", newItem, user, collection, operation);
return newItem;
}

View file

@ -1,7 +1,7 @@
Package.describe({
name: "nova:voting",
summary: "Telescope scoring package.",
version: "1.1.0",
version: "1.2.0",
git: "https://github.com/TelescopeJS/Telescope.git"
});
@ -9,11 +9,11 @@ Package.onUse(function (api) {
api.versionsFrom("METEOR@1.0");
api.use(['nova:core@1.1.0']);
api.use(['nova:core@1.2.0']);
api.use([
'nova:posts@1.1.0',
'nova:comments@1.1.0'
'nova:posts@1.2.0',
'nova:comments@1.2.0'
], ['client', 'server']);
api.mainModule("lib/server.js", "server");

View file

@ -12,6 +12,27 @@ else
reset=""
fi
command -v meteor >/dev/null 2>&1 || {
echo "Telescope requires Meteor but it's not installed. Trying to Install..." >&2;
if [ "$(uname)" == "Darwin" ]; then
# Mac OS platform
echo "🔭 ${bold}${purple}Good news you have a Mac and we will install it now! ${reset}";
curl https://install.meteor.com/ | sh;
elif [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then
# GNU/Linux platform
echo "🔭 ${bold}${purple}Good news you are on GNU/Linux platform and we will install Meteor now! ${reset}";
curl https://install.meteor.com/ | sh;
elif [ "$(expr substr $(uname -s) 1 10)" == "MINGW32_NT" ]; then
# Windows NT platform
echo "🔭 ${bold}${purple}Oh no! you are on a Windows platform and you will need to install Meteor Manually! ${reset}";
echo "📖 ${blue}Meteor for Windows is available at: ${purple}https://install.meteor.com/windows";
exit;
fi
}
test -f settings.json || (echo "🛠 ${blue}Creating your own settings.json file...\n"; cp sample_settings.json settings.json;)
echo "🔭 ${bold}${purple}Happy hacking with Telescope Nova!${reset}";