mirror of
https://github.com/discourse/discourse.git
synced 2025-01-19 04:42:55 +08:00
FIX: A pmOnly tag should link to messages (#8361)
isPrivateMessages represents that the tag list is shown in the context of private messages and pmOnly represents that the tag is used only in private messages.
This commit is contained in:
parent
975165f25f
commit
a9704da34c
|
@ -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;
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
{{/if}}
|
||||
{{#each sortedTags as |tag|}}
|
||||
<div class='tag-box'>
|
||||
{{discourse-tag tag.id isPrivateMessage=isPrivateMessage tagsForUser=tagsForUser}} {{#if tag.pmOnly}}{{d-icon "far-envelope"}}{{/if}}{{#if tag.totalCount}} <span class='tag-count'>x {{tag.totalCount}}</span>{{/if}}
|
||||
{{discourse-tag tag.id isPrivateMessage=isPrivateMessage pmOnly=tag.pmOnly tagsForUser=tagsForUser}} {{#if tag.pmOnly}}{{d-icon "far-envelope"}}{{/if}}{{#if tag.totalCount}} <span class='tag-count'>x {{tag.totalCount}}</span>{{/if}}
|
||||
</div>
|
||||
{{/each}}
|
||||
<div class="clearfix" />
|
||||
|
|
|
@ -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 => {
|
||||
|
|
Loading…
Reference in New Issue
Block a user