mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-23 23:58:31 -05:00
fix post trashing
This commit is contained in:
parent
a232e77fa8
commit
20493106cd
2 changed files with 3 additions and 3 deletions
|
@ -432,7 +432,7 @@ Discourse.TopicController = Discourse.ObjectController.extend({
|
||||||
|
|
||||||
deletePost: function(post) {
|
deletePost: function(post) {
|
||||||
// Moderators can delete posts. Regular users can only create a deleted at message.
|
// Moderators can delete posts. Regular users can only create a deleted at message.
|
||||||
if (Discourse.get('currentUser.moderator')) {
|
if (Discourse.get('currentUser.staff')) {
|
||||||
post.set('deleted_at', new Date());
|
post.set('deleted_at', new Date());
|
||||||
} else {
|
} else {
|
||||||
post.set('cooked', Discourse.Markdown.cook(Em.String.i18n("post.deleted_by_author")));
|
post.set('cooked', Discourse.Markdown.cook(Em.String.i18n("post.deleted_by_author")));
|
||||||
|
|
|
@ -186,8 +186,8 @@ class PostsController < ApplicationController
|
||||||
def find_post_from_params
|
def find_post_from_params
|
||||||
finder = Post.where(id: params[:id] || params[:post_id])
|
finder = Post.where(id: params[:id] || params[:post_id])
|
||||||
|
|
||||||
# Include deleted posts if the user is a moderator
|
# Include deleted posts if the user is staff
|
||||||
finder = finder.with_deleted if current_user.try(:moderator?)
|
finder = finder.with_deleted if current_user.try(:staff?)
|
||||||
|
|
||||||
post = finder.first
|
post = finder.first
|
||||||
guardian.ensure_can_see!(post)
|
guardian.ensure_can_see!(post)
|
||||||
|
|
Loading…
Reference in a new issue