use our script

This commit is contained in:
ThatOneCalculator 2023-03-16 18:50:32 -07:00
parent 3bac2a8b86
commit e25d8948dd
No known key found for this signature in database
GPG Key ID: 8703CACD01000000
1 changed files with 34 additions and 69 deletions

View File

@ -79,34 +79,13 @@ export function getNoteMenu(props: {
); );
} }
function muteThread(): void { function toggleThreadMute(mute: boolean): void {
// show global settings by default os.apiWithDialog(
const includingTypes = misskey.notificationTypes.filter(x => !$i.mutingNotificationTypes.includes(x)); mute ? "notes/thread-muting/create" : "notes/thread-muting/delete",
os.popup(defineAsyncComponent(() => import('@/components/MkNotificationSettingWindow.vue')), { {
includingTypes, noteId: appearNote.id,
showGlobalToggle: false, },
message: i18n.ts.threadMuteNotificationsDesc, );
notificationTypes: misskey.noteNotificationTypes,
}, {
done: async (res) => {
const { includingTypes: value } = res;
let mutingNotificationTypes: string[] | undefined;
if (value != null) {
mutingNotificationTypes = misskey.noteNotificationTypes.filter(x => !value.includes(x))
}
await os.apiWithDialog('notes/thread-muting/create', {
noteId: appearNote.id,
mutingNotificationTypes,
});
}
}, 'closed');
}
function unmuteThread(): void {
os.apiWithDialog('notes/thread-muting/delete', {
noteId: appearNote.id
});
} }
function copyContent(): void { function copyContent(): void {
@ -343,47 +322,33 @@ export function getNoteMenu(props: {
text: i18n.ts.clip, text: i18n.ts.clip,
action: () => clip(), action: () => clip(),
}, },
(appearNote.userId !== $i.id) ? statePromise.then(state => state.isWatching ? { appearNote.userId !== $i.id
icon: 'ph-eye-slash ph-bold ph-lg', ? statePromise.then((state) =>
text: i18n.ts.unwatch, state.isWatching
action: () => toggleWatch(false), ? {
} : { icon: "ph-eye-slash ph-bold ph-lg",
icon: 'ph-eye ph-bold ph-lg', text: i18n.ts.unwatch,
text: i18n.ts.watch, action: () => toggleWatch(false),
action: () => toggleWatch(true), }
}) : undefined, : {
statePromise.then(state => state.isMutedThread ? { icon: "ph-eye ph-bold ph-lg",
icon: 'ph-speaker-high ph-bold ph-lg', text: i18n.ts.watch,
text: i18n.ts.unmuteThread, action: () => toggleWatch(true),
action: () => unmuteThread(), },
} : { )
icon: 'ph-speaker-x ph-bold ph-lg', : undefined,
text: i18n.ts.muteThread, statePromise.then((state) =>
action: () => muteThread(), state.isMutedThread
}), ? {
appearNote.userId === $i.id ? ($i.pinnedNoteIds || []).includes(appearNote.id) ? { icon: "ph-speaker-loud ph-bold ph-lg",
icon: 'ph-push-pin ph-bold ph-lg', text: i18n.ts.unmuteThread,
text: i18n.ts.unpin, action: () => toggleThreadMute(false),
action: () => togglePin(false), }
} : { : {
icon: 'ph-push-pin ph-bold ph-lg', icon: "ph-speaker-x ph-bold ph-lg",
text: i18n.ts.pin, text: i18n.ts.muteThread,
action: () => togglePin(true), action: () => toggleThreadMute(true),
} : undefined, },
...(appearNote.userId !== $i.id ? [
null,
{
icon: 'fas fa-exclamation-circle',
text: i18n.ts.reportAbuse,
action: () => {
const u = appearNote.url || appearNote.uri || `${url}/notes/${appearNote.id}`;
os.popup(defineAsyncComponent(() => import('@/components/abuse-report-window.vue')), {
user: appearNote.user,
urls: [u],
}, {}, 'closed');
},
}]
: []
), ),
appearNote.userId === $i.id appearNote.userId === $i.id
? ($i.pinnedNoteIds || []).includes(appearNote.id) ? ($i.pinnedNoteIds || []).includes(appearNote.id)