Reset read receipt on sending sticker
This commit is contained in:
parent
adb584623e
commit
c6812b5b11
2 changed files with 29 additions and 25 deletions
|
@ -207,30 +207,7 @@ function RoomViewInput({
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleSendSticker = async (data) => {
|
const handleSendSticker = async (data) => {
|
||||||
const { mxc: url, body, httpUrl } = data;
|
roomsInput.sendSticker(roomId, data);
|
||||||
const info = {};
|
|
||||||
|
|
||||||
const img = new Image();
|
|
||||||
img.src = httpUrl;
|
|
||||||
|
|
||||||
try {
|
|
||||||
const res = await fetch(httpUrl);
|
|
||||||
const blob = await res.blob();
|
|
||||||
info.w = img.width;
|
|
||||||
info.h = img.height;
|
|
||||||
info.mimetype = blob.type;
|
|
||||||
info.size = blob.size;
|
|
||||||
info.thumbnail_info = { ...info };
|
|
||||||
info.thumbnail_url = url;
|
|
||||||
} catch {
|
|
||||||
// send sticker without info
|
|
||||||
}
|
|
||||||
|
|
||||||
mx.sendEvent(roomId, 'm.sticker', {
|
|
||||||
body,
|
|
||||||
url,
|
|
||||||
info,
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
function processTyping(msg) {
|
function processTyping(msg) {
|
||||||
|
|
|
@ -6,7 +6,6 @@ import { math } from 'micromark-extension-math';
|
||||||
import { encode } from 'blurhash';
|
import { encode } from 'blurhash';
|
||||||
import { getShortcodeToEmoji } from '../../app/organisms/emoji-board/custom-emoji';
|
import { getShortcodeToEmoji } from '../../app/organisms/emoji-board/custom-emoji';
|
||||||
import { mathExtensionHtml, spoilerExtension, spoilerExtensionHtml } from '../../util/markdown';
|
import { mathExtensionHtml, spoilerExtension, spoilerExtensionHtml } from '../../util/markdown';
|
||||||
import { getImageDimension } from '../../util/common';
|
|
||||||
import cons from './cons';
|
import cons from './cons';
|
||||||
import settings from './settings';
|
import settings from './settings';
|
||||||
|
|
||||||
|
@ -312,6 +311,34 @@ class RoomsInput extends EventEmitter {
|
||||||
this.emit(cons.events.roomsInput.MESSAGE_SENT, roomId);
|
this.emit(cons.events.roomsInput.MESSAGE_SENT, roomId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async sendSticker(roomId, data) {
|
||||||
|
const { mxc: url, body, httpUrl } = data;
|
||||||
|
const info = {};
|
||||||
|
|
||||||
|
const img = new Image();
|
||||||
|
img.src = httpUrl;
|
||||||
|
|
||||||
|
try {
|
||||||
|
const res = await fetch(httpUrl);
|
||||||
|
const blob = await res.blob();
|
||||||
|
info.w = img.width;
|
||||||
|
info.h = img.height;
|
||||||
|
info.mimetype = blob.type;
|
||||||
|
info.size = blob.size;
|
||||||
|
info.thumbnail_info = { ...info };
|
||||||
|
info.thumbnail_url = url;
|
||||||
|
} catch {
|
||||||
|
// send sticker without info
|
||||||
|
}
|
||||||
|
|
||||||
|
this.matrixClient.sendEvent(roomId, 'm.sticker', {
|
||||||
|
body,
|
||||||
|
url,
|
||||||
|
info,
|
||||||
|
});
|
||||||
|
this.emit(cons.events.roomsInput.MESSAGE_SENT, roomId);
|
||||||
|
}
|
||||||
|
|
||||||
async sendFile(roomId, file) {
|
async sendFile(roomId, file) {
|
||||||
const fileType = file.type.slice(0, file.type.indexOf('/'));
|
const fileType = file.type.slice(0, file.type.indexOf('/'));
|
||||||
const info = {
|
const info = {
|
||||||
|
|
Loading…
Reference in a new issue