mirror of
https://github.com/cinnyapp/cinny.git
synced 2025-01-29 01:28:29 +00:00
fix enc msg appear as decrypting after deletion
This commit is contained in:
parent
24491db390
commit
6e10cdbdea
|
@ -1280,6 +1280,7 @@ export function RoomTimeline({ room, eventId, roomInputRef, editor }: RoomTimeli
|
|||
>
|
||||
<EncryptedContent mEvent={mEvent}>
|
||||
{() => {
|
||||
if (mEvent.isRedacted()) return <MessageDeletedContent />;
|
||||
if (mEvent.getType() === MessageEvent.Sticker)
|
||||
return <StickerContent mEvent={mEvent} autoPlay={mediaAutoLoad} />;
|
||||
if (mEvent.getType() === MessageEvent.RoomMessage)
|
||||
|
|
|
@ -7,11 +7,12 @@ type EncryptedContentProps = {
|
|||
};
|
||||
|
||||
export function EncryptedContent({ mEvent, children }: EncryptedContentProps) {
|
||||
const [, setDecrypted] = useState(mEvent.isBeingDecrypted());
|
||||
const [, toggleDecrypted] = useState(!mEvent.isBeingDecrypted());
|
||||
|
||||
useEffect(() => {
|
||||
const handleDecrypted: MatrixEventHandlerMap[MatrixEventEvent.Decrypted] = () =>
|
||||
setDecrypted(true);
|
||||
const handleDecrypted: MatrixEventHandlerMap[MatrixEventEvent.Decrypted] = () => {
|
||||
toggleDecrypted((s) => !s);
|
||||
};
|
||||
mEvent.on(MatrixEventEvent.Decrypted, handleDecrypted);
|
||||
return () => {
|
||||
mEvent.removeListener(MatrixEventEvent.Decrypted, handleDecrypted);
|
||||
|
|
Loading…
Reference in a new issue