A platform for community discussion. Free, open, simple.
FIX: pass app events to notification items (#39438)
Same9a48a24801b
diff --git a/frontend/discourse/app/components/user-menu/bookmarks-list.js b/frontend/discourse/app/components/user-menu/bookmarks-list.jsindex ea221d26fbf..fa6c4143fd9 100644--- a/frontend/discourse/app/components/user-menu/bookmarks-list.js+++ b/frontend/discourse/app/components/user-menu/bookmarks-list.js@@ -62,6 +62,7 @@ export default class UserMenuBookmarksList extends UserMenuNotificationsList {content.push(new UserMenuNotificationItem({notification,+ appEvents: this.appEvents,currentUser: this.currentUser,siteSettings: this.siteSettings,site: this.site,diff --git a/frontend/discourse/app/components/user-menu/messages-list.js b/frontend/discourse/app/components/user-menu/messages-list.jsindex a64c74d0a69..7022e68a96c 100644--- a/frontend/discourse/app/components/user-menu/messages-list.js+++ b/frontend/discourse/app/components/user-menu/messages-list.js@@ -67,6 +67,7 @@ export default class UserMenuMessagesList extends UserMenuNotificationsList {content.push(new UserMenuNotificationItem({notification,+ appEvents: this.appEvents,currentUser: this.currentUser,siteSettings: this.siteSettings,site: this.site,@@ -103,6 +104,7 @@ export default class UserMenuMessagesList extends UserMenuNotificationsList {content.push(new UserMenuNotificationItem({notification: item,+ appEvents: this.appEvents,currentUser: this.currentUser,siteSettings: this.siteSettings,site: this.site,diff --git a/spec/system/viewing_user_menu_spec.rb b/spec/system/viewing_user_menu_spec.rbindex 8a7c66847e4..b8d2e517cd3 100644--- a/spec/system/viewing_user_menu_spec.rb+++ b/spec/system/viewing_user_menu_spec.rb@@ -24,6 +24,44 @@ RSpec.describe "Viewing User Menu" doendend+ describe "when clicking a notification in the bookmarks tab" do+ fab!(:post)+ fab!(:bookmark) { Fabricate(:bookmark, user: user, bookmarkable: post) }+ fab!(:bookmark_reminder) do+ Fabricate(+ :notification,+ user: user,+ topic: post.topic,+ post_number: post.post_number,+ notification_type: Notification.types[:bookmark_reminder],+ data: {+ bookmark_id: bookmark.id,+ bookmarkable_type: bookmark.bookmarkable_type,+ bookmarkable_id: bookmark.bookmarkable_id,+ title: post.topic.title,+ bookmark_name: "reminder",+ }.to_json,+ )+ end++ it "does not raise a JS error on click" do+ sign_in(user)+ visit("/latest")++ page_errors = []+ page.driver.with_playwright_page do |pw_page|+ pw_page.on("pageerror", ->(error) { page_errors << error.message })+ end++ user_menu.open+ user_menu.click_bookmarks_tab+ find("#quick-access-bookmarks li.bookmark-reminder a").click++ expect(page).to have_current_path(%r{/t/})+ expect(page_errors).to be_empty+ end+ end+describe "when viewing replies notifications tab" dofab!(:topic)