A platform for community discussion. Free, open, simple.
FIX: use the correct notification levels titles for PMs
OsamaSayeghbfe01782703e
diff --git a/app/assets/javascripts/select-kit/components/notifications-button.js.es6 b/app/assets/javascripts/select-kit/components/notifications-button.js.es6index 9c382a8f76b..dc9f3a1eeb2 100644--- a/app/assets/javascripts/select-kit/components/notifications-button.js.es6+++ b/app/assets/javascripts/select-kit/components/notifications-button.js.es6@@ -29,7 +29,7 @@ export default DropdownSelectBoxComponent.extend({computeHeaderContent() {let content = this._super();content.name = I18n.t(- `${this.get("i18nPrefix")}.${this.get("selectedDetails.key")}.title`+ `${this.get("i18nPrefix")}.${this.get("selectedDetails.key")}${this.get("i18nPostfix")}.title`);content.hasSelection = this.get("hasSelection");return content;diff --git a/app/assets/javascripts/select-kit/components/notifications-button/notifications-button-row.js.es6 b/app/assets/javascripts/select-kit/components/notifications-button/notifications-button-row.js.es6index d9741745ab9..91fd32ebac0 100644--- a/app/assets/javascripts/select-kit/components/notifications-button/notifications-button-row.js.es6+++ b/app/assets/javascripts/select-kit/components/notifications-button/notifications-button-row.js.es6@@ -9,10 +9,10 @@ export default DropdownSelectBoxRoxComponent.extend({i18nPrefix: Ember.computed.alias("options.i18nPrefix"),i18nPostfix: Ember.computed.alias("options.i18nPostfix"),- @computed("computedContent.value", "i18nPrefix")- title(value, prefix) {+ @computed("computedContent.value", "i18nPrefix", "i18nPostfix")+ title(value, prefix, postfix) {const key = buttonDetails(value).key;- return I18n.t(`${prefix}.${key}.title`);+ return I18n.t(`${prefix}.${key}${postfix}.title`);},@computed("computedContent.name", "computedContent.originalContent.icon")diff --git a/test/javascripts/components/topic-notifications-button-test.js.es6 b/test/javascripts/components/topic-notifications-button-test.js.es6index de27d63f72c..b53a8cacf01 100644--- a/test/javascripts/components/topic-notifications-button-test.js.es6+++ b/test/javascripts/components/topic-notifications-button-test.js.es6@@ -1,17 +1,26 @@import componentTest from "helpers/component-test";import Topic from "discourse/models/topic";-const buildTopic = function(level) {+const buildTopic = function(level, archetype = "regular") {return Topic.create({id: 4563,title: "Qunit Test Topic",details: {notification_level: level- }+ },+ archetype});};-moduleForComponent("topic-notifications-button", { integration: true });+const originalTranslation = I18n.translations.en.js.topic.notifications.tracking_pm.title;++moduleForComponent("topic-notifications-button", {+ integration: true,++ afterEach() {+ I18n.translations.en.js.topic.notifications.tracking_pm.title = originalTranslation;+ }+});componentTest("the header has a localized title", {template:@@ -45,3 +54,25 @@ componentTest("the header has a localized title", {});}});++componentTest("the header has a localized title", {+ template:+ "{{topic-notifications-button notificationLevel=topic.details.notification_level topic=topic}}",++ beforeEach() {+ I18n.translations.en.js.topic.notifications.tracking_pm.title = `${originalTranslation} PM`;+ this.set("topic", buildTopic(2, "private_message"));+ },++ test(assert) {+ andThen(() => {+ assert.equal(+ selectKit()+ .header()+ .name(),+ `${originalTranslation} PM`,+ "it has the correct title for PMs"+ );+ });+ }+});