mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 15:25:35 +08:00
FIX: Onebox discourse user not respecting enable names (#7245)
This commit is contained in:
parent
3f35315391
commit
5a9dd923cc
|
@ -234,11 +234,14 @@ module Oneboxer
|
||||||
username = route[:username] || ""
|
username = route[:username] || ""
|
||||||
|
|
||||||
if user = User.find_by(username_lower: username.downcase)
|
if user = User.find_by(username_lower: username.downcase)
|
||||||
|
|
||||||
|
name = user.name if SiteSetting.enable_names
|
||||||
|
|
||||||
args = {
|
args = {
|
||||||
user_id: user.id,
|
user_id: user.id,
|
||||||
username: user.username,
|
username: user.username,
|
||||||
avatar: PrettyText.avatar_img(user.avatar_template, "extra_large"),
|
avatar: PrettyText.avatar_img(user.avatar_template, "extra_large"),
|
||||||
name: user.name,
|
name: name,
|
||||||
bio: user.user_profile.bio_excerpt(230),
|
bio: user.user_profile.bio_excerpt(230),
|
||||||
location: user.user_profile.location,
|
location: user.user_profile.location,
|
||||||
joined: I18n.t('joined'),
|
joined: I18n.t('joined'),
|
||||||
|
|
|
@ -94,6 +94,15 @@ describe Oneboxer do
|
||||||
expect(preview("/u/#{user.username}")).to include(user.name)
|
expect(preview("/u/#{user.username}")).to include(user.name)
|
||||||
end
|
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
|
it "links to an upload" do
|
||||||
path = "/uploads/default/original/3X/e/8/e8fcfa624e4fb6623eea57f54941a58ba797f14d"
|
path = "/uploads/default/original/3X/e/8/e8fcfa624e4fb6623eea57f54941a58ba797f14d"
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user