Fix pictures without metadata information in post display

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2021-06-29 18:38:38 +02:00
parent 2c4af0d267
commit 081e87209b
No known key found for this signature in database
GPG key ID: A061B9DDE0CA0773
2 changed files with 4 additions and 10 deletions

View file

@ -32,7 +32,7 @@ const DEFAULT_PICTURE = {
})
export default class LazyImageWrapper extends Vue {
@Prop({ required: true })
picture!: IMedia;
picture!: IMedia | null;
get pictureOrDefault(): Partial<IMedia> {
if (this.picture === null) {

View file

@ -2,13 +2,7 @@
<article class="container" v-if="post">
<header>
<div class="banner-container">
<lazy-image
v-if="post.picture"
:src="post.picture.url"
:width="post.picture.metadata.width"
:height="post.picture.metadata.height"
:blurhash="post.picture.metadata.blurhash"
/>
<lazy-image-wrapper :picture="post.picture" />
</div>
<div class="heading-section">
<div class="heading-wrapper">
@ -87,7 +81,7 @@ import { IPost } from "../../types/post.model";
import { usernameWithDomain } from "../../types/actor";
import RouteName from "../../router/name";
import Tag from "../../components/Tag.vue";
import LazyImage from "../../components/Image/LazyImage.vue";
import LazyImageWrapper from "../../components/Image/LazyImageWrapper.vue";
import ActorInline from "../../components/Account/ActorInline.vue";
@Component({
@ -124,7 +118,7 @@ import ActorInline from "../../components/Account/ActorInline.vue";
},
components: {
Tag,
LazyImage,
LazyImageWrapper,
ActorInline,
},
metaInfo() {