fixed fuckups (again)
This commit is contained in:
parent
ba7bd2239b
commit
a7c9181fc5
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue