made privacy_allow_stranger_answers work

This commit is contained in:
nilsding 2015-01-03 22:37:10 +01:00
parent cdfe5564d6
commit 59b431513b
2 changed files with 8 additions and 1 deletions

View File

@ -18,6 +18,13 @@ class Ajax::AnswerController < ApplicationController
end end
else else
question = Question.find(params[:id]) question = Question.find(params[:id])
unless question.user.privacy_allow_stranger_answers
@status = :privacy_stronk
@message = "This user does not want other users to answer their question."
@success = false
return
end
end end
answer = nil answer = nil

View File

@ -24,7 +24,7 @@
%button#load-more-btn.btn.btn-default{type: :button, data: { current_page: @answers.current_page }} %button#load-more-btn.btn.btn-default{type: :button, data: { current_page: @answers.current_page }}
Load more Load more
- if user_signed_in? and !current_user.answered? @question and current_user != @question.user - if user_signed_in? and !current_user.answered? @question and current_user != @question.user and @question.user.privacy_allow_stranger_answers
.panel.panel-default#q-answer-box .panel.panel-default#q-answer-box
.panel-heading .panel-heading
%h3.panel-title This question was not in your inbox? Answer it here! %h3.panel-title This question was not in your inbox? Answer it here!