Migrate all pinning checks and actions into PinningUtils
(#12964)
This commit is contained in:
parent
26399237f6
commit
5bfbca9eb0
8 changed files with 146 additions and 67 deletions
|
@ -16,11 +16,12 @@
|
|||
|
||||
import React, { JSX } from "react";
|
||||
import { Button, Text } from "@vector-im/compound-web";
|
||||
import { EventType, MatrixClient } from "matrix-js-sdk/src/matrix";
|
||||
import { MatrixClient } from "matrix-js-sdk/src/matrix";
|
||||
import { logger } from "matrix-js-sdk/src/logger";
|
||||
|
||||
import BaseDialog from "../dialogs/BaseDialog";
|
||||
import { _t } from "../../../languageHandler";
|
||||
import PinningUtils from "../../../utils/PinningUtils.ts";
|
||||
|
||||
/**
|
||||
* Properties for {@link UnpinAllDialog}.
|
||||
|
@ -59,7 +60,7 @@ export function UnpinAllDialog({ matrixClient, roomId, onFinished }: UnpinAllDia
|
|||
destructive={true}
|
||||
onClick={async () => {
|
||||
try {
|
||||
await matrixClient.sendStateEvent(roomId, EventType.RoomPinnedEvents, { pinned: [] }, "");
|
||||
await PinningUtils.unpinAllEvents(matrixClient, roomId);
|
||||
} catch (e) {
|
||||
logger.error("Failed to unpin all events:", e);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue