Skip to content

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

UX: Differentiate Between PMs and Topics in Search Results (#8933)

adam j hartz0af2f5db6451
diff --git a/app/assets/javascripts/discourse/components/topic-status.js.es6 b/app/assets/javascripts/discourse/components/topic-status.js.es6
index ecd6f448de1..569292eb5ef 100644
--- a/app/assets/javascripts/discourse/components/topic-status.js.es6
+++ b/app/assets/javascripts/discourse/components/topic-status.js.es6
@@ -44,6 +44,17 @@ export default Component.extend({
: this._reset("warning");
},
+ @discourseComputed(
+ "showPrivateMessageIcon",
+ "topic.isPrivateMessage",
+ "topic.is_warning"
+ )
+ topicPrivateMessage(showPrivateMessageIcon, privateMessage, warning) {
+ return showPrivateMessageIcon && privateMessage && !warning
+ ? this._set("privateMessage", "envelope", "personal_message")
+ : this._reset("privateMessage");
+ },
+
@discourseComputed("topic.pinned")
topicPinned(pinned) {
return pinned
diff --git a/app/assets/javascripts/discourse/templates/components/topic-status.hbs b/app/assets/javascripts/discourse/templates/components/topic-status.hbs
index f21fbf151d4..bf655d92192 100644
--- a/app/assets/javascripts/discourse/templates/components/topic-status.hbs
+++ b/app/assets/javascripts/discourse/templates/components/topic-status.hbs
@@ -7,8 +7,11 @@
{{~#if archivedIcon~}}
<span class='topic-status' title={{archivedTitle}}>{{archivedIcon}}</span>
{{~/if~}}
+{{~#if topicPrivateMessage~}}
+ <span class='topic-status' title={{privateMessageTitle}}>{{privateMessageIcon}}</span>
+{{~/if~}}
{{~#if topicWarning~}}
- <span class='topic-status' title={{warningTitle}}>{{warningIcon}}</span>
+ <span class='topic-status topic-status-warning' title={{warningTitle}}>{{warningIcon}}</span>
{{~/if~}}
{{~#if topicPinned~}}
{{~#if canAct~}}
diff --git a/app/assets/javascripts/discourse/templates/full-page-search.hbs b/app/assets/javascripts/discourse/templates/full-page-search.hbs
index 1317bbc7532..7a2cbbd9991 100644
--- a/app/assets/javascripts/discourse/templates/full-page-search.hbs
+++ b/app/assets/javascripts/discourse/templates/full-page-search.hbs
@@ -85,7 +85,8 @@
{{/if}}
<a class='search-link' href='{{unbound result.url}}' {{action "logClick" result.topic_id}}>
- {{topic-status topic=result.topic disableActions=true}}<span class='topic-title'>{{#highlight-text highlight=q}}{{{unbound result.topic.fancyTitle}}}{{/highlight-text}}</span>
+ {{topic-status topic=result.topic disableActions=true showPrivateMessageIcon=true}}
+ <span class='topic-title'>{{#highlight-text highlight=q}}{{{unbound result.topic.fancyTitle}}}{{/highlight-text}}</span>
</a>
<div class='search-category'>
diff --git a/app/assets/stylesheets/common/base/discourse.scss b/app/assets/stylesheets/common/base/discourse.scss
index f8ea7b11cc5..023154c7dab 100644
--- a/app/assets/stylesheets/common/base/discourse.scss
+++ b/app/assets/stylesheets/common/base/discourse.scss
@@ -714,7 +714,7 @@ table {
}
}
- .d-icon-envelope {
+ .topic-status-warning .d-icon-envelope {
color: $danger;
}
}
diff --git a/app/serializers/listable_topic_serializer.rb b/app/serializers/listable_topic_serializer.rb
index 4e5829df02d..8a169eb1945 100644
--- a/app/serializers/listable_topic_serializer.rb
+++ b/app/serializers/listable_topic_serializer.rb
@@ -9,6 +9,7 @@ class ListableTopicSerializer < BasicTopicSerializer
:last_posted_at,
:bumped,
:bumped_at,
+ :archetype,
:unseen,
:last_read_post_number,
:unread,
diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml
index 1211978b667..2253b4fe8ec 100644
--- a/config/locales/client.en.yml
+++ b/config/locales/client.en.yml
@@ -2861,6 +2861,7 @@ en:
help: "This topic is unlisted; it will not be displayed in topic lists, and can only be accessed via a direct link"
personal_message:
title: "This topic is a personal message"
+ help: "This topic is a personal message"
posts: "Posts"
posts_long: "there are {{number}} posts in this topic"