mirror of
https://github.com/vale981/Vulcan
synced 2025-03-06 10:01:40 -05:00
Do not remove deleted comments from db
This commit is contained in:
parent
f9390a301d
commit
7dc8249910
6 changed files with 39 additions and 9 deletions
|
@ -5,6 +5,7 @@
|
|||
* Fixing avatar code.
|
||||
* Adding update prompt package.
|
||||
* Upgrading to Meteor 0.9.2.
|
||||
* Do not remove deleted comments from database, use `isDeleted` flag instead.
|
||||
|
||||
## v0.9.3 “DailyScope”
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<form class="grid-block form-horizontal">
|
||||
<div class="control-group">
|
||||
<label class="control-label">{{i18n "Comment"}}</label>
|
||||
<div class="controls" id="editor"><textarea id="body" value="" class="input-xlarge">{{body}}</textarea></div>
|
||||
<div class="controls comment-field" id="editor"><textarea id="body" value="" class="input-xlarge">{{body}}</textarea></div>
|
||||
</div>
|
||||
<div class="form-actions">
|
||||
<a class="delete-link" href="/comments/deleted">{{i18n "Delete Comment"}}</a>
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
<template name="comment_item">
|
||||
<li class="comment module comment-displayed" id="{{_id}}">
|
||||
<div class="comment-body">
|
||||
{{#if isDeleted}}
|
||||
<div class="comment-deleted">This comment has been deleted.</div>
|
||||
{{else}}
|
||||
<div class="comment-content">
|
||||
<div class="comment-actions {{#if upvoted}}upvoted{{else}}not-upvoted{{/if}} {{#if downvoted}}downvoted{{else}}not-downvoted{{/if}}">
|
||||
<a class="upvote" href="#">
|
||||
|
@ -32,14 +35,15 @@
|
|||
{{/if}}
|
||||
</div>
|
||||
</div>
|
||||
{{/if}}
|
||||
{{#if showChildComments}}
|
||||
<ul class="comment-children comment-list">
|
||||
{{#each child_comments}}
|
||||
{{#with this}}
|
||||
{{> UI.dynamic template=comment_item}}
|
||||
{{/with}}
|
||||
{{/each}}
|
||||
</ul>
|
||||
<ul class="comment-children comment-list">
|
||||
{{#each child_comments}}
|
||||
{{#with this}}
|
||||
{{> UI.dynamic template=comment_item}}
|
||||
{{/with}}
|
||||
{{/each}}
|
||||
</ul>
|
||||
{{/if}}
|
||||
</div>
|
||||
</li>
|
||||
|
|
|
@ -64,6 +64,10 @@ Comments = new Meteor.Collection("comments", {
|
|||
userId: {
|
||||
type: String, // XXX
|
||||
optional: true
|
||||
},
|
||||
isDeleted: {
|
||||
type: Boolean,
|
||||
optional: true
|
||||
}
|
||||
})
|
||||
});
|
||||
|
@ -197,7 +201,13 @@ Meteor.methods({
|
|||
});
|
||||
|
||||
// note: should we also decrease user's comment karma ?
|
||||
Comments.remove(commentId);
|
||||
// We don't actually delete the comment to avoid losing all child comments.
|
||||
// Instead, we give it a special flag
|
||||
Comments.update({_id: commentId}, {$set: {
|
||||
body: 'Deleted',
|
||||
htmlBody: 'Deleted',
|
||||
isDeleted: true
|
||||
}});
|
||||
}else{
|
||||
throwError("You don't have permission to delete this comment.");
|
||||
}
|
||||
|
|
|
@ -1073,6 +1073,14 @@ em {
|
|||
left: 20px;
|
||||
margin-left: -8px; }
|
||||
|
||||
/* line 259, ../scss/modules/_comments.scss */
|
||||
.comment-deleted {
|
||||
background: rgba(255, 255, 255, 0.6);
|
||||
border-radius: 3px;
|
||||
margin-bottom: 10px;
|
||||
padding: 10px 15px;
|
||||
color: #b3c1c6; }
|
||||
|
||||
/* line 1, ../scss/modules/_dialogs.scss */
|
||||
.dialog {
|
||||
margin-bottom: 10px; }
|
||||
|
|
|
@ -255,4 +255,11 @@
|
|||
margin-left: -8px;
|
||||
}
|
||||
}
|
||||
}
|
||||
.comment-deleted{
|
||||
background: white(0.6);
|
||||
border-radius: 3px;
|
||||
margin-bottom: 10px;
|
||||
padding: 10px 15px;
|
||||
color: $light-text;
|
||||
}
|
Loading…
Add table
Reference in a new issue