mirror of
https://github.com/Retrospring/retrospring.git
synced 2025-01-18 20:26:01 +01:00
Appease the dog overlords
This commit is contained in:
parent
0196a9ea10
commit
15052e203e
4 changed files with 11 additions and 3 deletions
|
@ -3,7 +3,7 @@ require 'cgi'
|
||||||
module SocialHelper::TumblrMethods
|
module SocialHelper::TumblrMethods
|
||||||
def tumblr_title(answer)
|
def tumblr_title(answer)
|
||||||
asker = if answer.question.author_is_anonymous?
|
asker = if answer.question.author_is_anonymous?
|
||||||
answer.user.profile.anon_display_name.presence || APP_CONFIG['anonymous_name']
|
answer.user.profile.anon_display_name.presence || APP_CONFIG["anonymous_name"]
|
||||||
else
|
else
|
||||||
answer.question.user.profile.safe_name
|
answer.question.user.profile.safe_name
|
||||||
end
|
end
|
||||||
|
|
|
@ -3,7 +3,7 @@ module UserHelper
|
||||||
# @param context_user [User] the user whose the profile preferences should be applied
|
# @param context_user [User] the user whose the profile preferences should be applied
|
||||||
# @return [String] The user name
|
# @return [String] The user name
|
||||||
def user_screen_name(user, context_user: nil, anonymous: false, url: true, link_only: false)
|
def user_screen_name(user, context_user: nil, anonymous: false, url: true, link_only: false)
|
||||||
return context_user&.profile&.anon_display_name.presence || APP_CONFIG['anonymous_name'] if user.nil? || anonymous
|
return anonymous_name(context_user) if user.nil? || anonymous
|
||||||
|
|
||||||
name = user.profile.display_name.presence || user.screen_name
|
name = user.profile.display_name.presence || user.screen_name
|
||||||
if url
|
if url
|
||||||
|
@ -14,4 +14,10 @@ module UserHelper
|
||||||
end
|
end
|
||||||
name.strip
|
name.strip
|
||||||
end
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def anonymous_name(context_user)
|
||||||
|
context_user&.profile&.anon_display_name.presence || APP_CONFIG["anonymous_name"]
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
|
|
||||||
= f.text_field :motivation_header
|
= f.text_field :motivation_header
|
||||||
|
|
||||||
= f.text_field :anon_display_name, placeholder: APP_CONFIG[:anonymous_name]
|
= f.text_field :anon_display_name, placeholder: APP_CONFIG["anonymous_name"]
|
||||||
|
|
||||||
= f.text_field :website
|
= f.text_field :website
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class AddAnonDisplayNameToProfiles < ActiveRecord::Migration[6.1]
|
class AddAnonDisplayNameToProfiles < ActiveRecord::Migration[6.1]
|
||||||
def change
|
def change
|
||||||
add_column :profiles, :anon_display_name, :string
|
add_column :profiles, :anon_display_name, :string
|
||||||
|
|
Loading…
Reference in a new issue