1
0

enhance: チャットのリアクションを削除できるように

This commit is contained in:
syuilo
2025-03-25 16:09:19 +09:00
parent 8e72c68205
commit 98554579ea
11 changed files with 226 additions and 16 deletions
+12
View File
@@ -170,6 +170,7 @@ async function initialize() {
connection.value.on('message', onMessage);
connection.value.on('deleted', onDeleted);
connection.value.on('react', onReact);
connection.value.on('unreact', onUnreact);
} else {
const [r, m] = await Promise.all([
misskeyApi('chat/rooms/show', { roomId: props.roomId }),
@@ -189,6 +190,7 @@ async function initialize() {
connection.value.on('message', onMessage);
connection.value.on('deleted', onDeleted);
connection.value.on('react', onReact);
connection.value.on('unreact', onUnreact);
}
window.document.addEventListener('visibilitychange', onVisibilitychange);
@@ -268,6 +270,16 @@ function onReact(ctx) {
}
}
function onUnreact(ctx) {
const message = messages.value.find(m => m.id === ctx.messageId);
if (message) {
const index = message.reactions.findIndex(r => r.reaction === ctx.reaction && r.user.id === ctx.user.id);
if (index !== -1) {
message.reactions.splice(index, 1);
}
}
}
function onIndicatorClick() {
showIndicator.value = false;
}