FIX: Hashtags were not decorated in user activity list (#24125)
This was just a case of removing the `onlyStream: true` operation from `decorateCookedElement`, since that restricts the decoration only to topic page posts.
This commit is contained in:
parent
7f57ba45ac
commit
545e92039c
|
@ -8,9 +8,7 @@ export default {
|
|||
const site = owner.lookup("service:site");
|
||||
|
||||
withPluginApi("0.8.7", (api) => {
|
||||
api.decorateCookedElement((post) => decorateHashtags(post, site), {
|
||||
onlyStream: true,
|
||||
});
|
||||
api.decorateCookedElement((post) => decorateHashtags(post, site));
|
||||
});
|
||||
},
|
||||
};
|
||||
|
|
|
@ -192,6 +192,56 @@ describe "Using #hashtag autocompletion to search for and lookup categories and
|
|||
end
|
||||
end
|
||||
|
||||
it "decorates the user activity stream hashtags" do
|
||||
post =
|
||||
Fabricate(
|
||||
:post,
|
||||
raw: "this is a #cool-cat category and a #cooltag tag",
|
||||
topic: topic,
|
||||
user: current_user,
|
||||
)
|
||||
UserActionManager.enable
|
||||
UserActionManager.post_created(post)
|
||||
|
||||
visit("/u/#{current_user.username}/activity")
|
||||
expect(find(".user-stream-item [data-post-id=\"#{post.id}\"]")["innerHTML"]).to have_tag(
|
||||
"a",
|
||||
with: {
|
||||
class: "hashtag-cooked",
|
||||
href: category.url,
|
||||
"data-type": "category",
|
||||
"data-slug": category.slug,
|
||||
"data-id": category.id,
|
||||
"aria-label": category.name,
|
||||
},
|
||||
) do
|
||||
with_tag(
|
||||
"span",
|
||||
with: {
|
||||
class: "hashtag-category-badge hashtag-color--category-#{category.id}",
|
||||
},
|
||||
)
|
||||
end
|
||||
expect(find(".user-stream-item [data-post-id=\"#{post.id}\"]")["innerHTML"]).to have_tag(
|
||||
"a",
|
||||
with: {
|
||||
class: "hashtag-cooked",
|
||||
href: tag.url,
|
||||
"data-type": "tag",
|
||||
"data-slug": tag.name,
|
||||
"data-id": tag.id,
|
||||
"aria-label": tag.name,
|
||||
},
|
||||
) do
|
||||
with_tag(
|
||||
"svg",
|
||||
with: {
|
||||
class: "fa d-icon d-icon-tag svg-icon hashtag-color--tag-#{tag.id} svg-string",
|
||||
},
|
||||
) { with_tag("use", with: { href: "#tag" }) }
|
||||
end
|
||||
end
|
||||
|
||||
context "when a user cannot access the category for a hashtag cooked in another post" do
|
||||
fab!(:admin) { Fabricate(:admin) }
|
||||
fab!(:manager_group) { Fabricate(:group, name: "Managers") }
|
||||
|
|
Loading…
Reference in New Issue