Frontend: Fixed showing media in profiles
ci/woodpecker/push/ociImagePush Pipeline was successful Details

This commit is contained in:
Natty 2023-12-28 04:00:00 +01:00
parent b50249da02
commit 64350cfcb8
Signed by: natty
GPG Key ID: BF6CB659ADEE60EC
2 changed files with 20 additions and 17 deletions

View File

@ -29,7 +29,6 @@
<script lang="ts" setup>
import { onMounted } from "vue";
import * as misskey from "calckey-js";
import { getStaticImageUrl } from "@/scripts/get-static-image-url";
import { notePage } from "@/filters/note";
import * as os from "@/os";
@ -38,6 +37,7 @@ import ImgWithBlurhash from "@/components/MkImgWithBlurhash.vue";
import { defaultStore } from "@/store";
import { i18n } from "@/i18n";
import { packed } from "magnetar-common";
import { resolveNote } from "@/scripts-mag/mag-util";
const props = defineProps<{
user: packed.PackUserBase;
@ -46,15 +46,15 @@ const props = defineProps<{
let fetching = $ref(true);
let images = $ref<
{
note: misskey.entities.Note;
file: misskey.entities.DriveFile;
note: packed.PackNoteMaybeAttachments;
file: packed.PackDriveFileBase;
}[]
>([]);
function thumbnail(image: misskey.entities.DriveFile): string {
function thumbnail(image: packed.PackDriveFileBase): string {
return defaultStore.state.disableShowingAnimatedImages
? getStaticImageUrl(image.thumbnailUrl)
: image.thumbnailUrl;
? getStaticImageUrl(image.thumbnail_url)
: image.thumbnail_url;
}
onMounted(() => {
@ -71,17 +71,19 @@ onMounted(() => {
fileType: image,
excludeNsfw: defaultStore.state.nsfw !== "ignore",
limit: 10,
}).then((notes) => {
for (const note of notes) {
for (const file of note.files) {
images.push({
note,
file,
});
})
.then((n) => Promise.all(n.map(resolveNote)))
.then((notes) => {
for (const note of notes) {
for (const file of note.attachments) {
images.push({
note,
file,
});
}
}
}
fetching = false;
});
fetching = false;
});
});
</script>

View File

@ -29,7 +29,8 @@ const pagination = {
limit: 10,
params: computed(() => ({
userId: props.user.id,
includeReplies: include.value === "replies",
includeReplies:
include.value === "replies" || include.value === "files",
withFiles: include.value === "files",
})),
};