You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-07-28 15:22:05 +03:00
Allow editing polls (#7806)
This commit is contained in:
@ -58,8 +58,14 @@ export function isContentActionable(mxEvent: MatrixEvent): boolean {
|
||||
}
|
||||
|
||||
export function canEditContent(mxEvent: MatrixEvent): boolean {
|
||||
if (mxEvent.status === EventStatus.CANCELLED ||
|
||||
mxEvent.getType() !== EventType.RoomMessage ||
|
||||
const isCancellable = (
|
||||
mxEvent.getType() === EventType.RoomMessage ||
|
||||
M_POLL_START.matches(mxEvent.getType())
|
||||
);
|
||||
|
||||
if (
|
||||
!isCancellable ||
|
||||
mxEvent.status === EventStatus.CANCELLED ||
|
||||
mxEvent.isRedacted() ||
|
||||
mxEvent.isRelation(RelationType.Replace) ||
|
||||
mxEvent.getSender() !== MatrixClientPeg.get().getUserId()
|
||||
@ -68,7 +74,14 @@ export function canEditContent(mxEvent: MatrixEvent): boolean {
|
||||
}
|
||||
|
||||
const { msgtype, body } = mxEvent.getOriginalContent();
|
||||
return (msgtype === MsgType.Text || msgtype === MsgType.Emote) && body && typeof body === 'string';
|
||||
return (
|
||||
M_POLL_START.matches(mxEvent.getType()) ||
|
||||
(
|
||||
(msgtype === MsgType.Text || msgtype === MsgType.Emote) &&
|
||||
body &&
|
||||
typeof body === 'string'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
export function canEditOwnEvent(mxEvent: MatrixEvent): boolean {
|
||||
|
Reference in New Issue
Block a user