Merge branch 'use-post-image-wrapper' into 'master'

Fix pictures without metadata information in post display

Closes #744

See merge request framasoft/mobilizon!968
This commit is contained in:
Thomas Citharel 2021-06-29 17:10:25 +00:00
commit cc806265cc
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() {