mirror of
https://github.com/discourse/discourse.git
synced 2025-05-21 18:12:32 +08:00
FEATURE: Scroll to first message when clicking date in chat (#21926)
This PR adds a new parameter to fetch chat messages: `target_date`. It can be used to fetch messages by a specific date string. Note that it does not need to be the `created_at` date of an existing message, it can be any date. Similar to `target_message_id`, it retrieves an array of past and future messages following the query limits.
This commit is contained in:
@ -11,9 +11,12 @@ module(
|
||||
|
||||
test("first message of the day", async function (assert) {
|
||||
this.set("date", moment().format("LLL"));
|
||||
this.set("message", { firstMessageOfTheDayAt: this.date });
|
||||
this.set("message", { formattedFirstMessageDate: this.date });
|
||||
this.set("fetchMessagesByDate", () => {});
|
||||
|
||||
await render(hbs`<ChatMessageSeparatorDate @message={{this.message}} />`);
|
||||
await render(
|
||||
hbs`<ChatMessageSeparatorDate @message={{this.message}} @fetchMessagesByDate={{this.fetchMessagesByDate}} />`
|
||||
);
|
||||
|
||||
assert.strictEqual(
|
||||
query(".chat-message-separator-date").innerText.trim(),
|
||||
|
Reference in New Issue
Block a user