FEATURE: my threads page (#24771)

This commit adds a new "My threads" link in sidebar and drawer. This link will open the "/chat/threads" page which contains all threads where the current user is a member. It's ordered by activity (unread and then last message created).

Moreover, the threads list of a channel page is now showing every threads of a channel, and not just the ones where you are a member.
This commit is contained in:
Joffrey JAFFEUX
2023-12-11 07:38:07 +01:00
committed by GitHub
parent 4949d85c15
commit 09277bc543
75 changed files with 1419 additions and 227 deletions

View File

@ -6,13 +6,13 @@ import { exists, query } from "discourse/tests/helpers/qunit-helpers";
import fabricators from "discourse/plugins/chat/discourse/lib/fabricators";
import { CHATABLE_TYPES } from "discourse/plugins/chat/discourse/models/chat-channel";
module("Discourse Chat | Component | chat-channel-title", function (hooks) {
module("Discourse Chat | Component | <ChannelTitle />", function (hooks) {
setupRenderingTest(hooks);
test("category channel", async function (assert) {
this.channel = fabricators.channel();
await render(hbs`<ChatChannelTitle @channel={{this.channel}} />`);
await render(hbs`<ChannelTitle @channel={{this.channel}} />`);
assert.strictEqual(
query(".chat-channel-title__category-badge").getAttribute("style"),
@ -30,7 +30,7 @@ module("Discourse Chat | Component | chat-channel-title", function (hooks) {
title: "<div class='xss'>evil</div>",
});
await render(hbs`<ChatChannelTitle @channel={{this.channel}} />`);
await render(hbs`<ChannelTitle @channel={{this.channel}} />`);
assert.false(exists(".xss"));
});
@ -40,7 +40,7 @@ module("Discourse Chat | Component | chat-channel-title", function (hooks) {
chatable: fabricators.category({ read_restricted: true }),
});
await render(hbs`<ChatChannelTitle @channel={{this.channel}} />`);
await render(hbs`<ChannelTitle @channel={{this.channel}} />`);
assert.true(exists(".d-icon-lock"));
});
@ -50,7 +50,7 @@ module("Discourse Chat | Component | chat-channel-title", function (hooks) {
chatable: fabricators.category({ read_restricted: false }),
});
await render(hbs`<ChatChannelTitle @channel={{this.channel}} />`);
await render(hbs`<ChannelTitle @channel={{this.channel}} />`);
assert.false(exists(".d-icon-lock"));
});
@ -62,7 +62,7 @@ module("Discourse Chat | Component | chat-channel-title", function (hooks) {
}),
});
await render(hbs`<ChatChannelTitle @channel={{this.channel}} />`);
await render(hbs`<ChannelTitle @channel={{this.channel}} />`);
const user = this.channel.chatable.users[0];
@ -79,7 +79,7 @@ module("Discourse Chat | Component | chat-channel-title", function (hooks) {
});
this.channel.chatable.group = true;
await render(hbs`<ChatChannelTitle @channel={{this.channel}} />`);
await render(hbs`<ChannelTitle @channel={{this.channel}} />`);
const users = this.channel.chatable.users;

View File

@ -429,7 +429,7 @@ module(
);
assert.true(
queryAll(".chat-message-collapser-link-small")[1].innerHTML.includes(
"%3Cscript%3Esomeeviltitle%3C/script%3E"
"&lt;script&gt;someeviltitle&lt;/script&gt;"
)
);
});