Various fixes (#4836)
This commit is contained in:
parent
629f979c5a
commit
eddce446de
@ -24,7 +24,7 @@ import { buildApiMessage, setMessageBuilderCurrentUserId } from '../apiBuilders/
|
|||||||
import { buildApiPeerId } from '../apiBuilders/peers';
|
import { buildApiPeerId } from '../apiBuilders/peers';
|
||||||
import { buildApiStory } from '../apiBuilders/stories';
|
import { buildApiStory } from '../apiBuilders/stories';
|
||||||
import { buildApiUser, buildApiUserFullInfo } from '../apiBuilders/users';
|
import { buildApiUser, buildApiUserFullInfo } from '../apiBuilders/users';
|
||||||
import { buildInputPeerFromLocalDb } from '../gramjsBuilders';
|
import { buildInputPeerFromLocalDb, getEntityTypeById } from '../gramjsBuilders';
|
||||||
import {
|
import {
|
||||||
addEntitiesToLocalDb, addMessageToLocalDb, addStoryToLocalDb, addUserToLocalDb, isResponseUpdate, log,
|
addEntitiesToLocalDb, addMessageToLocalDb, addStoryToLocalDb, addUserToLocalDb, isResponseUpdate, log,
|
||||||
} from '../helpers';
|
} from '../helpers';
|
||||||
@ -465,10 +465,11 @@ export async function repairFileReference({
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function repairMessageMedia(peerId: string, messageId: number) {
|
async function repairMessageMedia(peerId: string, messageId: number) {
|
||||||
|
const type = getEntityTypeById(peerId);
|
||||||
const peer = buildInputPeerFromLocalDb(peerId);
|
const peer = buildInputPeerFromLocalDb(peerId);
|
||||||
if (!peer) return false;
|
if (!peer) return false;
|
||||||
const result = await invokeRequest(
|
const result = await invokeRequest(
|
||||||
peer
|
type === 'channel'
|
||||||
? new GramJs.channels.GetMessages({
|
? new GramJs.channels.GetMessages({
|
||||||
channel: peer,
|
channel: peer,
|
||||||
id: [new GramJs.InputMessageID({ id: messageId })],
|
id: [new GramJs.InputMessageID({ id: messageId })],
|
||||||
|
|||||||
@ -31,6 +31,7 @@ interface OwnProps {
|
|||||||
forcePlayback?: boolean;
|
forcePlayback?: boolean;
|
||||||
focusedQuote?: string;
|
focusedQuote?: string;
|
||||||
isInSelectMode?: boolean;
|
isInSelectMode?: boolean;
|
||||||
|
canBeEmpty?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
const MIN_CUSTOM_EMOJIS_FOR_SHARED_CANVAS = 3;
|
const MIN_CUSTOM_EMOJIS_FOR_SHARED_CANVAS = 3;
|
||||||
@ -52,6 +53,7 @@ function MessageText({
|
|||||||
forcePlayback,
|
forcePlayback,
|
||||||
focusedQuote,
|
focusedQuote,
|
||||||
isInSelectMode,
|
isInSelectMode,
|
||||||
|
canBeEmpty,
|
||||||
}: OwnProps) {
|
}: OwnProps) {
|
||||||
// eslint-disable-next-line no-null/no-null
|
// eslint-disable-next-line no-null/no-null
|
||||||
const sharedCanvasRef = useRef<HTMLCanvasElement>(null);
|
const sharedCanvasRef = useRef<HTMLCanvasElement>(null);
|
||||||
@ -80,7 +82,7 @@ function MessageText({
|
|||||||
return customEmojisCount >= MIN_CUSTOM_EMOJIS_FOR_SHARED_CANVAS;
|
return customEmojisCount >= MIN_CUSTOM_EMOJIS_FOR_SHARED_CANVAS;
|
||||||
}, [entities]) || 0;
|
}, [entities]) || 0;
|
||||||
|
|
||||||
if (!text) {
|
if (!text && !canBeEmpty) {
|
||||||
return <span className="content-unsupported">{CONTENT_NOT_SUPPORTED}</span>;
|
return <span className="content-unsupported">{CONTENT_NOT_SUPPORTED}</span>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -107,7 +107,7 @@ const StickerView: FC<OwnProps> = ({
|
|||||||
const thumbData = customColor ? thumbDataUri : (previewMediaData || thumbDataUri);
|
const thumbData = customColor ? thumbDataUri : (previewMediaData || thumbDataUri);
|
||||||
|
|
||||||
const shouldForcePreview = isUnsupportedVideo || (isStatic && isSmall);
|
const shouldForcePreview = isUnsupportedVideo || (isStatic && isSmall);
|
||||||
fullMediaHash ||= shouldForcePreview ? previewMediaHash : `sticker${id}`;
|
fullMediaHash = shouldForcePreview ? previewMediaHash : (fullMediaHash || `sticker${id}`);
|
||||||
|
|
||||||
// If preloaded preview is forced, it will render as thumb, so no need to load it again
|
// If preloaded preview is forced, it will render as thumb, so no need to load it again
|
||||||
const shouldSkipFullMedia = Boolean(fullMediaHash === previewMediaHash && previewMediaData);
|
const shouldSkipFullMedia = Boolean(fullMediaHash === previewMediaHash && previewMediaData);
|
||||||
|
|||||||
@ -980,6 +980,7 @@ const Message: FC<OwnProps & StateProps> = ({
|
|||||||
observeIntersectionForPlaying={observeIntersectionForPlaying}
|
observeIntersectionForPlaying={observeIntersectionForPlaying}
|
||||||
withTranslucentThumbs={isCustomShape}
|
withTranslucentThumbs={isCustomShape}
|
||||||
isInSelectMode={isInSelectMode}
|
isInSelectMode={isInSelectMode}
|
||||||
|
canBeEmpty={hasFactCheck}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user