FIX: bookmark control should track a topic model change (#35867)

This change fixes the issue with a leaking bookmark state when
transitioning between different topics.
This commit is contained in:
Yuriy Kurant
2025-11-06 21:09:23 +08:00
committed by GitHub
parent 9d96390181
commit 2f47e9e82e
2 changed files with 16 additions and 1 deletions
@@ -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.trackedBookmark
+12
View File
@@ -2,9 +2,11 @@
describe "Bookmarking posts and topics", type: :system do
fab!(: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 do
bookmark.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)
end
end
describe "editing existing bookmarks" do