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

View File

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