You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-07-09 14:21:50 +03:00
Move editEvent()
to EventUtils
(#7836)
This commit is contained in:
@ -23,8 +23,12 @@ import { M_POLL_START } from "matrix-events-sdk";
|
||||
|
||||
import { MatrixClientPeg } from '../MatrixClientPeg';
|
||||
import shouldHideEvent from "../shouldHideEvent";
|
||||
import { getHandlerTile, haveTileForEvent } from "../components/views/rooms/EventTile";
|
||||
import { getHandlerTile, GetRelationsForEvent, haveTileForEvent } from "../components/views/rooms/EventTile";
|
||||
import SettingsStore from "../settings/SettingsStore";
|
||||
import defaultDispatcher from "../dispatcher/dispatcher";
|
||||
import { TimelineRenderingType } from "../contexts/RoomContext";
|
||||
import { launchPollEditor } from "../components/views/messages/MPollBody";
|
||||
import { Action } from "../dispatcher/actions";
|
||||
|
||||
/**
|
||||
* Returns whether an event should allow actions like reply, reactions, edit, etc.
|
||||
@ -312,3 +316,21 @@ export async function fetchInitialEvent(
|
||||
|
||||
return initialEvent;
|
||||
}
|
||||
|
||||
export function editEvent(
|
||||
mxEvent: MatrixEvent,
|
||||
timelineRenderingType: TimelineRenderingType,
|
||||
getRelationsForEvent?: GetRelationsForEvent,
|
||||
): void {
|
||||
if (!canEditContent(mxEvent)) return;
|
||||
|
||||
if (M_POLL_START.matches(mxEvent.getType())) {
|
||||
launchPollEditor(mxEvent, getRelationsForEvent);
|
||||
} else {
|
||||
defaultDispatcher.dispatch({
|
||||
action: Action.EditEvent,
|
||||
event: mxEvent,
|
||||
timelineRenderingType: timelineRenderingType,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user