mirror of
https://github.com/discourse/discourse.git
synced 2026-08-14 13:58:53 +08:00
Surfaces pinned messages directly in the channel instead of only behind a side panel. A sticky bar at the top of the message list shows the most recently pinned message; when several messages are pinned a position indicator appears and tapping the bar cycles through them, jumping to each pinned message in the conversation. <img width="413" height="174" alt="image" src="https://github.com/user-attachments/assets/f01f38cd-bd4d-4b97-9aa1-354a62cda7d5" /> The bar's list icon opens the full pinned-messages panel, replacing the navbar pinned-messages button, which is removed to declutter the header. The bar refreshes from the committed pin/unpin message bus events so it stays in sync as messages are pinned and unpinned. --------- Co-authored-by: chapoi <101828855+chapoi@users.noreply.github.com> Co-authored-by: Martin Brennan <martin@discourse.org>
71 lines
2.1 KiB
Ruby
Vendored
71 lines
2.1 KiB
Ruby
Vendored
# frozen_string_literal: true
|
|
|
|
RSpec.describe "Shortcuts | full page" do
|
|
fab!(:channel_1, :chat_channel)
|
|
fab!(:current_user, :user)
|
|
|
|
let(:chat) { PageObjects::Pages::Chat.new }
|
|
let(:channel_page) { PageObjects::Pages::ChatChannel.new }
|
|
|
|
before do
|
|
chat_system_bootstrap
|
|
channel_1.add(current_user)
|
|
sign_in(current_user)
|
|
end
|
|
|
|
context "when pressing a letter" do
|
|
it "intercepts the event and propagates it to the composer" do
|
|
chat.visit_channel(channel_1)
|
|
find(".header-sidebar-toggle").click # simple way to ensure composer is not focused
|
|
|
|
page.send_keys("e")
|
|
|
|
expect(channel_page.composer).to have_value("e")
|
|
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) }
|
|
fab!(:other_message) { Fabricate(:chat_message, chat_channel: channel_1, use_service: true) }
|
|
fab!(:other_pin) do
|
|
Fabricate(:chat_pinned_message, chat_message: other_message, user: current_user)
|
|
end
|
|
|
|
before { SiteSetting.chat_pinned_messages = true }
|
|
|
|
it "closes the pinned messages list" do
|
|
chat.visit_channel(channel_1)
|
|
find(".chat-pinned-bar__see-all").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 }
|
|
|
|
it "doesn't show the link to /chat/search" do
|
|
visit("/")
|
|
|
|
expect(page).to have_no_selector(".sidebar-section[data-section-name=\"chat-search\"]")
|
|
end
|
|
end
|
|
|
|
context "when enabled" do
|
|
before { SiteSetting.chat_search_enabled = true }
|
|
|
|
it "shows the link the /chat/search" do
|
|
visit("/")
|
|
|
|
expect(page).to have_selector(".sidebar-section[data-section-name=\"chat-search\"]")
|
|
end
|
|
end
|
|
end
|
|
end
|