Merge branch 'fix/remove-spinner-on-failed-status-previews' into 'develop'

Fix: failed status previews spinning forever

See merge request pleroma/pleroma-fe!1078
This commit is contained in:
HJ 2020-03-02 10:49:24 +00:00
commit dbcd8294e8
5 changed files with 20 additions and 5 deletions

View File

@ -5,6 +5,11 @@ const StatusPopover = {
props: [ props: [
'statusId' 'statusId'
], ],
data () {
return {
error: false
}
},
computed: { computed: {
status () { status () {
return find(this.$store.state.statuses.allStatuses, { id: this.statusId }) return find(this.$store.state.statuses.allStatuses, { id: this.statusId })
@ -18,6 +23,8 @@ const StatusPopover = {
enter () { enter () {
if (!this.status) { if (!this.status) {
this.$store.dispatch('fetchStatus', this.statusId) this.$store.dispatch('fetchStatus', this.statusId)
.then(data => (this.error = false))
.catch(e => (this.error = true))
} }
} }
} }

View File

@ -17,9 +17,15 @@
:statusoid="status" :statusoid="status"
:compact="true" :compact="true"
/> />
<div
v-else-if="error"
class="status-preview-no-content faint"
>
{{ $t('status.status_unavailable') }}
</div>
<div <div
v-else v-else
class="status-preview-loading" class="status-preview-no-content"
> >
<i class="icon-spin4 animate-spin" /> <i class="icon-spin4 animate-spin" />
</div> </div>
@ -50,7 +56,7 @@
border: none; border: none;
} }
.status-preview-loading { .status-preview-no-content {
padding: 1em; padding: 1em;
text-align: center; text-align: center;

View File

@ -615,7 +615,8 @@
"reply_to": "Reply to", "reply_to": "Reply to",
"replies_list": "Replies:", "replies_list": "Replies:",
"mute_conversation": "Mute conversation", "mute_conversation": "Mute conversation",
"unmute_conversation": "Unmute conversation" "unmute_conversation": "Unmute conversation",
"status_unavailable": "Status unavailable"
}, },
"user_card": { "user_card": {
"approve": "Approve", "approve": "Approve",

View File

@ -289,7 +289,8 @@
"reply_to": "Vastaus", "reply_to": "Vastaus",
"replies_list": "Vastaukset:", "replies_list": "Vastaukset:",
"mute_conversation": "Hiljennä keskustelu", "mute_conversation": "Hiljennä keskustelu",
"unmute_conversation": "Poista hiljennys" "unmute_conversation": "Poista hiljennys",
"status_unavailable": "Viesti ei saatavissa"
}, },
"user_card": { "user_card": {
"approve": "Hyväksy", "approve": "Hyväksy",

View File

@ -616,7 +616,7 @@ const statuses = {
commit('setNotificationsSilence', { value }) commit('setNotificationsSilence', { value })
}, },
fetchStatus ({ rootState, dispatch }, id) { fetchStatus ({ rootState, dispatch }, id) {
rootState.api.backendInteractor.fetchStatus({ id }) return rootState.api.backendInteractor.fetchStatus({ id })
.then((status) => dispatch('addNewStatuses', { statuses: [status] })) .then((status) => dispatch('addNewStatuses', { statuses: [status] }))
}, },
deleteStatus ({ rootState, commit }, status) { deleteStatus ({ rootState, commit }, status) {