feat: ユーザーメニューから「リモートユーザー情報の更新」を実行できるように

This commit is contained in:
NoriDev 2023-08-29 19:47:46 +09:00
parent 37035b3c7a
commit 76ec4844a5
3 changed files with 25 additions and 1 deletions

View file

@ -34,6 +34,7 @@
- 타임라인 소개 추가
- 이용 약관을 서버 메뉴에서 볼 수 있도록
- 계정 초기 설정과 타임라인 튜토리얼을 다시 진행할 수 있도록
- 유저 메뉴에서 '리모트 유저 정보 갱신'을 진행할 수 있도록
### Client
- about-misskey 페이지에서 클라이언트 버전을 누르면 변경 사항을 볼 수 있음

View file

@ -197,7 +197,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template>
<script lang="ts" setup>
import { computed, defineAsyncComponent, watch } from 'vue';
import { computed, defineAsyncComponent, onMounted, watch } from 'vue';
import * as misskey from 'cherrypick-js';
import MkChart from '@/components/MkChart.vue';
import MkObjectView from '@/components/MkObjectView.vue';
@ -220,6 +220,7 @@ import { i18n } from '@/i18n';
import { iAmAdmin, $i } from '@/account';
import MkRolePreview from '@/components/MkRolePreview.vue';
import MkPagination, { Paging } from '@/components/MkPagination.vue';
import { eventBus } from '@/scripts/cherrypick/eventBus';
const props = withDefaults(defineProps<{
userId: string;
@ -445,6 +446,10 @@ watch($$(user), () => {
});
});
onMounted(() => {
eventBus.on('refreshUser', () => updateRemoteUser());
});
const headerActions = $computed(() => []);
const headerTabs = $computed(() => [{

View file

@ -16,6 +16,7 @@ import { mainRouter } from '@/router';
import { Router } from '@/nirax';
import { antennasCache, rolesCache, userListsCache } from '@/cache';
import { editNickname } from '@/scripts/edit-nickname';
import { eventBus } from '@/scripts/cherrypick/eventBus';
export function getUserMenu(user: misskey.entities.UserDetailed, router: Router = mainRouter) {
const meId = $i ? $i.id : null;
@ -109,6 +110,15 @@ export function getUserMenu(user: misskey.entities.UserDetailed, router: Router
}, {}, 'closed');
}
function refreshUser() {
eventBus.emit('refreshUser');
}
async function updateRemoteUser() {
await os.apiWithDialog('federation/update-remote-user', { userId: user.id });
refreshUser();
}
async function getConfirmed(text: string): Promise<boolean> {
const confirm = await os.confirm({
type: 'warning',
@ -367,6 +377,14 @@ export function getUserMenu(user: misskey.entities.UserDetailed, router: Router
}))]);
}
if ($i && meId !== user.id && user.host != null) {
menu = menu.concat([null, {
icon: 'ti ti-refresh',
text: i18n.ts.updateRemoteUser,
action: updateRemoteUser,
}]);
}
const cleanup = () => {
if (_DEV_) console.log('user menu cleanup', cleanups);
for (const cl of cleanups) {