fixed fuckups (again)

This commit is contained in:
nilsding 2014-11-11 18:09:28 +01:00
parent ba7bd2239b
commit a7c9181fc5
3 changed files with 7 additions and 11 deletions

View File

@ -3,14 +3,6 @@ class Ajax::InboxController < ApplicationController
params.require :id
params.require :answer
question = Question.create!(content: params[:question],
author_is_anonymous: params[:anonymousQuestion],
user: current_user)
unless current_user.nil?
current_user.increment! :answered_count
end
inbox = Inbox.find(params[:id])
unless current_user == inbox.user
@ -24,6 +16,10 @@ class Ajax::InboxController < ApplicationController
user: current_user,
question: inbox.question)
unless current_user.nil?
current_user.increment! :answered_count
end
Inbox.destroy inbox.id
@status = :okay

View File

@ -1,8 +1,8 @@
module UserHelper
# Decides what user name to show.
# @return [String] The user name
def user_screen_name(user)
return APP_CONFIG['anonymous_name'] if user.nil?
def user_screen_name(user, anonymous=false)
return APP_CONFIG['anonymous_name'] if user.nil? || anonymous
return user.display_name unless user.display_name.blank?
user.screen_name
end

View File

@ -3,7 +3,7 @@
.panel.inbox-box{'data-id' => i.id}
%p
%strong
= user_screen_name i.question.user
= user_screen_name i.question.user, i.question.author_is_anonymous
asked:
%p
%strong