1
1
mirror of https://github.com/kokonect-link/cherrypick synced 2024-10-31 23:31:48 +09:00

enhance(client): ノートメニューからユーザーメニューを開けるように

Resolve #10019
This commit is contained in:
syuilo 2023-02-25 09:18:36 +09:00
parent 64be363adc
commit 5bea4feac8
2 changed files with 12 additions and 7 deletions

View File

@ -9,6 +9,7 @@ import copyToClipboard from '@/scripts/copy-to-clipboard';
import { url } from '@/config'; import { url } from '@/config';
import { noteActions } from '@/store'; import { noteActions } from '@/store';
import { miLocalStorage } from '@/local-storage'; import { miLocalStorage } from '@/local-storage';
import { getUserMenu } from '@/scripts/get-user-menu';
export function getNoteMenu(props: { export function getNoteMenu(props: {
note: misskey.entities.Note; note: misskey.entities.Note;
@ -284,6 +285,15 @@ export function getNoteMenu(props: {
text: i18n.ts.pin, text: i18n.ts.pin,
action: () => togglePin(true), action: () => togglePin(true),
} : undefined, } : undefined,
appearNote.userId !== $i.id ? {
type: 'parent',
icon: 'ti ti-user',
text: i18n.ts.user,
children: async () => {
const user = await os.api('users/show', { userId: appearNote.userId });
return getUserMenu(user);
},
} : undefined,
/* /*
...($i.isModerator || $i.isAdmin ? [ ...($i.isModerator || $i.isAdmin ? [
null, null,

View File

@ -1,4 +1,5 @@
import { defineAsyncComponent } from 'vue'; import { defineAsyncComponent } from 'vue';
import * as misskey from 'misskey-js';
import { i18n } from '@/i18n'; import { i18n } from '@/i18n';
import copyToClipboard from '@/scripts/copy-to-clipboard'; import copyToClipboard from '@/scripts/copy-to-clipboard';
import { host } from '@/config'; import { host } from '@/config';
@ -8,7 +9,7 @@ import { $i, iAmModerator } from '@/account';
import { mainRouter } from '@/router'; import { mainRouter } from '@/router';
import { Router } from '@/nirax'; import { Router } from '@/nirax';
export function getUserMenu(user, router: Router = mainRouter) { export function getUserMenu(user: misskey.entities.UserDetailed, router: Router = mainRouter) {
const meId = $i ? $i.id : null; const meId = $i ? $i.id : null;
async function pushList() { async function pushList() {
@ -168,12 +169,6 @@ export function getUserMenu(user, router: Router = mainRouter) {
if (iAmModerator) { if (iAmModerator) {
menu = menu.concat([null, { menu = menu.concat([null, {
icon: 'ti ti-user-exclamation',
text: i18n.ts.moderation,
action: () => {
router.push('/user-info/' + user.id + '#moderation');
},
}, {
icon: 'ti ti-badges', icon: 'ti ti-badges',
text: i18n.ts.roles, text: i18n.ts.roles,
action: async () => { action: async () => {