mirror of https://github.com/vector-im/riot-web
Update MSC reference
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>t3chguy/msc-is-animated
parent
ef1c7a1650
commit
5a09b081d7
|
@ -24,9 +24,9 @@ declare module "matrix-js-sdk/src/types" {
|
|||
|
||||
export interface ImageInfo {
|
||||
/**
|
||||
* @see https://github.com/matrix-org/matrix-spec-proposals/pull/XXXX
|
||||
* @see https://github.com/matrix-org/matrix-spec-proposals/pull/4230
|
||||
*/
|
||||
"org.matrix.mscXXXX.is_animated"?: boolean;
|
||||
"org.matrix.msc4230.is_animated"?: boolean;
|
||||
}
|
||||
|
||||
export interface StateEvents {
|
||||
|
|
|
@ -159,7 +159,7 @@ async function infoForImageFile(matrixClient: MatrixClient, roomId: string, imag
|
|||
const result = await createThumbnail(imageElement.img, imageElement.width, imageElement.height, thumbnailType);
|
||||
const imageInfo = result.info;
|
||||
|
||||
imageInfo["org.matrix.mscXXXX.is_animated"] = await isAnimatedPromise;
|
||||
imageInfo["org.matrix.msc4230.is_animated"] = await isAnimatedPromise;
|
||||
|
||||
// For lesser supported image types, always include the thumbnail even if it is larger
|
||||
if (!ALWAYS_INCLUDE_THUMBNAIL.includes(imageFile.type)) {
|
||||
|
|
|
@ -275,7 +275,7 @@ export default class MImageBody extends React.Component<IBodyProps, IState> {
|
|||
}
|
||||
|
||||
const content = this.props.mxEvent.getContent<ImageContent>();
|
||||
let isAnimated = content.info?.["org.matrix.mscXXXX.is_animated"] ?? mayBeAnimated(content.info?.mimetype);
|
||||
let isAnimated = content.info?.["org.matrix.msc4230.is_animated"] ?? mayBeAnimated(content.info?.mimetype);
|
||||
|
||||
// If there is no included non-animated thumbnail then we will generate our own, we can't depend on the server
|
||||
// because 1. encryption and 2. we can't ask the server specifically for a non-animated thumbnail.
|
||||
|
@ -300,7 +300,7 @@ export default class MImageBody extends React.Component<IBodyProps, IState> {
|
|||
try {
|
||||
const blob = await this.props.mediaEventHelper!.sourceBlob.value;
|
||||
if (
|
||||
content.info?.["org.matrix.mscXXXX.is_animated"] === false ||
|
||||
content.info?.["org.matrix.msc4230.is_animated"] === false ||
|
||||
!(await blobIsAnimated(content.info?.mimetype, blob))
|
||||
) {
|
||||
isAnimated = false;
|
||||
|
|
Loading…
Reference in New Issue