mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 01:16:38 -06:00
FIX: correctly untrack topics when dismiss unread (#23894)
Bug introduced when dismiss modal was moved to new component-based API - https://github.com/discourse/discourse/pull/22262 We need to track `dismissTopics` property to send correct request to server. Meta: https://meta.discourse.org/t/dismiss-all-unread/280948
This commit is contained in:
parent
abb8a0730e
commit
b061631c18
@ -8,6 +8,7 @@
|
||||
<PreferenceCheckbox
|
||||
@labelKey="topics.bulk.also_dismiss_topics"
|
||||
@checked={{this.dismissTopics}}
|
||||
class="dismiss-read-modal__stop-tracking"
|
||||
/>
|
||||
</p>
|
||||
</:body>
|
||||
|
@ -0,0 +1,6 @@
|
||||
import Component from "@glimmer/component";
|
||||
import { tracked } from "@glimmer/tracking";
|
||||
|
||||
export default class DismissRead extends Component {
|
||||
@tracked dismissTopics = false;
|
||||
}
|
@ -6,6 +6,7 @@ RSpec.describe "Dismissing New", type: :system do
|
||||
let(:topic_list_controls) { PageObjects::Components::TopicListControls.new }
|
||||
let(:topic_list) { PageObjects::Components::TopicList.new }
|
||||
let(:dismiss_new_modal) { PageObjects::Modals::DismissNew.new }
|
||||
let(:topic_view) { PageObjects::Components::TopicView.new }
|
||||
|
||||
describe "when a user has an unread post" do
|
||||
fab!(:topic) { Fabricate(:topic, user: user) }
|
||||
@ -33,6 +34,24 @@ RSpec.describe "Dismissing New", type: :system do
|
||||
|
||||
using_session(:tab_1) { expect(topic_list_controls).to have_unread(count: 0) }
|
||||
end
|
||||
|
||||
it "should untrack topics across sessions after the user dismisses it" do
|
||||
sign_in(user)
|
||||
|
||||
visit("/unread")
|
||||
|
||||
using_session(:tab_1) do
|
||||
sign_in(user)
|
||||
|
||||
visit("/t/#{topic.id}")
|
||||
|
||||
expect(topic_view).to have_tracking_status("tracking")
|
||||
end
|
||||
|
||||
topic_list_controls.dismiss_unread(untrack: true)
|
||||
|
||||
using_session(:tab_1) { expect(topic_view).to have_tracking_status("regular") }
|
||||
end
|
||||
end
|
||||
|
||||
describe "when a user has a new topic" do
|
||||
|
@ -25,8 +25,9 @@ module PageObjects
|
||||
has_css?(".nav-item_unread", text: text)
|
||||
end
|
||||
|
||||
def dismiss_unread
|
||||
def dismiss_unread(untrack: false)
|
||||
click_button("dismiss-topics-bottom")
|
||||
find(".dismiss-read-modal__stop-tracking").click if untrack
|
||||
click_button("dismiss-read-confirm")
|
||||
self
|
||||
end
|
||||
|
@ -10,6 +10,14 @@ module PageObjects
|
||||
wait: Capybara.default_max_wait_time * 2,
|
||||
)
|
||||
end
|
||||
|
||||
def has_tracking_status?(name)
|
||||
select_kit =
|
||||
PageObjects::Components::SelectKit.new(
|
||||
"#topic-footer-buttons .topic-notifications-options",
|
||||
)
|
||||
expect(select_kit).to have_selected_name(name)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user