Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Sort the pinning message list in the same order than the banner. By timeline order. #12937

Merged
merged 2 commits into from
Aug 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/components/views/right_panel/PinnedMessagesCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import { filterBoolean } from "../../../utils/arrays";
import Modal from "../../../Modal";
import { UnpinAllDialog } from "../dialogs/UnpinAllDialog";
import EmptyState from "./EmptyState";
import { useFetchedPinnedEvents, usePinnedEvents, useReadPinnedEvents } from "../../../hooks/usePinnedEvents";
import { usePinnedEvents, useReadPinnedEvents, useSortedFetchedPinnedEvents } from "../../../hooks/usePinnedEvents";

/**
* List the pinned messages in a room inside a Card.
Expand All @@ -59,7 +59,7 @@ export function PinnedMessagesCard({ room, onClose, permalinkCreator }: PinnedMe
const roomContext = useRoomContext();
const pinnedEventIds = usePinnedEvents(room);
const readPinnedEvents = useReadPinnedEvents(room);
const pinnedEvents = useFetchedPinnedEvents(room, pinnedEventIds);
const pinnedEvents = useSortedFetchedPinnedEvents(room, pinnedEventIds);

useEffect(() => {
if (!cli || cli.isGuest()) return; // nothing to do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,12 +165,14 @@ describe("<PinnedMessagesCard />", () => {
room: "!room:example.org",
user: "@alice:example.org",
msg: "First pinned message",
ts: 2,
});
const pin2 = mkMessage({
event: true,
room: "!room:example.org",
user: "@alice:example.org",
msg: "The second one",
ts: 1,
});

it("should show spinner whilst loading", async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ exports[`<PinnedMessagesCard /> should show two pinned messages 1`] = `
class="mx_EventTile_body translate"
dir="auto"
>
The second one
First pinned message
</div>
</div>
</div>
Expand Down Expand Up @@ -250,7 +250,7 @@ exports[`<PinnedMessagesCard /> should show two pinned messages 1`] = `
class="mx_EventTile_body translate"
dir="auto"
>
First pinned message
The second one
</div>
</div>
</div>
Expand Down Expand Up @@ -379,7 +379,7 @@ exports[`<PinnedMessagesCard /> unpin all should not allow to unpinall 1`] = `
class="mx_EventTile_body translate"
dir="auto"
>
The second one
First pinned message
</div>
</div>
</div>
Expand Down Expand Up @@ -445,7 +445,7 @@ exports[`<PinnedMessagesCard /> unpin all should not allow to unpinall 1`] = `
class="mx_EventTile_body translate"
dir="auto"
>
First pinned message
The second one
</div>
</div>
</div>
Expand Down
Loading