{
+ const mimetype = image.info?.mimetype?.toLowerCase();
+ if (mimetype && ANIMATED_MIME_TYPES.has(mimetype)) return true;
+
+ const body = image.body?.toLowerCase();
+ return !!body && (body.endsWith('.gif') || body.endsWith('.webp') || body.endsWith('.apng'));
+};
+
+const getPackImageSrc = (
+ mx: MatrixClient,
+ image: PackImageReader,
+ useAuthentication: boolean | undefined,
+ saveStickerEmojiBandwidth: boolean,
+ width: number,
+ height: number
+): string => {
+ const preserveAnimation = isAnimatedPackImage(image);
+
+ return preserveAnimation || !saveStickerEmojiBandwidth
+ ? (mxcUrlToHttp(mx, image.url, useAuthentication) ?? '')
+ : (mxcUrlToHttp(mx, image.url, useAuthentication, width, height) ?? '');
+};
+
export const getEmojiItemInfo = (element: Element): EmojiItemInfo | undefined => {
const label = element.getAttribute('title');
const type = element.getAttribute('data-emoji-type') as EmojiType | undefined;
@@ -48,8 +73,14 @@ type CustomEmojiItemProps = {
mx: MatrixClient;
useAuthentication?: boolean;
image: PackImageReader;
+ saveStickerEmojiBandwidth: boolean;
};
-export function CustomEmojiItem({ mx, useAuthentication, image }: CustomEmojiItemProps) {
+export function CustomEmojiItem({
+ mx,
+ useAuthentication,
+ image,
+ saveStickerEmojiBandwidth,
+}: CustomEmojiItemProps) {
return (
);
@@ -77,9 +108,15 @@ type StickerItemProps = {
mx: MatrixClient;
useAuthentication?: boolean;
image: PackImageReader;
+ saveStickerEmojiBandwidth: boolean;
};
-export function StickerItem({ mx, useAuthentication, image }: StickerItemProps) {
+export function StickerItem({
+ mx,
+ useAuthentication,
+ image,
+ saveStickerEmojiBandwidth,
+}: StickerItemProps) {
return (
);
diff --git a/src/app/components/event-history/EventHistory.tsx b/src/app/components/event-history/EventHistory.tsx
index 2bc87a235..955a2846f 100644
--- a/src/app/components/event-history/EventHistory.tsx
+++ b/src/app/components/event-history/EventHistory.tsx
@@ -121,7 +121,7 @@ export const EventHistory = as<'div', EventHistoryProps>(
[room, setReplyDraft]
);
- function MenuOptions({ mEvent }: { mEvent: MatrixEvent }) {
+ function MenuOptions({ mEvent }: Readonly<{ mEvent: MatrixEvent }>) {
const setModal = useSetAtom(modalAtom);
return (
)}
- {replyDraft && (
+ {replyDraft && (!threadRootId || replyDraft.body) && (