A platform for community discussion. Free, open, simple.
FIX: bookmark control should track a topic model change (#35867)
Yuriy Kurant2f47e9e82ec7
diff --git a/frontend/discourse/app/components/bookmark-menu.gjs b/frontend/discourse/app/components/bookmark-menu.gjsindex 006dad21e5c..60bfc1f5bd9 100644--- a/frontend/discourse/app/components/bookmark-menu.gjs+++ b/frontend/discourse/app/components/bookmark-menu.gjs@@ -23,7 +23,6 @@ export default class BookmarkMenu extends Component {@tracked quicksaved = false;@tracked reminderAtOptions = [];- bookmarkManager = this.args.bookmarkManager;timezone = this.currentUser?.user_option?.timezone || moment.tz.guess();timeShortcuts = timeShortcuts(this.timezone);bookmarkCreatePromise = null;@@ -41,6 +40,10 @@ export default class BookmarkMenu extends Component {this.reminderAtOptions.push(custom);}+ get bookmarkManager() {+ return this.args.bookmarkManager;+ }+get existingBookmark() {return this.bookmarkManager.trackedBookmark?.id? this.bookmarkManager.trackedBookmarkdiff --git a/spec/system/bookmarks_spec.rb b/spec/system/bookmarks_spec.rbindex bb3a4b24afe..5ce8dd90808 100644--- a/spec/system/bookmarks_spec.rb+++ b/spec/system/bookmarks_spec.rb@@ -2,9 +2,11 @@describe "Bookmarking posts and topics", type: :system dofab!(:topic)+ fab!(:topic_2, :topic)fab!(:current_user) { Fabricate(:user, refresh_auto_groups: true) }fab!(:post) { Fabricate(:post, topic: topic, raw: "This is some post to bookmark") }fab!(:post_2) { Fabricate(:post, topic: topic, raw: "Some interesting post content") }+ fab!(:post_3) { Fabricate(:post, topic: topic_2, raw: "Check out this [topic](/t/#{topic.id})") }let(:timezone) { "Australia/Brisbane" }let(:cdp) { PageObjects::CDP.new }@@ -116,6 +118,16 @@ describe "Bookmarking posts and topics", type: :system dobookmark.reminder_at_in_zone(timezone).strftime("%H:%M"),)end++ it "bookmark button is topic specific" do+ topic_page.visit_topic(topic_2)+ topic_page.click_topic_bookmark_button+ expect(topic_page).to have_topic_bookmarked(topic_2)++ # transition to another topic w/o refreshing the page+ find("a[href='/t/#{topic.id}']").click+ expect(topic_page).to have_no_bookmarks(topic)+ endenddescribe "editing existing bookmarks" do