@@ -49,20 +49,20 @@
+ :disabled="!!item.loading"
+ @click="rejectShare(id)">
-
+
+ :disabled="!!item.loading"
+ @click="acceptShare(id)">
-
+
{{ t('spreed', 'Accept') }}
@@ -108,7 +108,6 @@ export default {
data() {
return {
modal: false,
- isLoading: false,
}
},
@@ -118,13 +117,15 @@ export default {
},
invitations() {
- return Object.values(this.federationStore.pendingShares)
- .map(item => ({
- ...item,
+ const pendingShares = this.federationStore.pendingShares
+ for (const id in pendingShares) {
+ pendingShares[id] = Object.assign({}, pendingShares[id], {
type: CONVERSATION.TYPE.GROUP,
isFederatedConversation: true,
isDummyConversation: true,
- }))
+ })
+ }
+ return pendingShares
},
},
@@ -140,20 +141,17 @@ export default {
},
async acceptShare(id) {
- this.isLoading = true
const conversation = await this.federationStore.acceptShare(id)
- this.isLoading = false
if (conversation?.token) {
this.$store.dispatch('addConversation', conversation)
- this.$router.push({ name: 'conversation', params: { token: conversation.token } })
+ }
+ if (this.invitations.length === 0) {
this.closeModal()
}
},
async rejectShare(id) {
- this.isLoading = true
await this.federationStore.rejectShare(id)
- this.isLoading = false
if (this.invitations.length === 0) {
this.closeModal()
}
diff --git a/src/stores/federation.js b/src/stores/federation.js
index 5d4bc522878..455e30b52a6 100644
--- a/src/stores/federation.js
+++ b/src/stores/federation.js
@@ -118,6 +118,7 @@ export const useFederationStore = defineStore('federation', {
if (!this.pendingShares[id]) {
return
}
+ Vue.delete(this.pendingShares[id], 'loading')
Vue.set(this.acceptedShares, id, {
...this.pendingShares[id],
accessToken: conversation.remoteAccessToken,
@@ -138,6 +139,7 @@ export const useFederationStore = defineStore('federation', {
return
}
try {
+ Vue.set(this.pendingShares[id], 'loading', 'accept')
const response = await acceptShare(id)
this.markInvitationAccepted(id, response.data.ocs.data)
return response.data.ocs.data
@@ -157,6 +159,7 @@ export const useFederationStore = defineStore('federation', {
return
}
try {
+ Vue.set(this.pendingShares[id], 'loading', 'reject')
await rejectShare(id)
Vue.delete(this.pendingShares, id)
} catch (error) {