Merge branch 'master' into 142993479-tags

This commit is contained in:
Wyatt Johnson
2017-05-17 10:01:58 -06:00
150 changed files with 1038 additions and 1105 deletions
+11
View File
@@ -4,6 +4,8 @@ const TagLinkSchema = require('./schema/tag_link');
const uuid = require('uuid');
const COMMENT_STATUS = require('./enum/comment_status');
const EDIT_WINDOW_MS = 30 * 1000; // 30 seconds
/**
* The Mongo schema for a Comment Status.
* @type {Schema}
@@ -91,7 +93,16 @@ CommentSchema.index({
background: false
});
CommentSchema.virtual('edited').get(function() {
return this.body_history.length > 1;
});
CommentSchema.virtual('editableUntil').get(function() {
return new Date(Number(this.created_at) + EDIT_WINDOW_MS);
});
// Comment model.
const Comment = mongoose.model('Comment', CommentSchema);
module.exports = Comment;
module.exports.EDIT_WINDOW_MS = EDIT_WINDOW_MS;
+2 -1
View File
@@ -196,7 +196,8 @@ const USER_GRAPH_OPERATIONS = [
'mutation:suspendUser',
'mutation:setCommentStatus',
'mutation:addTag',
'mutation:removeTag'
'mutation:removeTag',
'mutation:editComment'
];
/**