From 1c6abc2f54c5a387f75620a042e39a6d4d2d581c Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Sat, 5 Oct 2024 23:59:40 -0600 Subject: [PATCH] Update PostComponent.vue --- .../assets/js/components/PostComponent.vue | 211 +++++++----------- 1 file changed, 86 insertions(+), 125 deletions(-) diff --git a/resources/assets/js/components/PostComponent.vue b/resources/assets/js/components/PostComponent.vue index 4fc5984a9..4702cc9f1 100644 --- a/resources/assets/js/components/PostComponent.vue +++ b/resources/assets/js/components/PostComponent.vue @@ -302,53 +302,6 @@ v-on:likeStatus="likeStatus" /> - @@ -660,85 +613,85 @@ export default { }, data() { - return { - config: window.App.config, - status: false, - media: {}, - user: false, - reactions: { - liked: false, - shared: false - }, - likes: [], - likesCursor: null, - likesCanLoadMore: true, - likedLoaded: false, - shares: [], - lightboxMedia: false, - replyText: '', - replyStatus: {}, - replySensitive: false, - relationship: {}, - results: [], - pagination: {}, - min_id: 0, - max_id: 0, - reply_to_profile_id: 0, - thread: false, - showComments: false, - warning: false, - loaded: false, - loading: null, - replyingToId: this.statusId, - replyingToUsername: this.statusUsername, - replyToIndex: 0, - replySending: false, - emoji: window.App.util.emoji, - showReadMore: true, - showCaption: true, - ctxEmbedPayload: false, - copiedEmbed: false, - ctxEmbedShowCaption: true, - ctxEmbedShowLikes: false, - ctxEmbedCompactMode: false, - layout: this.profileLayout, - showProfileMorePosts: false, - profileMorePosts: [], - reactionBarLoading: true, - tributeSettings: { - collection: [ - { - trigger: '@', - menuShowMinLength: 2, - values: (function (text, cb) { - let url = '/api/compose/v0/search/mention'; - axios.get(url, { params: { q: text }}) - .then(res => { - cb(res.data); - }) - .catch(err => { - console.log(err); - }) + return { + config: window.App.config, + status: false, + media: {}, + user: false, + reactions: { + liked: false, + shared: false + }, + likes: [], + likesCursor: null, + likesCanLoadMore: true, + likedLoaded: false, + shares: [], + lightboxMedia: false, + replyText: '', + replyStatus: {}, + replySensitive: false, + relationship: {}, + results: [], + pagination: {}, + min_id: 0, + max_id: 0, + reply_to_profile_id: 0, + thread: false, + showComments: false, + warning: false, + loaded: false, + loading: null, + replyingToId: this.statusId, + replyingToUsername: this.statusUsername, + replyToIndex: 0, + replySending: false, + emoji: window.App.util.emoji, + showReadMore: true, + showCaption: true, + ctxEmbedPayload: false, + copiedEmbed: false, + ctxEmbedShowCaption: true, + ctxEmbedShowLikes: false, + ctxEmbedCompactMode: false, + layout: this.profileLayout, + showProfileMorePosts: false, + profileMorePosts: [], + reactionBarLoading: true, + tributeSettings: { + collection: [ + { + trigger: '@', + menuShowMinLength: 2, + values: (function (text, cb) { + let url = '/api/compose/v0/search/mention'; + axios.get(url, { params: { q: text }}) + .then(res => { + cb(res.data); }) - }, - { - trigger: '#', - menuShowMinLength: 2, - values: (function (text, cb) { - let url = '/api/compose/v0/search/hashtag'; - axios.get(url, { params: { q: text }}) - .then(res => { - cb(res.data); - }) - .catch(err => { - console.log(err); - }) + .catch(err => { + console.log(err); }) - } - ] - }, - content: undefined - } + }) + }, + { + trigger: '#', + menuShowMinLength: 2, + values: (function (text, cb) { + let url = '/api/compose/v0/search/hashtag'; + axios.get(url, { params: { q: text }}) + .then(res => { + cb(res.data); + }) + .catch(err => { + console.log(err); + }) + }) + } + ] + }, + content: undefined + } }, watch: { ctxEmbedShowCaption: function (n,o) { @@ -1424,7 +1377,15 @@ export default { }, previewUrl(status) { - return status.sensitive ? '/storage/no-preview.png?v=' + new Date().getTime() : status.media_attachments[0].preview_url; + if(status.sensitive) { + return '/storage/no-preview.png'; + } + + if(status.media_attachments[0]?.optimized_url) { + return status.media_attachments[0]?.optimized_url; + } + + return status.media_attachments[0].preview_url; }, previewBackground(status) {