Compare commits

...

3 Commits

5 changed files with 42 additions and 19 deletions

View File

@ -19,7 +19,26 @@ export const meta = {
optional: false, nullable: false,
items: {
type: 'object',
optional: false, nullable: false,
properties: {
id: {
type: 'string',
optional: false, nullable: false,
},
reactions: {
type: 'object',
optional: false, nullable: false,
additionalProperties: {
type: 'number',
},
},
reactionEmojis: {
type: 'object',
optional: false, nullable: false,
additionalProperties: {
type: 'string',
},
},
},
},
},

View File

@ -187,6 +187,8 @@ export type ReactiveNoteData = {
pollChoices: NonNullable<Misskey.entities.Note['poll']>['choices'];
};
const noReaction = Symbol();
export function useNoteCapture(props: {
note: Misskey.entities.Note;
parentNote: Misskey.entities.Note | null;
@ -219,7 +221,7 @@ export function useNoteCapture(props: {
noteEvents.on(`pollVoted:${note.id}`, onPollVoted);
// 操作がダブっていないかどうかを簡易的に記録するためのMap
const reactionUserMap = new Map<Misskey.entities.User['id'], string>();
const reactionUserMap = new Map<Misskey.entities.User['id'], string | typeof noReaction>();
let latestPollVotedKey: string | null = null;
function onReacted(ctx: { userId: Misskey.entities.User['id']; reaction: string; emoji?: { name: string; url: string; }; }): void {
@ -245,8 +247,9 @@ export function useNoteCapture(props: {
function onUnreacted(ctx: { userId: Misskey.entities.User['id']; reaction: string; emoji?: { name: string; url: string; }; }): void {
const normalizedName = ctx.reaction.replace(/^:(\w+):$/, ':$1@.:');
if (!reactionUserMap.has(ctx.userId)) return;
reactionUserMap.delete(ctx.userId);
// 確実に一度リアクションされて取り消されている場合のみ処理をとめるAPIで初回読み込み→Streamでアップデート等の場合、reactionUserMapに情報がないため
if (reactionUserMap.has(ctx.userId) && reactionUserMap.get(ctx.userId) === noReaction) return;
reactionUserMap.set(ctx.userId, noReaction);
const currentCount = $note.reactions[normalizedName] || 0;

View File

@ -101,27 +101,15 @@ html._themeChanging_ {
}
html::view-transition-new(theme-changing) {
z-index: 4000001;
animation: themeChangingNew 0.5s ease;
animation-fill-mode: forwards;
z-index: 4000000;
}
html::view-transition-old(theme-changing) {
z-index: 4000000;
z-index: 4000001;
animation: themeChangingOld 0.5s ease;
animation-fill-mode: forwards;
}
@keyframes themeChangingNew {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
@keyframes themeChangingOld {
0% {
opacity: 1;

View File

@ -15,6 +15,7 @@ import { globalEvents } from '@/events.js';
import { miLocalStorage } from '@/local-storage.js';
import { $i } from '@/i.js';
import { prefer } from '@/preferences.js';
import { deepEqual } from '@/utility/deep-equal.js';
export type Theme = {
id: string;
@ -127,6 +128,7 @@ function applyThemeInternal(theme: Theme, persist: boolean) {
}
let timeout: number | null = null;
let currentTheme: Theme | null = null;
export function applyTheme(theme: Theme, persist = true) {
if (timeout) {
@ -134,6 +136,9 @@ export function applyTheme(theme: Theme, persist = true) {
timeout = null;
}
if (deepEqual(currentTheme, theme)) return;
currentTheme = theme;
if (window.document.startViewTransition != null && prefer.s.animation) {
window.document.documentElement.classList.add('_themeChanging_');
window.document.startViewTransition(async () => {

View File

@ -25919,7 +25919,15 @@ export type operations = {
/** @description OK (with results) */
200: {
content: {
'application/json': Record<string, never>[];
'application/json': {
id: string;
reactions: {
[key: string]: number;
};
reactionEmojis: {
[key: string]: string;
};
}[];
};
};
/** @description Client error */