1
0
forked from mirror/misskey
This commit is contained in:
syuilo 2023-10-02 02:27:28 +09:00
parent 167aaabf20
commit c019e9cad5
3 changed files with 18 additions and 23 deletions

View File

@ -16,6 +16,9 @@
### NOTE ### NOTE
- muted_noteテーブルは使われなくなったため手動で削除を行ってください。 - muted_noteテーブルは使われなくなったため手動で削除を行ってください。
### Changes
- API: users/notes で fileType 指定はできなくなりました
### Server ### Server
- タイムライン取得時のパフォーマンスを改善 - タイムライン取得時のパフォーマンスを改善

View File

@ -128,14 +128,14 @@ SPDX-License-Identifier: AGPL-3.0-only
</div> </div>
<MkInfo v-else-if="$i && $i.id === user.id">{{ i18n.ts.userPagePinTip }}</MkInfo> <MkInfo v-else-if="$i && $i.id === user.id">{{ i18n.ts.userPagePinTip }}</MkInfo>
<template v-if="narrow"> <template v-if="narrow">
<XPhotos :key="user.id" :user="user"/> <XFiles :key="user.id" :user="user"/>
<XActivity :key="user.id" :user="user"/> <XActivity :key="user.id" :user="user"/>
</template> </template>
<MkNotes v-if="!disableNotes" :class="$style.tl" :noGap="true" :pagination="pagination"/> <MkNotes v-if="!disableNotes" :class="$style.tl" :noGap="true" :pagination="pagination"/>
</div> </div>
</div> </div>
<div v-if="!narrow" class="sub _gaps" style="container-type: inline-size;"> <div v-if="!narrow" class="sub _gaps" style="container-type: inline-size;">
<XPhotos :key="user.id" :user="user"/> <XFiles :key="user.id" :user="user"/>
<XActivity :key="user.id" :user="user"/> <XActivity :key="user.id" :user="user"/>
</div> </div>
</div> </div>
@ -182,7 +182,7 @@ function calcAge(birthdate: string): number {
return yearDiff; return yearDiff;
} }
const XPhotos = defineAsyncComponent(() => import('./index.photos.vue')); const XFiles = defineAsyncComponent(() => import('./index.files.vue'));
const XActivity = defineAsyncComponent(() => import('./index.activity.vue')); const XActivity = defineAsyncComponent(() => import('./index.activity.vue'));
const props = withDefaults(defineProps<{ const props = withDefaults(defineProps<{

View File

@ -6,20 +6,21 @@ SPDX-License-Identifier: AGPL-3.0-only
<template> <template>
<MkContainer :max-height="300" :foldable="true"> <MkContainer :max-height="300" :foldable="true">
<template #icon><i class="ti ti-photo"></i></template> <template #icon><i class="ti ti-photo"></i></template>
<template #header>{{ i18n.ts.images }}</template> <template #header>{{ i18n.ts.files }}</template>
<div :class="$style.root"> <div :class="$style.root">
<MkLoading v-if="fetching"/> <MkLoading v-if="fetching"/>
<div v-if="!fetching && images.length > 0" :class="$style.stream"> <div v-if="!fetching && files.length > 0" :class="$style.stream">
<MkA <MkA
v-for="image in images" v-for="file in files"
:key="image.note.id + image.file.id" :key="file.note.id + file.file.id"
:class="$style.img" :class="$style.img"
:to="notePage(image.note)" :to="notePage(file.note)"
> >
<ImgWithBlurhash :hash="image.file.blurhash" :src="thumbnail(image.file)" :title="image.file.name"/> <!-- TODO: 画像以外のファイルに対応 -->
<ImgWithBlurhash :hash="file.file.blurhash" :src="thumbnail(file.file)" :title="file.file.name"/>
</MkA> </MkA>
</div> </div>
<p v-if="!fetching && images.length == 0" :class="$style.empty">{{ i18n.ts.nothing }}</p> <p v-if="!fetching && files.length == 0" :class="$style.empty">{{ i18n.ts.nothing }}</p>
</div> </div>
</MkContainer> </MkContainer>
</template> </template>
@ -40,7 +41,7 @@ const props = defineProps<{
}>(); }>();
let fetching = $ref(true); let fetching = $ref(true);
let images = $ref<{ let files = $ref<{
note: Misskey.entities.Note; note: Misskey.entities.Note;
file: Misskey.entities.DriveFile; file: Misskey.entities.DriveFile;
}[]>([]); }[]>([]);
@ -52,24 +53,15 @@ function thumbnail(image: Misskey.entities.DriveFile): string {
} }
onMounted(() => { onMounted(() => {
const image = [
'image/jpeg',
'image/webp',
'image/avif',
'image/png',
'image/gif',
'image/apng',
'image/vnd.mozilla.apng',
];
os.api('users/notes', { os.api('users/notes', {
userId: props.user.id, userId: props.user.id,
fileType: image, withFiles: true,
excludeNsfw: defaultStore.state.nsfw !== 'ignore', excludeNsfw: defaultStore.state.nsfw !== 'ignore',
limit: 10, limit: 15,
}).then(notes => { }).then(notes => {
for (const note of notes) { for (const note of notes) {
for (const file of note.files) { for (const file of note.files) {
images.push({ files.push({
note, note,
file, file,
}); });