mirror of
https://github.com/discourse/discourse.git
synced 2026-07-31 16:48:26 -05:00
DEV: Close the pinned messages list on Esc (#38267)
This commit is contained in:
@@ -131,6 +131,16 @@ export default {
|
||||
chatThreadListPane.close();
|
||||
return;
|
||||
}
|
||||
|
||||
if (chatStateManager.isPinnedMessagesPaneOpen) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
router.transitionTo(
|
||||
"chat.channel",
|
||||
...chatService.activeChannel.routeModels
|
||||
);
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
const markAllChannelsRead = (event) => {
|
||||
|
||||
@@ -165,6 +165,10 @@ export default class ChatStateManager extends Service {
|
||||
return this.isFullPageActive || this.isDrawerActive;
|
||||
}
|
||||
|
||||
get isPinnedMessagesPaneOpen() {
|
||||
return this.router.currentRouteName === "chat.channel.pins";
|
||||
}
|
||||
|
||||
storeAppURL(url = null) {
|
||||
if (url) {
|
||||
this._appURL = url;
|
||||
|
||||
@@ -24,6 +24,25 @@ RSpec.describe "Shortcuts | full page", type: :system do
|
||||
end
|
||||
end
|
||||
|
||||
context "when pressing Esc" do
|
||||
fab!(:message) { Fabricate(:chat_message, chat_channel: channel_1, use_service: true) }
|
||||
fab!(:pin) { Fabricate(:chat_pinned_message, chat_message: message, user: current_user) }
|
||||
|
||||
before { SiteSetting.chat_pinned_messages = true }
|
||||
|
||||
it "closes the pinned messages list" do
|
||||
chat.visit_channel(channel_1)
|
||||
find(".c-navbar__pinned-messages-btn").click
|
||||
|
||||
expect(page).to have_css(".c-routes.--channel-pins")
|
||||
|
||||
page.send_keys(:escape)
|
||||
|
||||
expect(page).to have_no_css(".c-routes.--channel-pins")
|
||||
expect(page).to have_current_path(channel_1.url)
|
||||
end
|
||||
end
|
||||
|
||||
context "with chat search" do
|
||||
context "when disabled" do
|
||||
before { SiteSetting.chat_search_enabled = false }
|
||||
|
||||
Reference in New Issue
Block a user