FIX: Take `enable_names` setting into account (#240)
This commit is contained in:
parent
e0cd3d11c3
commit
7b90566b05
|
@ -464,7 +464,13 @@ SQL
|
|||
nil
|
||||
end
|
||||
|
||||
postInfo[3] = SiteSetting.display_name_on_posts ? postInfo[3] : nil
|
||||
postInfo[3] = (
|
||||
if SiteSetting.enable_names && SiteSetting.display_name_on_posts
|
||||
postInfo[3]
|
||||
else
|
||||
nil
|
||||
end
|
||||
)
|
||||
postInfo
|
||||
end
|
||||
end
|
||||
|
|
|
@ -76,6 +76,12 @@ RSpec.describe TopicsController do
|
|||
|
||||
expect(response.parsed_body["accepted_answer"]["name"]).to eq(p2.user.name)
|
||||
expect(response.parsed_body["accepted_answer"]["username"]).to eq(p2.user.username)
|
||||
|
||||
# enable_names is default ON, this ensures disabling it also disables names here
|
||||
SiteSetting.enable_names = false
|
||||
get "/t/#{topic.slug}/#{topic.id}.json"
|
||||
expect(response.parsed_body["accepted_answer"]["name"]).to eq(nil)
|
||||
expect(response.parsed_body["accepted_answer"]["username"]).to eq(p2.user.username)
|
||||
end
|
||||
|
||||
it "should not include user name when site setting is disabled" do
|
||||
|
|
Loading…
Reference in New Issue