A platform for community discussion. Free, open, simple.
FIX: Hashtags were not decorated in user activity list (#24125)
Martin Brennan545e92039c7e
diff --git a/app/assets/javascripts/discourse/app/instance-initializers/hashtag-post-decorations.js b/app/assets/javascripts/discourse/app/instance-initializers/hashtag-post-decorations.jsindex 8977ae13c7d..d869ca2cccc 100644--- a/app/assets/javascripts/discourse/app/instance-initializers/hashtag-post-decorations.js+++ b/app/assets/javascripts/discourse/app/instance-initializers/hashtag-post-decorations.js@@ -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));});},};diff --git a/spec/system/hashtag_autocomplete_spec.rb b/spec/system/hashtag_autocomplete_spec.rbindex 61b0ee1f571..705123f61e3 100644--- a/spec/system/hashtag_autocomplete_spec.rb+++ b/spec/system/hashtag_autocomplete_spec.rb@@ -192,6 +192,56 @@ describe "Using #hashtag autocompletion to search for and lookup categories andendend+ 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" dofab!(:admin) { Fabricate(:admin) }fab!(:manager_group) { Fabricate(:group, name: "Managers") }