FIX: Onebox discourse user not respecting enable names (#7245)

This commit is contained in:
Tim Lange 2019-03-25 08:20:14 +01:00 committed by Arpit Jalan
parent 3f35315391
commit 5a9dd923cc
2 changed files with 13 additions and 1 deletions

View File

@ -234,11 +234,14 @@ module Oneboxer
username = route[:username] || ""
if user = User.find_by(username_lower: username.downcase)
name = user.name if SiteSetting.enable_names
args = {
user_id: user.id,
username: user.username,
avatar: PrettyText.avatar_img(user.avatar_template, "extra_large"),
name: user.name,
name: name,
bio: user.user_profile.bio_excerpt(230),
location: user.user_profile.location,
joined: I18n.t('joined'),

View File

@ -94,6 +94,15 @@ describe Oneboxer do
expect(preview("/u/#{user.username}")).to include(user.name)
end
it "should respect enable_names site setting" do
user = Fabricate(:user)
SiteSetting.enable_names = true
expect(preview("/u/#{user.username}")).to include(user.name)
SiteSetting.enable_names = false
expect(preview("/u/#{user.username}")).not_to include(user.name)
end
it "links to an upload" do
path = "/uploads/default/original/3X/e/8/e8fcfa624e4fb6623eea57f54941a58ba797f14d"