diff --git a/app/assets/javascripts/discourse/lib/render-tag.js.es6 b/app/assets/javascripts/discourse/lib/render-tag.js.es6
index d5e491661a3..7a836786080 100644
--- a/app/assets/javascripts/discourse/lib/render-tag.js.es6
+++ b/app/assets/javascripts/discourse/lib/render-tag.js.es6
@@ -14,7 +14,7 @@ function defaultRenderTag(tag, params) {
const tagName = params.tagName || "a";
let path;
if (tagName === "a" && !params.noHref) {
- if (params.isPrivateMessage && User.current()) {
+ if ((params.isPrivateMessage || params.pmOnly) && User.current()) {
const username = params.tagsForUser
? params.tagsForUser
: User.current().username;
diff --git a/app/assets/javascripts/discourse/templates/components/tag-list.hbs b/app/assets/javascripts/discourse/templates/components/tag-list.hbs
index 24adf8aa0ee..dcbb0035e45 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.pmOnly}}{{d-icon "far-envelope"}}{{/if}}{{#if tag.totalCount}} x {{tag.totalCount}}{{/if}}
+ {{discourse-tag tag.id isPrivateMessage=isPrivateMessage pmOnly=tag.pmOnly tagsForUser=tagsForUser}} {{#if tag.pmOnly}}{{d-icon "far-envelope"}}{{/if}}{{#if tag.totalCount}} x {{tag.totalCount}}{{/if}}
{{/each}}
diff --git a/test/javascripts/acceptance/tags-test.js.es6 b/test/javascripts/acceptance/tags-test.js.es6
index deab78fe80b..7dad65494c2 100644
--- a/test/javascripts/acceptance/tags-test.js.es6
+++ b/test/javascripts/acceptance/tags-test.js.es6
@@ -25,7 +25,10 @@ QUnit.test("list the tags in groups", async assert => {
200,
{ "Content-Type": "application/json" },
{
- tags: [{ id: "planned", text: "planned", count: 7, pm_count: 0 }],
+ tags: [
+ { id: "planned", text: "planned", count: 7, pm_count: 0 },
+ { id: "private", text: "private", count: 0, pm_count: 7 }
+ ],
extras: {
tag_groups: [
{
@@ -91,6 +94,11 @@ QUnit.test("list the tags in groups", async assert => {
["/tags/focus", "/tags/escort"],
"always uses lowercase URLs for mixed case tags"
);
+ assert.equal(
+ $("a[data-tag-name='private']").attr("href"),
+ "/u/eviltrout/messages/tags/private",
+ "links to private messages"
+ );
});
test("new topic button is not available for staff-only tags", async assert => {