diff --git a/app/assets/javascripts/discourse/widgets/poster-name.js.es6 b/app/assets/javascripts/discourse/widgets/poster-name.js.es6 index 643b5e8a8..d9fb725c5 100644 --- a/app/assets/javascripts/discourse/widgets/poster-name.js.es6 +++ b/app/assets/javascripts/discourse/widgets/poster-name.js.es6 @@ -27,7 +27,7 @@ export default createWidget('poster-name', { html(attrs) { const username = attrs.username; const name = attrs.name; - const nameFirst = !this.siteSettings.prioritize_username_in_ux && name && name.length > 0; + const nameFirst = this.siteSettings.display_name_on_posts && !this.siteSettings.prioritize_username_in_ux && name && name.length > 0; const classNames = nameFirst ? ['first','full-name'] : ['first','username']; if (attrs.staff) { classNames.push('staff'); } diff --git a/test/javascripts/widgets/poster-name-test.js.es6 b/test/javascripts/widgets/poster-name-test.js.es6 index 5e6782625..9c1bde62f 100644 --- a/test/javascripts/widgets/poster-name-test.js.es6 +++ b/test/javascripts/widgets/poster-name-test.js.es6 @@ -59,9 +59,11 @@ widgetTest('disable display name on posts', { widgetTest("doesn't render a name if it's similar to the username", { template: '{{mount-widget widget="poster-name" args=args}}', setup() { + this.siteSettings.prioritize_username_in_ux = true; + this.siteSettings.display_name_on_posts = true; this.set('args', { username: 'eviltrout', name: 'evil-trout' }); }, test(assert) { - assert.equal(this.$('.full-name').length, 0); + assert.equal(this.$('.second').length, 0); } });