Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
206 changes: 160 additions & 46 deletions .npm/package/npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions lib/collections/anonymous-user.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import SimpleSchema from 'simpl-schema';

AnonymousUserCollection = new Mongo.Collection('commentsui-anonymoususer')

AnonymousUserCollection.allow({
Expand Down
20 changes: 15 additions & 5 deletions lib/collections/comments.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,25 @@ import comment from '../services/comment'
import { addCollectionMethods } from './CommentCollectionMethods'
import { addReplyMethods } from './ReplyCollectionMethods'

import SimpleSchema from 'simpl-schema';

export const CommentsCollection = new Mongo.Collection('comments')

SimpleSchema.extendOptions(['denyInsert']);

CommentsCollection.schemas = {}

CommentsCollection.schemas.StarRatingSchema = new SimpleSchema({
userId: {
type: String
},
rating: {
type: Number
type: SimpleSchema.Integer
}
})

const likeableConfig = {
type: [String],
type: Array,
autoValue: function() {
if (this.isInsert) {
return []
Expand Down Expand Up @@ -68,29 +72,35 @@ function getCommonCommentSchema(additionalSchemaConfig = {}) {
optional: true,
},
replies: {
type: [Object],
type: Array,
autoValue: function () {
if (this.isInsert) {
return []
}
},
optional: true
},
'replies.$': {
type: Object,
blackbox: true
},
likes: { ...likeableConfig },
'likes.$': { type: String },
dislikes: { ...likeableConfig },
'dislikes.$': { type: String },
starRatings: {
type: [CommentsCollection.schemas.StarRatingSchema],
type: Array,
autoValue: function() {
if (this.isInsert) {
return []
}
},
optional: true
},
'starRatings.$': { type: CommentsCollection.schemas.StarRatingSchema },
// general rating number that is used for sorting
ratingScore: {
type: Number,
decimal: true,
autoValue: function() {
if (this.isInsert) {
return 0
Expand Down
10 changes: 6 additions & 4 deletions package.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
Package.describe({
name: 'arkham:comments-ui',
summary: 'Simple templates for disqus-like comment functionality',
version: '1.4.3',
version: '1.4.4',
git: 'https://github.com/komentify/meteor-comments-ui.git'
});

Npm.depends({
linkifyjs: '2.0.2',
'simpl-schema': '0.3.1',
});

Package.onUse(function(api) {
// Meteor Version
api.versionsFrom('METEOR@1.4.1.2');
api.versionsFrom('METEOR@1.4.4');

// Meteor Core Dependencies
api.use(['accounts-password@1.0.1'], { weak: true });
Expand All @@ -32,8 +33,9 @@ Package.onUse(function(api) {
]);

// Atmosphere Package Dependencies
api.use([
'aldeed:collection2@2.5.0', 'aldeed:simple-schema@1.3.3', 'dburles:collection-helpers@1.0.3',
api.use([
'aldeed:schema-deny@2.0.0',
'aldeed:collection2-core@2.0.1', 'dburles:collection-helpers@1.0.3',
'momentjs:moment@2.10.6', 'reywood:publish-composite@1.4.2',
'aldeed:template-extension@4.0.0', 'barbatus:stars-rating@1.0.7'
]);
Expand Down