Revert "DEV: rework the chat-live-pane (#20511)" (#20514)

This reverts commit 10e183113952eee7085c4cdaa214bfa7a4df56a1.
This commit is contained in:
Joffrey JAFFEUX
2023-03-02 20:20:39 +01:00
committed by GitHub
parent 10e1831139
commit 435761ef58
119 changed files with 2327 additions and 2632 deletions

View File

@ -1,5 +1,5 @@
import User from "discourse/models/user";
import { render } from "@ember/test-helpers";
import { render, waitFor } from "@ember/test-helpers";
import ChatMessage from "discourse/plugins/chat/discourse/models/chat-message";
import { exists } from "discourse/tests/helpers/qunit-helpers";
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
@ -21,16 +21,9 @@ module("Discourse Chat | Component | chat-message", function (hooks) {
unread_count: 0,
muted: false,
},
canInteractWithChat: true,
canDeleteSelf: true,
canDeleteOthers: true,
canFlag: true,
userSilenced: false,
canModerate: true,
});
return {
message: ChatMessage.create(
chatChannel,
Object.assign(
{
id: 178,
@ -45,6 +38,14 @@ module("Discourse Chat | Component | chat-message", function (hooks) {
messageData
)
),
canInteractWithChat: true,
details: {
can_delete_self: true,
can_delete_others: true,
can_flag: true,
user_silenced: false,
can_moderate: true,
},
chatChannel,
setReplyTo: () => {},
replyMessageClicked: () => {},
@ -54,9 +55,8 @@ module("Discourse Chat | Component | chat-message", function (hooks) {
onStartSelectingMessages: () => {},
onSelectMessage: () => {},
bulkSelectMessages: () => {},
afterReactionAdded: () => {},
onHoverMessage: () => {},
didShowMessage: () => {},
didHideMessage: () => {},
};
}
@ -64,7 +64,8 @@ module("Discourse Chat | Component | chat-message", function (hooks) {
<ChatMessage
@message={{this.message}}
@canInteractWithChat={{this.canInteractWithChat}}
@channel={{this.chatChannel}}
@details={{this.details}}
@chatChannel={{this.chatChannel}}
@setReplyTo={{this.setReplyTo}}
@replyMessageClicked={{this.replyMessageClicked}}
@editButtonClicked={{this.editButtonClicked}}
@ -73,8 +74,7 @@ module("Discourse Chat | Component | chat-message", function (hooks) {
@onSelectMessage={{this.onSelectMessage}}
@bulkSelectMessages={{this.bulkSelectMessages}}
@onHoverMessage={{this.onHoverMessage}}
@didShowMessage={{this.didShowMessage}}
@didHideMessage={{this.didHideMessage}}
@afterReactionAdded={{this.reStickScrollIfNeeded}}
/>
`;
@ -90,7 +90,6 @@ module("Discourse Chat | Component | chat-message", function (hooks) {
test("Deleted message", async function (assert) {
this.setProperties(generateMessageProps({ deleted_at: moment() }));
await render(template);
assert.true(
exists(".chat-message-deleted .chat-message-expand"),
"has the correct deleted css class and expand button within"
@ -105,4 +104,16 @@ module("Discourse Chat | Component | chat-message", function (hooks) {
"has the correct hidden css class and expand button within"
);
});
test("Message marked as visible", async function (assert) {
this.setProperties(generateMessageProps());
await render(template);
await waitFor("div[data-visible=true]");
assert.true(
exists(".chat-message-container[data-visible=true]"),
"message is marked as visible"
);
});
});