reactiveやめる
This commit is contained in:
parent
c3c11d25ce
commit
442742c371
|
@ -147,6 +147,7 @@ async function menu(ev) {
|
||||||
os.confirm({
|
os.confirm({
|
||||||
type: 'question',
|
type: 'question',
|
||||||
title: i18n.tsx.unmuteX({ x: isLocalCustomEmoji ? `:${emojiName.value}:` : props.reaction }),
|
title: i18n.tsx.unmuteX({ x: isLocalCustomEmoji ? `:${emojiName.value}:` : props.reaction }),
|
||||||
|
text: i18n.ts.reloadToApplySetting,
|
||||||
}).then(({ canceled }) => {
|
}).then(({ canceled }) => {
|
||||||
if (canceled) return;
|
if (canceled) return;
|
||||||
unmuteEmoji(props.reaction);
|
unmuteEmoji(props.reaction);
|
||||||
|
@ -161,6 +162,7 @@ async function menu(ev) {
|
||||||
os.confirm({
|
os.confirm({
|
||||||
type: 'question',
|
type: 'question',
|
||||||
title: i18n.tsx.muteX({ x: isLocalCustomEmoji ? `:${emojiName.value}:` : props.reaction }),
|
title: i18n.tsx.muteX({ x: isLocalCustomEmoji ? `:${emojiName.value}:` : props.reaction }),
|
||||||
|
text: i18n.ts.reloadToApplySetting,
|
||||||
}).then(({ canceled }) => {
|
}).then(({ canceled }) => {
|
||||||
if (canceled) return;
|
if (canceled) return;
|
||||||
muteEmoji(props.reaction);
|
muteEmoji(props.reaction);
|
||||||
|
|
|
@ -199,6 +199,7 @@ function mute() {
|
||||||
os.confirm({
|
os.confirm({
|
||||||
type: 'question',
|
type: 'question',
|
||||||
title: i18n.tsx.muteX({ x: titleEmojiName }),
|
title: i18n.tsx.muteX({ x: titleEmojiName }),
|
||||||
|
text: i18n.ts.reloadToApplySetting,
|
||||||
}).then(({ canceled }) => {
|
}).then(({ canceled }) => {
|
||||||
if (canceled) {
|
if (canceled) {
|
||||||
return;
|
return;
|
||||||
|
@ -214,6 +215,7 @@ function unmute() {
|
||||||
os.confirm({
|
os.confirm({
|
||||||
type: 'question',
|
type: 'question',
|
||||||
title: i18n.tsx.unmuteX({ x: titleEmojiName }),
|
title: i18n.tsx.unmuteX({ x: titleEmojiName }),
|
||||||
|
text: i18n.ts.reloadToApplySetting,
|
||||||
}).then(({ canceled }) => {
|
}).then(({ canceled }) => {
|
||||||
if (canceled) {
|
if (canceled) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -47,6 +47,7 @@ function mute() {
|
||||||
os.confirm({
|
os.confirm({
|
||||||
type: 'question',
|
type: 'question',
|
||||||
title: i18n.tsx.muteX({ x: props.emoji }),
|
title: i18n.tsx.muteX({ x: props.emoji }),
|
||||||
|
text: i18n.ts.reloadToApplySetting,
|
||||||
}).then(({ canceled }) => {
|
}).then(({ canceled }) => {
|
||||||
if (canceled) {
|
if (canceled) {
|
||||||
return;
|
return;
|
||||||
|
@ -59,6 +60,7 @@ function unmute() {
|
||||||
os.confirm({
|
os.confirm({
|
||||||
type: 'question',
|
type: 'question',
|
||||||
title: i18n.tsx.unmuteX({ x: props.emoji }),
|
title: i18n.tsx.unmuteX({ x: props.emoji }),
|
||||||
|
text: i18n.ts.reloadToApplySetting,
|
||||||
}).then(({ canceled }) => {
|
}).then(({ canceled }) => {
|
||||||
if (canceled) {
|
if (canceled) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -72,6 +72,7 @@ function unmute(emoji: string) {
|
||||||
os.confirm({
|
os.confirm({
|
||||||
type: 'question',
|
type: 'question',
|
||||||
title: i18n.tsx.unmuteX({ x: emoji }),
|
title: i18n.tsx.unmuteX({ x: emoji }),
|
||||||
|
text: i18n.ts.reloadToApplySetting,
|
||||||
}).then(({ canceled }) => {
|
}).then(({ canceled }) => {
|
||||||
if (canceled) {
|
if (canceled) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -11,10 +11,12 @@ export function makeEmojiMuteKey(props: { name: string; host?: string | null })
|
||||||
return props.name.startsWith(':') ? props.name : `:${props.name}${props.host ? `@${props.host}` : ''}:`;
|
return props.name.startsWith(':') ? props.name : `:${props.name}${props.host ? `@${props.host}` : ''}:`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// custom絵文字の名前部分を取り出す
|
||||||
export function extractCustomEmojiName (name:string) {
|
export function extractCustomEmojiName (name:string) {
|
||||||
return (name[0] === ':' ? name.substring(1, name.length - 1) : name).replace('@.', '').split('@')[0];
|
return (name[0] === ':' ? name.substring(1, name.length - 1) : name).replace('@.', '').split('@')[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// custom絵文字のホスト部分を取り出す
|
||||||
export function extractCustomEmojiHost (name:string) {
|
export function extractCustomEmojiHost (name:string) {
|
||||||
// nameは:emojiName@host:の形式
|
// nameは:emojiName@host:の形式
|
||||||
// 取り出したい部分はhostなので、@以降を取り出す
|
// 取り出したい部分はhostなので、@以降を取り出す
|
||||||
|
@ -29,26 +31,25 @@ export function extractCustomEmojiHost (name:string) {
|
||||||
return host;
|
return host;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function mute(emoji: string) {
|
export async function mute(emoji: string) {
|
||||||
const isCustomEmoji = emoji.startsWith(':') && emoji.endsWith(':');
|
const isCustomEmoji = emoji.startsWith(':') && emoji.endsWith(':');
|
||||||
const emojiMuteKey = isCustomEmoji ?
|
const emojiMuteKey = isCustomEmoji ?
|
||||||
makeEmojiMuteKey({ name: extractCustomEmojiName(emoji), host: extractCustomEmojiHost(emoji) }) :
|
makeEmojiMuteKey({ name: extractCustomEmojiName(emoji), host: extractCustomEmojiHost(emoji) }) :
|
||||||
emoji;
|
emoji;
|
||||||
const mutedEmojis = prefer.r.mutingEmojis.value;
|
const mutedEmojis = prefer.s.mutingEmojis;
|
||||||
if (!mutedEmojis.includes(emoji)) {
|
if (!mutedEmojis.includes(emoji)) {
|
||||||
prefer.commit('mutingEmojis', [...mutedEmojis, emojiMuteKey]);
|
return prefer.commit('mutingEmojis', [...mutedEmojis, emojiMuteKey]);
|
||||||
}
|
}
|
||||||
|
throw new Error('Emoji is already muted');
|
||||||
}
|
}
|
||||||
|
|
||||||
export function unmute(emoji:string) {
|
export async function unmute(emoji:string) {
|
||||||
const isCustomEmoji = emoji.startsWith(':') && emoji.endsWith(':');
|
const isCustomEmoji = emoji.startsWith(':') && emoji.endsWith(':');
|
||||||
const emojiMuteKey = isCustomEmoji ?
|
const emojiMuteKey = isCustomEmoji ?
|
||||||
makeEmojiMuteKey({ name: extractCustomEmojiName(emoji), host: extractCustomEmojiHost(emoji) }) :
|
makeEmojiMuteKey({ name: extractCustomEmojiName(emoji), host: extractCustomEmojiHost(emoji) }) :
|
||||||
emoji;
|
emoji;
|
||||||
const mutedEmojis = prefer.r.mutingEmojis.value;
|
const mutedEmojis = prefer.s.mutingEmojis;
|
||||||
console.log('unmute', emoji, emojiMuteKey);
|
return prefer.commit('mutingEmojis', mutedEmojis.filter((e) => e !== emojiMuteKey));
|
||||||
console.log('mutedEmojis', mutedEmojis);
|
|
||||||
prefer.commit('mutingEmojis', mutedEmojis.filter((e) => e !== emojiMuteKey));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function checkMuted(emoji: string) {
|
export function checkMuted(emoji: string) {
|
||||||
|
@ -56,5 +57,5 @@ export function checkMuted(emoji: string) {
|
||||||
const emojiMuteKey = isCustomEmoji ?
|
const emojiMuteKey = isCustomEmoji ?
|
||||||
makeEmojiMuteKey({ name: extractCustomEmojiName(emoji), host: extractCustomEmojiHost(emoji) }) :
|
makeEmojiMuteKey({ name: extractCustomEmojiName(emoji), host: extractCustomEmojiHost(emoji) }) :
|
||||||
emoji;
|
emoji;
|
||||||
return computed(() => prefer.r.mutingEmojis.value.includes(emojiMuteKey));
|
return computed(() => prefer.s.mutingEmojis.includes(emojiMuteKey));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue