mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 06:30:15 +08:00
624b1b3820
We were changing the user's user_option.bookmark_auto_delete_preference to whatever they changed it to in the bookmark modal to use as default for future bookmarks. However this was leading to a lot of confusion since if you wanted to set it for one bookmark you had to remember to change it back on the next one. This commit removes that automatic functionality, and instead moves the bookmark auto delete preference to User Preferences > Interface in an explicit dropdown.
37 lines
1.2 KiB
Ruby
37 lines
1.2 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
describe "User preferences for Interface", type: :system, js: true do
|
|
fab!(:user) { Fabricate(:user) }
|
|
let(:user_preferences_page) { PageObjects::Pages::UserPreferences.new }
|
|
|
|
before { sign_in(user) }
|
|
|
|
describe "Bookmarks" do
|
|
it "changes the bookmark after notification preference" do
|
|
user_preferences_page.visit(user)
|
|
click_link "Interface"
|
|
|
|
# preselects the default user_option.bookmark_auto_delete_preference value of 3 (clear_reminder)
|
|
expect(page).to have_css(
|
|
"#boookmark-after-notification-mode .select-kit-header[data-value='#{Bookmark.auto_delete_preferences[:clear_reminder]}']",
|
|
)
|
|
page.find("#boookmark-after-notification-mode").click
|
|
page.find(
|
|
".select-kit-row[data-value=\"#{Bookmark.auto_delete_preferences[:when_reminder_sent]}\"]",
|
|
).click
|
|
|
|
click_button "Save Changes"
|
|
|
|
# the preference page reloads after saving, so we need to poll the db
|
|
try_until_success do
|
|
expect(
|
|
UserOption.exists?(
|
|
user_id: user.id,
|
|
bookmark_auto_delete_preference: Bookmark.auto_delete_preferences[:when_reminder_sent],
|
|
),
|
|
).to be_truthy
|
|
end
|
|
end
|
|
end
|
|
end
|