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

View File

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