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:
Jarek Radosz 2024-12-18 15:55:02 +01:00 committed by GitHub
parent 779fc74632
commit 5747b910e6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 13 additions and 9 deletions

View File

@ -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

View File

@ -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