diff --git a/packages/client/src/components/emoji-picker-window.vue b/packages/client/src/components/emoji-picker-window.vue index 4d27fb48b..ad1ceed73 100644 --- a/packages/client/src/components/emoji-picker-window.vue +++ b/packages/client/src/components/emoji-picker-window.vue @@ -17,7 +17,7 @@ import MkWindow from '@/components/ui/window.vue'; import MkEmojiPicker from '@/components/emoji-picker.vue'; withDefaults(defineProps<{ - src?: HTMLElement; + src?: HTMLElement | EventTarget; showPinned?: boolean; asReactionPicker?: boolean; }>(), { diff --git a/packages/client/src/os.ts b/packages/client/src/os.ts index c16ea717a..bbe27b97d 100644 --- a/packages/client/src/os.ts +++ b/packages/client/src/os.ts @@ -422,7 +422,7 @@ type AwaitType = T; let openingEmojiPicker: AwaitType> | null = null; let activeTextarea: HTMLTextAreaElement | HTMLInputElement | null = null; -export async function openEmojiPicker(src?: HTMLElement, opts, initialTextarea: typeof activeTextarea) { +export async function openEmojiPicker(src?: HTMLElement | EventTarget | null, opts, initialTextarea: typeof activeTextarea) { if (openingEmojiPicker) return; activeTextarea = initialTextarea; diff --git a/packages/client/src/pages/messaging/messaging-room.form.vue b/packages/client/src/pages/messaging/messaging-room.form.vue index 598769c8e..7a810594e 100644 --- a/packages/client/src/pages/messaging/messaging-room.form.vue +++ b/packages/client/src/pages/messaging/messaging-room.form.vue @@ -4,219 +4,212 @@ @drop.stop="onDrop" >
{{ file.name }}
- - + - diff --git a/packages/client/src/pages/messaging/messaging-room.vue b/packages/client/src/pages/messaging/messaging-room.vue index 9d8f7c094..12f37a5e4 100644 --- a/packages/client/src/pages/messaging/messaging-room.vue +++ b/packages/client/src/pages/messaging/messaging-room.vue @@ -63,7 +63,7 @@ const props = defineProps<{ groupId?: string; }>(); -let rootEl = $ref(); +let rootEl = $ref(); let formEl = $ref>(); let pagingComponent = $ref>(); @@ -88,16 +88,18 @@ async function fetch() { fetching = true; if (props.userAcct) { - user = await os.api('users/show', Acct.parse(props.userAcct)); + const acct = Acct.parse(props.userAcct); + user = await os.api('users/show', { username: acct.username, host: acct.host || undefined }); group = null; pagination = { endpoint: 'messaging/messages', + limit: 20, params: { userId: user.id, }, reversed: true, - pageEl: $$(rootEl), + pageEl: $$(rootEl).value, }; connection = stream.useChannel('messaging', { otherparty: user.id, @@ -108,14 +110,15 @@ async function fetch() { pagination = { endpoint: 'messaging/messages', + limit: 20, params: { - groupId: group.id, + groupId: group?.id, }, reversed: true, - pageEl: $$(rootEl), + pageEl: $$(rootEl).value, }; connection = stream.useChannel('messaging', { - group: group.id, + group: group?.id, }); } @@ -124,7 +127,7 @@ async function fetch() { connection.on('read', onRead); connection.on('deleted', onDeleted); connection.on('typers', typers => { - typers = typers.filter(u => u.id !== $i.id); + typers = typers.filter(u => u.id !== $i?.id); }); document.addEventListener('visibilitychange', onVisibilitychange); @@ -182,7 +185,7 @@ function onMessage(message) { const _isBottom = isBottom(rootEl, 64); pagingComponent.prepend(message); - if (message.userId != $i.id && !document.hidden) { + if (message.userId != $i?.id && !document.hidden) { connection?.send('read', { id: message.id }); @@ -193,7 +196,7 @@ function onMessage(message) { nextTick(() => { scrollToBottom(); }); - } else if (message.userId != $i.id) { + } else if (message.userId != $i?.id) { // Notify notifyNewMessage(); } @@ -251,7 +254,7 @@ function notifyNewMessage() { function onVisibilitychange() { if (document.hidden) return; for (const message of pagingComponent.items) { - if (message.userId !== $i.id && !message.isRead) { + if (message.userId !== $i?.id && !message.isRead) { connection?.send('read', { id: message.id });