mirror of
https://github.com/cinnyapp/cinny.git
synced 2025-11-04 22:40:29 +03:00
fix edits does not reflect in pinned messages (#2107)
* fix pinned message edits does not reflect in pinned messages * fix all pinned message show edited * remove console log
This commit is contained in:
parent
b12228ee95
commit
b84f975f83
2 changed files with 10 additions and 3 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
/* eslint-disable react/destructuring-assignment */
|
/* eslint-disable react/destructuring-assignment */
|
||||||
import React, { forwardRef, MouseEventHandler, useCallback, useMemo, useRef } from 'react';
|
import React, { forwardRef, MouseEventHandler, useCallback, useMemo, useRef } from 'react';
|
||||||
import { MatrixEvent, RelationType, Room } from 'matrix-js-sdk';
|
import { MatrixEvent, Room } from 'matrix-js-sdk';
|
||||||
import { RoomPinnedEventsEventContent } from 'matrix-js-sdk/lib/types';
|
import { RoomPinnedEventsEventContent } from 'matrix-js-sdk/lib/types';
|
||||||
import {
|
import {
|
||||||
Avatar,
|
Avatar,
|
||||||
|
|
@ -257,6 +257,7 @@ export const RoomPinMenu = forwardRef<HTMLDivElement, RoomPinMenuProps>(
|
||||||
msgType={event.getContent().msgtype ?? ''}
|
msgType={event.getContent().msgtype ?? ''}
|
||||||
ts={event.getTs()}
|
ts={event.getTs()}
|
||||||
getContent={getContent}
|
getContent={getContent}
|
||||||
|
edited={!!event.replacingEvent()}
|
||||||
mediaAutoLoad={mediaAutoLoad}
|
mediaAutoLoad={mediaAutoLoad}
|
||||||
urlPreview={urlPreview}
|
urlPreview={urlPreview}
|
||||||
htmlReactParserOptions={htmlReactParserOptions}
|
htmlReactParserOptions={htmlReactParserOptions}
|
||||||
|
|
@ -311,7 +312,7 @@ export const RoomPinMenu = forwardRef<HTMLDivElement, RoomPinMenuProps>(
|
||||||
displayName={displayName}
|
displayName={displayName}
|
||||||
msgType={mEvent.getContent().msgtype ?? ''}
|
msgType={mEvent.getContent().msgtype ?? ''}
|
||||||
ts={mEvent.getTs()}
|
ts={mEvent.getTs()}
|
||||||
edited={!!editedEvent}
|
edited={!!editedEvent || !!mEvent.replacingEvent()}
|
||||||
getContent={getContent}
|
getContent={getContent}
|
||||||
mediaAutoLoad={mediaAutoLoad}
|
mediaAutoLoad={mediaAutoLoad}
|
||||||
urlPreview={urlPreview}
|
urlPreview={urlPreview}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import { MatrixEvent, Room } from 'matrix-js-sdk';
|
import { IEvent, MatrixEvent, Room } from 'matrix-js-sdk';
|
||||||
import { useCallback, useMemo } from 'react';
|
import { useCallback, useMemo } from 'react';
|
||||||
import to from 'await-to-js';
|
import to from 'await-to-js';
|
||||||
import { CryptoBackend } from 'matrix-js-sdk/lib/common-crypto/CryptoBackend';
|
import { CryptoBackend } from 'matrix-js-sdk/lib/common-crypto/CryptoBackend';
|
||||||
|
|
@ -12,6 +12,12 @@ const useFetchEvent = (room: Room, eventId: string) => {
|
||||||
const evt = await mx.fetchRoomEvent(room.roomId, eventId);
|
const evt = await mx.fetchRoomEvent(room.roomId, eventId);
|
||||||
const mEvent = new MatrixEvent(evt);
|
const mEvent = new MatrixEvent(evt);
|
||||||
|
|
||||||
|
if (evt.unsigned?.['m.relations'] && evt.unsigned?.['m.relations']['m.replace']) {
|
||||||
|
const replaceEvt = evt.unsigned?.['m.relations']['m.replace'] as IEvent;
|
||||||
|
const replaceEvent = new MatrixEvent(replaceEvt);
|
||||||
|
mEvent.makeReplaced(replaceEvent);
|
||||||
|
}
|
||||||
|
|
||||||
if (mEvent.isEncrypted() && mx.getCrypto()) {
|
if (mEvent.isEncrypted() && mx.getCrypto()) {
|
||||||
await to(mEvent.attemptDecryption(mx.getCrypto() as CryptoBackend));
|
await to(mEvent.attemptDecryption(mx.getCrypto() as CryptoBackend));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue