mirror of
https://github.com/discourse/discourse.git
synced 2025-01-18 14:32:44 +08:00
FIX: ensures activeMessage is reset with channel (#21031)
This commit is contained in:
parent
c7b49a14c7
commit
c1dc6a2db4
|
@ -34,7 +34,6 @@ export default {
|
||||||
return dasherize(this.channel.slugifiedTitle);
|
return dasherize(this.channel.slugifiedTitle);
|
||||||
}
|
}
|
||||||
|
|
||||||
@computed("chatService.activeChannel")
|
|
||||||
get classNames() {
|
get classNames() {
|
||||||
const classes = [];
|
const classes = [];
|
||||||
|
|
||||||
|
|
|
@ -30,8 +30,6 @@ export default class Chat extends Service {
|
||||||
@service chatChannelPane;
|
@service chatChannelPane;
|
||||||
@service chatChannelThreadPane;
|
@service chatChannelThreadPane;
|
||||||
|
|
||||||
@tracked activeChannel = null;
|
|
||||||
|
|
||||||
cook = null;
|
cook = null;
|
||||||
presenceChannel = null;
|
presenceChannel = null;
|
||||||
sidebarActive = false;
|
sidebarActive = false;
|
||||||
|
@ -40,6 +38,19 @@ export default class Chat extends Service {
|
||||||
@and("currentUser.has_chat_enabled", "siteSettings.chat_enabled") userCanChat;
|
@and("currentUser.has_chat_enabled", "siteSettings.chat_enabled") userCanChat;
|
||||||
|
|
||||||
@tracked _activeMessage = null;
|
@tracked _activeMessage = null;
|
||||||
|
@tracked _activeChannel = null;
|
||||||
|
|
||||||
|
get activeChannel() {
|
||||||
|
return this._activeChannel;
|
||||||
|
}
|
||||||
|
|
||||||
|
set activeChannel(channel) {
|
||||||
|
if (!channel) {
|
||||||
|
this._activeMessage = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
this._activeChannel = channel;
|
||||||
|
}
|
||||||
|
|
||||||
@computed("currentUser.staff", "currentUser.groups.[]")
|
@computed("currentUser.staff", "currentUser.groups.[]")
|
||||||
get userCanDirectMessage() {
|
get userCanDirectMessage() {
|
||||||
|
|
|
@ -68,6 +68,25 @@ RSpec.describe "Drawer", type: :system, js: true do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context "when closing the drawer" do
|
||||||
|
fab!(:channel_1) { Fabricate(:chat_channel) }
|
||||||
|
fab!(:message_1) { Fabricate(:chat_message, chat_channel: channel_1) }
|
||||||
|
|
||||||
|
before { channel_1.add(current_user) }
|
||||||
|
|
||||||
|
it "resets the active message" do
|
||||||
|
visit("/")
|
||||||
|
chat_page.open_from_header
|
||||||
|
drawer.open_channel(channel_1)
|
||||||
|
channel_page.hover_message(message_1)
|
||||||
|
expect(page).to have_css(".chat-message-actions-container")
|
||||||
|
|
||||||
|
find(".chat-composer-input").send_keys(:escape)
|
||||||
|
|
||||||
|
expect(page).to have_no_css(".chat-message-actions-container")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
context "when clicking the drawer's header" do
|
context "when clicking the drawer's header" do
|
||||||
it "collapses the drawer" do
|
it "collapses the drawer" do
|
||||||
visit("/")
|
visit("/")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user