Skip to content

Commit

Permalink
enhance(client): ノートメニューからユーザーメニューを開けるように
Browse files Browse the repository at this point in the history
Resolve #10019
  • Loading branch information
syuilo committed Feb 25, 2023
1 parent 64be363 commit 5bea4fe
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
10 changes: 10 additions & 0 deletions packages/frontend/src/scripts/get-note-menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import copyToClipboard from '@/scripts/copy-to-clipboard';
import { url } from '@/config';
import { noteActions } from '@/store';
import { miLocalStorage } from '@/local-storage';
import { getUserMenu } from '@/scripts/get-user-menu';

export function getNoteMenu(props: {
note: misskey.entities.Note;
Expand Down Expand Up @@ -284,6 +285,15 @@ export function getNoteMenu(props: {
text: i18n.ts.pin,
action: () => togglePin(true),
} : 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 ? [
null,
Expand Down
9 changes: 2 additions & 7 deletions packages/frontend/src/scripts/get-user-menu.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { defineAsyncComponent } from 'vue';
import * as misskey from 'misskey-js';
import { i18n } from '@/i18n';
import copyToClipboard from '@/scripts/copy-to-clipboard';
import { host } from '@/config';
Expand All @@ -8,7 +9,7 @@ import { $i, iAmModerator } from '@/account';
import { mainRouter } from '@/router';
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;

async function pushList() {
Expand Down Expand Up @@ -168,12 +169,6 @@ export function getUserMenu(user, router: Router = mainRouter) {

if (iAmModerator) {
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',
text: i18n.ts.roles,
action: async () => {
Expand Down

0 comments on commit 5bea4fe

Please sign in to comment.