Revert "reactiveやめる"

This reverts commit 442742c371.
This commit is contained in:
tai-cha 2025-05-12 09:42:54 +09:00
parent 25afca99b8
commit 1f470372ed
No known key found for this signature in database
GPG Key ID: 1D5EE39F870DC283
5 changed files with 8 additions and 15 deletions

View File

@ -168,7 +168,6 @@ async function menu(ev) {
os.confirm({
type: 'question',
title: i18n.tsx.unmuteX({ x: isLocalCustomEmoji ? `:${emojiName.value}:` : props.reaction }),
text: i18n.ts.reloadToApplySetting,
}).then(({ canceled }) => {
if (canceled) return;
unmuteEmoji(props.reaction);
@ -183,7 +182,6 @@ async function menu(ev) {
os.confirm({
type: 'question',
title: i18n.tsx.muteX({ x: isLocalCustomEmoji ? `:${emojiName.value}:` : props.reaction }),
text: i18n.ts.reloadToApplySetting,
}).then(({ canceled }) => {
if (canceled) return;
muteEmoji(props.reaction);

View File

@ -199,7 +199,6 @@ function mute() {
os.confirm({
type: 'question',
title: i18n.tsx.muteX({ x: titleEmojiName }),
text: i18n.ts.reloadToApplySetting,
}).then(({ canceled }) => {
if (canceled) {
return;
@ -215,7 +214,6 @@ function unmute() {
os.confirm({
type: 'question',
title: i18n.tsx.unmuteX({ x: titleEmojiName }),
text: i18n.ts.reloadToApplySetting,
}).then(({ canceled }) => {
if (canceled) {
return;

View File

@ -47,7 +47,6 @@ function mute() {
os.confirm({
type: 'question',
title: i18n.tsx.muteX({ x: props.emoji }),
text: i18n.ts.reloadToApplySetting,
}).then(({ canceled }) => {
if (canceled) {
return;
@ -60,7 +59,6 @@ function unmute() {
os.confirm({
type: 'question',
title: i18n.tsx.unmuteX({ x: props.emoji }),
text: i18n.ts.reloadToApplySetting,
}).then(({ canceled }) => {
if (canceled) {
return;

View File

@ -72,7 +72,6 @@ function unmute(emoji: string) {
os.confirm({
type: 'question',
title: i18n.tsx.unmuteX({ x: emoji }),
text: i18n.ts.reloadToApplySetting,
}).then(({ canceled }) => {
if (canceled) {
return;

View File

@ -11,12 +11,10 @@ export function makeEmojiMuteKey(props: { name: string; host?: string | null })
return props.name.startsWith(':') ? props.name : `:${props.name}${props.host ? `@${props.host}` : ''}:`;
}
// custom絵文字の名前部分を取り出す
export function extractCustomEmojiName (name:string) {
return (name[0] === ':' ? name.substring(1, name.length - 1) : name).replace('@.', '').split('@')[0];
}
// custom絵文字のホスト部分を取り出す
export function extractCustomEmojiHost (name:string) {
// nameは:emojiName@host:の形式
// 取り出したい部分はhostなので、@以降を取り出す
@ -31,25 +29,27 @@ export function extractCustomEmojiHost (name:string) {
return host;
}
export async function mute(emoji: string) {
export function mute(emoji: string) {
const isCustomEmoji = emoji.startsWith(':') && emoji.endsWith(':');
const emojiMuteKey = isCustomEmoji ?
makeEmojiMuteKey({ name: extractCustomEmojiName(emoji), host: extractCustomEmojiHost(emoji) }) :
emoji;
const mutedEmojis = prefer.s.mutingEmojis;
const mutedEmojis = prefer.r.mutingEmojis.value;
if (!mutedEmojis.includes(emojiMuteKey)) {
return prefer.commit('mutingEmojis', [...mutedEmojis, emojiMuteKey]);
}
throw new Error('Emoji is already muted', { cause: `${emojiMuteKey} is Already Muted` });
}
export async function unmute(emoji:string) {
export function unmute(emoji:string) {
const isCustomEmoji = emoji.startsWith(':') && emoji.endsWith(':');
const emojiMuteKey = isCustomEmoji ?
makeEmojiMuteKey({ name: extractCustomEmojiName(emoji), host: extractCustomEmojiHost(emoji) }) :
emoji;
const mutedEmojis = prefer.s.mutingEmojis;
return prefer.commit('mutingEmojis', mutedEmojis.filter((e) => e !== emojiMuteKey));
const mutedEmojis = prefer.r.mutingEmojis.value;
console.log('unmute', emoji, emojiMuteKey);
console.log('mutedEmojis', mutedEmojis);
prefer.commit('mutingEmojis', mutedEmojis.filter((e) => e !== emojiMuteKey));
}
export function checkMuted(emoji: string) {
@ -57,5 +57,5 @@ export function checkMuted(emoji: string) {
const emojiMuteKey = isCustomEmoji ?
makeEmojiMuteKey({ name: extractCustomEmojiName(emoji), host: extractCustomEmojiHost(emoji) }) :
emoji;
return computed(() => prefer.s.mutingEmojis.includes(emojiMuteKey));
return computed(() => prefer.r.mutingEmojis.value.includes(emojiMuteKey));
}