add notification settings, fix comment edit permissions

This commit is contained in:
jomo
2014-06-17 21:19:15 +02:00
parent 2564ea1aa6
commit 8a7d719920
9 changed files with 114 additions and 38 deletions

View File

@@ -4,7 +4,7 @@ class CommentsController < ApplicationController
def edit
@comment = Comment.find(params[:id])
if mod? || @comment.author.is?(current_user)
if (mod? && current_user.role >= @comment.author.role) || @comment.author.is?(current_user)
else
flash[:alert] = "You are not allowed to edit this comment"
redirect_to @comment.blogpost
@@ -49,7 +49,7 @@ class CommentsController < ApplicationController
def destroy
@comment = Comment.find(params[:id])
if mod? || @comment.author.is?(current_user)
if (mod? && current_user.role >= @comment.author.role) || @comment.author.is?(current_user)
if @comment.destroy
flash[:notice] = "Comment deleted!"
else