From b8b1759de94b65c1f13db6d6cb8b35181835e10b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Hanol?= Date: Tue, 12 Feb 2019 11:34:25 +0100 Subject: [PATCH] UX: show envelope when tag is only used in PM UX: use regular envelope instead of solid envelope REFACTOR: %s/enveloppe/envelope/g --- app/assets/javascripts/discourse/models/tag.js.es6 | 5 +++++ .../javascripts/discourse/templates/components/tag-list.hbs | 2 +- test/javascripts/widgets/post-test.js.es6 | 4 ++-- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/discourse/models/tag.js.es6 b/app/assets/javascripts/discourse/models/tag.js.es6 index 572463e5bde..c9665111ac7 100644 --- a/app/assets/javascripts/discourse/models/tag.js.es6 +++ b/app/assets/javascripts/discourse/models/tag.js.es6 @@ -5,5 +5,10 @@ export default RestModel.extend({ @computed("count", "pm_count") totalCount(count, pmCount) { return count + pmCount; + }, + + @computed("count", "pm_count") + pmOnly(count, pmCount) { + return count === 0 && pmCount > 0; } }); diff --git a/app/assets/javascripts/discourse/templates/components/tag-list.hbs b/app/assets/javascripts/discourse/templates/components/tag-list.hbs index 7be97e2439f..24adf8aa0ee 100644 --- a/app/assets/javascripts/discourse/templates/components/tag-list.hbs +++ b/app/assets/javascripts/discourse/templates/components/tag-list.hbs @@ -9,7 +9,7 @@ {{/if}} {{#each sortedTags as |tag|}}
- {{discourse-tag tag.id isPrivateMessage=isPrivateMessage tagsForUser=tagsForUser}} {{#if tag.pm_count}}{{d-icon "envelope"}}{{/if}}{{#if tag.totalCount}} x {{tag.totalCount}}{{/if}} + {{discourse-tag tag.id isPrivateMessage=isPrivateMessage tagsForUser=tagsForUser}} {{#if tag.pmOnly}}{{d-icon "far-envelope"}}{{/if}}{{#if tag.totalCount}} x {{tag.totalCount}}{{/if}}
{{/each}}
diff --git a/test/javascripts/widgets/post-test.js.es6 b/test/javascripts/widgets/post-test.js.es6 index 64f0a1ed29f..3ad9d7cdc86 100644 --- a/test/javascripts/widgets/post-test.js.es6 +++ b/test/javascripts/widgets/post-test.js.es6 @@ -54,7 +54,7 @@ widgetTest("via-email", { }, async test(assert) { await click(".post-info.via-email"); - assert.ok(this.rawEmailShown, "clicking the enveloppe shows the raw email"); + assert.ok(this.rawEmailShown, "clicking the envelope shows the raw email"); } }); @@ -69,7 +69,7 @@ widgetTest("via-email without permission", { await click(".post-info.via-email"); assert.ok( !this.rawEmailShown, - `clicking the enveloppe doesn't show the raw email` + "clicking the envelope doesn't show the raw email" ); } });