mirror of
https://github.com/discourse/discourse.git
synced 2026-08-06 03:07:17 -05:00
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:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user