Add notification preview to NotificationCard

This commit is contained in:
Daniel Supernault 2020-05-28 23:27:27 -06:00
parent f10ed49586
commit 28445e27b8
No known key found for this signature in database
GPG Key ID: 0DEF1C662C9033F7
1 changed files with 17 additions and 1 deletions

View File

@ -20,7 +20,16 @@
<div class="media-body font-weight-light small">
<div v-if="n.type == 'favourite'">
<p class="my-0">
<a :href="n.account.url" class="font-weight-bold text-dark word-break" :title="n.account.username">{{truncate(n.account.username)}}</a> liked your <a class="font-weight-bold" v-bind:href="n.status.url">post</a>.
<a :href="n.account.url" class="font-weight-bold text-dark word-break" :title="n.account.username">{{truncate(n.account.username)}}</a> liked your
<span v-if="n.status.hasOwnProperty('media_attachments')">
<a class="font-weight-bold" v-bind:href="n.status.url" :id="'fvn-' + n.id">post</a>.
<b-popover :target="'fvn-' + n.id" title="" triggers="hover" placement="top" boundary="window">
<img :src="notificationPreview(n)" width="100px" height="100px">
</b-popover>
</span>
<span v-else>
<a class="font-weight-bold" v-bind:href="n.status.url">post</a>.
</span>
</p>
</div>
<div v-else-if="n.type == 'comment'">
@ -219,6 +228,13 @@
redirect(url) {
window.location.href = url;
},
notificationPreview(n) {
if(!n.status.hasOwnProperty('media_attachments') || !n.status.media_attachments.length) {
return '/storage/no-preview.png';
}
return n.status.media_attachments[0].preview_url;
}
}
}