mirror of
https://github.com/Retrospring/retrospring.git
synced 2024-11-20 16:19:52 +01:00
fixed fuckups (again)
This commit is contained in:
parent
ba7bd2239b
commit
a7c9181fc5
3 changed files with 7 additions and 11 deletions
|
@ -3,14 +3,6 @@ class Ajax::InboxController < ApplicationController
|
||||||
params.require :id
|
params.require :id
|
||||||
params.require :answer
|
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])
|
inbox = Inbox.find(params[:id])
|
||||||
|
|
||||||
unless current_user == inbox.user
|
unless current_user == inbox.user
|
||||||
|
@ -24,6 +16,10 @@ class Ajax::InboxController < ApplicationController
|
||||||
user: current_user,
|
user: current_user,
|
||||||
question: inbox.question)
|
question: inbox.question)
|
||||||
|
|
||||||
|
unless current_user.nil?
|
||||||
|
current_user.increment! :answered_count
|
||||||
|
end
|
||||||
|
|
||||||
Inbox.destroy inbox.id
|
Inbox.destroy inbox.id
|
||||||
|
|
||||||
@status = :okay
|
@status = :okay
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
module UserHelper
|
module UserHelper
|
||||||
# Decides what user name to show.
|
# Decides what user name to show.
|
||||||
# @return [String] The user name
|
# @return [String] The user name
|
||||||
def user_screen_name(user)
|
def user_screen_name(user, anonymous=false)
|
||||||
return APP_CONFIG['anonymous_name'] if user.nil?
|
return APP_CONFIG['anonymous_name'] if user.nil? || anonymous
|
||||||
return user.display_name unless user.display_name.blank?
|
return user.display_name unless user.display_name.blank?
|
||||||
user.screen_name
|
user.screen_name
|
||||||
end
|
end
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
.panel.inbox-box{'data-id' => i.id}
|
.panel.inbox-box{'data-id' => i.id}
|
||||||
%p
|
%p
|
||||||
%strong
|
%strong
|
||||||
= user_screen_name i.question.user
|
= user_screen_name i.question.user, i.question.author_is_anonymous
|
||||||
asked:
|
asked:
|
||||||
%p
|
%p
|
||||||
%strong
|
%strong
|
||||||
|
|
Loading…
Reference in a new issue