Fix everyone showing up as anonymous outside of moderation view
This commit is contained in:
parent
1c9f5b6f28
commit
597f8b74cb
|
@ -27,7 +27,10 @@ module ApplicationHelper::TitleMethods
|
||||||
|
|
||||||
def question_title(question)
|
def question_title(question)
|
||||||
context_user = question.answers&.first&.user if question.direct
|
context_user = question.answers&.first&.user if question.direct
|
||||||
name = user_screen_name question.user, context_user: context_user, author_identifier: question.author_identifier, url: false
|
name = user_screen_name question.user,
|
||||||
|
context_user: context_user,
|
||||||
|
author_identifier: question.author_is_anonymous ? question.author_identifier : nil,
|
||||||
|
url: false
|
||||||
generate_title name, "asked", question.content
|
generate_title name, "asked", question.content
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ module UserHelper
|
||||||
sanitize(context_user&.profile&.anon_display_name.presence || APP_CONFIG["anonymous_name"], tags: [])
|
sanitize(context_user&.profile&.anon_display_name.presence || APP_CONFIG["anonymous_name"], tags: [])
|
||||||
end
|
end
|
||||||
|
|
||||||
def anonymous?(user, anonymous)
|
def anonymous?(user, author_identifier)
|
||||||
user.nil? || anonymous
|
user.nil? || author_identifier.present?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
%h6.text-muted.media-heading.answerbox__question-user
|
%h6.text-muted.media-heading.answerbox__question-user
|
||||||
- if a.question.author_is_anonymous
|
- if a.question.author_is_anonymous
|
||||||
%i.fa.fa-user-secret{ title: t('.anon_hint') }
|
%i.fa.fa-user-secret{ title: t('.anon_hint') }
|
||||||
= raw t('views.answerbox.asked', user: user_screen_name(a.question.user, context_user: a.user, author_identifier: a.question.author_identifier), time: time_tooltip(a.question))
|
= raw t('views.answerbox.asked', user: user_screen_name(a.question.user, context_user: a.user, author_identifier: a.question.author_is_anonymous ? a.question.author_identifier: nil), time: time_tooltip(a.question))
|
||||||
- if !a.question.author_is_anonymous && !a.question.direct
|
- if !a.question.author_is_anonymous && !a.question.direct
|
||||||
·
|
·
|
||||||
%a{ href: show_user_question_path(a.question.user.screen_name, a.question.id) }
|
%a{ href: show_user_question_path(a.question.user.screen_name, a.question.id) }
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
%h6.text-muted.media-heading.answerbox__question-user
|
%h6.text-muted.media-heading.answerbox__question-user
|
||||||
- if i.question.author_is_anonymous
|
- if i.question.author_is_anonymous
|
||||||
%i.fa.fa-user-secret{ title: t('.anon_hint') }
|
%i.fa.fa-user-secret{ title: t('.anon_hint') }
|
||||||
= t(".asked_html", user: user_screen_name(i.question.user, context_user: i.user, author_identifier: i.question.author_identifier), time: time_tooltip(i.question))
|
= t(".asked_html", user: user_screen_name(i.question.user, context_user: i.user, author_identifier: i.question.author_is_anonymous ? i.question.author_identifier : nil), time: time_tooltip(i.question))
|
||||||
- if !i.question.author_is_anonymous && i.question.answer_count.positive?
|
- if !i.question.author_is_anonymous && i.question.answer_count.positive?
|
||||||
·
|
·
|
||||||
%a{ href: show_user_question_path(i.question.user.screen_name, i.question.id) }
|
%a{ href: show_user_question_path(i.question.user.screen_name, i.question.id) }
|
||||||
|
|
|
@ -26,8 +26,9 @@
|
||||||
%i.fa.fa-exclamation-triangle
|
%i.fa.fa-exclamation-triangle
|
||||||
= t 'views.actions.report'
|
= t 'views.actions.report'
|
||||||
%h6.text-muted.media-heading.answerbox__question-user
|
%h6.text-muted.media-heading.answerbox__question-user
|
||||||
|
- identifier = question.author_is_anonymous ? question.author_identifier : nil
|
||||||
- if hidden
|
- if hidden
|
||||||
= user_screen_name question.user, author_identifier: question.author_identifier, url: false
|
= user_screen_name question.user, author_identifier: identifier, url: false
|
||||||
- else
|
- else
|
||||||
= raw t('views.answerbox.asked', user: user_screen_name(question.user, author_identifier: question.author_identifier), time: time_tooltip(question))
|
= raw t('views.answerbox.asked', user: user_screen_name(question.user, author_identifier: identifier), time: time_tooltip(question))
|
||||||
.answerbox__question-text= question_markdown question.content
|
.answerbox__question-text= question_markdown question.content
|
||||||
|
|
Loading…
Reference in New Issue