Skip to content

A platform for community discussion. Free, open, simple.

FIX: correctly shows suggested topics label (#9017)

Joffrey JAFFEUXcb69e89d7cf4
diff --git a/app/assets/javascripts/discourse/components/suggested-topics.js.es6 b/app/assets/javascripts/discourse/components/suggested-topics.js.es6
index d6010eba934..53986a8303b 100644
--- a/app/assets/javascripts/discourse/components/suggested-topics.js.es6
+++ b/app/assets/javascripts/discourse/components/suggested-topics.js.es6
@@ -10,7 +10,8 @@ export default Component.extend({
classNames: ["suggested-topics"],
suggestedTitleLabel: computed("topic", function() {
- if (this.currentUser && this.currentUser.pmPath(this.topic)) {
+ const href = this.currentUser && this.currentUser.pmPath(this.topic);
+ if (this.topic.get("isPrivateMessage") && href) {
return "suggested_topics.pm_title";
} else {
return "suggested_topics.title";
diff --git a/test/javascripts/acceptance/personal-message-test.js.es6 b/test/javascripts/acceptance/personal-message-test.js.es6
index 12247dd02a0..b705d59960e 100644
--- a/test/javascripts/acceptance/personal-message-test.js.es6
+++ b/test/javascripts/acceptance/personal-message-test.js.es6
@@ -13,6 +13,17 @@ QUnit.test("footer edit button", async assert => {
);
});
+QUnit.test("suggested messages", async assert => {
+ await visit("/t/pm-for-testing/12");
+
+ assert.equal(
+ find("#suggested-topics .suggested-topics-title")
+ .text()
+ .trim(),
+ I18n.t("suggested_topics.pm_title")
+ );
+});
+
acceptance("Personal Message Tagging", {
loggedIn: true,
site: { can_tag_pms: true }
diff --git a/test/javascripts/acceptance/topic-test.js.es6 b/test/javascripts/acceptance/topic-test.js.es6
index cf61e32e22d..af05e5fc9e7 100644
--- a/test/javascripts/acceptance/topic-test.js.es6
+++ b/test/javascripts/acceptance/topic-test.js.es6
@@ -207,6 +207,17 @@ QUnit.test(
}
);
+QUnit.test("Suggested topics", async assert => {
+ await visit("/t/internationalization-localization/280");
+
+ assert.equal(
+ find("#suggested-topics .suggested-topics-title")
+ .text()
+ .trim(),
+ I18n.t("suggested_topics.title")
+ );
+});
+
QUnit.skip("Deleting a topic", async assert => {
await visit("/t/internationalization-localization/280");
await click(".topic-post:eq(0) button.show-more-actions");
diff --git a/test/javascripts/fixtures/topic.js.es6 b/test/javascripts/fixtures/topic.js.es6
index 03d5b661d8b..b4c79e2fd66 100644
--- a/test/javascripts/fixtures/topic.js.es6
+++ b/test/javascripts/fixtures/topic.js.es6
@@ -3852,6 +3852,49 @@ export default {
destination_category_id: 3
},
"/t/12/1.json": {
+ suggested_topics: [
+ {
+ id: 8,
+ title: "This is a new and awesome topic!",
+ fancy_title: "This is a new and awesome topic!",
+ slug: "this-is-a-new-and-awesome-topic",
+ posts_count: 3,
+ reply_count: 0,
+ highest_post_number: 5,
+ image_url: null,
+ created_at: "2015-08-13T05:17:00.000Z",
+ last_posted_at: "2015-08-13T10:14:34.799Z",
+ bumped: true,
+ bumped_at: "2015-08-13T10:14:34.799Z",
+ unseen: false,
+ last_read_post_number: 5,
+ unread: 0,
+ new_posts: 0,
+ pinned: false,
+ unpinned: null,
+ visible: true,
+ closed: false,
+ archived: false,
+ notification_level: 2,
+ bookmarked: false,
+ liked: false,
+ archetype: "regular",
+ like_count: 0,
+ views: 2,
+ category_id: 1,
+ posters: [
+ {
+ extras: "latest single",
+ description: "Original Poster, Most Recent Poster",
+ user: {
+ id: 1,
+ username: "test",
+ avatar_template: "/images/avatar.png"
+ }
+ }
+ ]
+ }
+ ],
post_stream: {
posts: [
{