mirror of
https://github.com/discourse/discourse.git
synced 2025-01-04 12:28:44 +08:00
FIX: Unpinning topics in glimmer topic list (#30342)
it's already handled by TopicStatus component (so one was undoing the other's toggle)
This commit is contained in:
parent
779fc74632
commit
5747b910e6
|
@ -166,15 +166,6 @@ export default class Item extends Component {
|
|||
this.navigateToTopic(this.args.topic, this.args.topic.lastUnreadUrl);
|
||||
return;
|
||||
}
|
||||
|
||||
if (
|
||||
e.target.classList.contains("d-icon-thumbtack") &&
|
||||
e.target.closest("a.topic-status")
|
||||
) {
|
||||
e.preventDefault();
|
||||
this.args.topic.togglePinnedForUser();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@action
|
||||
|
|
|
@ -128,4 +128,17 @@ describe "glimmer topic list", type: :system do
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
it "unpins globally pinned topics on click" do
|
||||
topic = Fabricate(:topic, pinned_globally: true, pinned_at: Time.current)
|
||||
visit("/latest")
|
||||
|
||||
expect(page).to have_css(".topic-list-item .d-icon-thumbtack:not(.unpinned)")
|
||||
|
||||
find(".topic-list-item .d-icon-thumbtack").click
|
||||
expect(page).to have_css(".topic-list-item .d-icon-thumbtack.unpinned")
|
||||
|
||||
wait_for { TopicUser.exists?(topic:, user:) }
|
||||
expect(TopicUser.find_by(topic:, user:).cleared_pinned_at).to_not be_nil
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue
Block a user