if an admin deletes an answer it will not show up in the users' inbox again
This commit is contained in:
parent
6fb97c9ecc
commit
eed67aeaa2
|
@ -8,8 +8,6 @@ class Ajax::AnswerController < ApplicationController
|
||||||
|
|
||||||
answer = Answer.find(params[:answer])
|
answer = Answer.find(params[:answer])
|
||||||
|
|
||||||
puts ">>>>>>>>>>>>", privileged?.inspect
|
|
||||||
|
|
||||||
unless answer.user == current_user || privileged?
|
unless answer.user == current_user || privileged?
|
||||||
@status = :nopriv
|
@status = :nopriv
|
||||||
@message = "check yuor privlegs"
|
@message = "check yuor privlegs"
|
||||||
|
@ -18,7 +16,9 @@ class Ajax::AnswerController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
answer.user.decrement! :answered_count
|
answer.user.decrement! :answered_count
|
||||||
|
if answer.user == current_user
|
||||||
Inbox.create!(user: answer.user, question: answer.question, new: true)
|
Inbox.create!(user: answer.user, question: answer.question, new: true)
|
||||||
|
end # TODO: decide what happens with the question
|
||||||
answer.destroy
|
answer.destroy
|
||||||
|
|
||||||
@status = :okay
|
@status = :okay
|
||||||
|
|
Loading…
Reference in New Issue