From ce7c5c7a46b9efea8121ed8345c4534eec725372 Mon Sep 17 00:00:00 2001 From: Cleopatra Enjeck M Date: Thu, 11 Apr 2024 11:17:19 +0100 Subject: [PATCH] enh: share context to user Signed-off-by: Cleopatra Enjeck M --- src/modules/modals/EditContext.vue | 8 +------- src/store/store.js | 8 +++++++- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/modules/modals/EditContext.vue b/src/modules/modals/EditContext.vue index 09b50cb3a..36b17d1df 100644 --- a/src/modules/modals/EditContext.vue +++ b/src/modules/modals/EditContext.vue @@ -145,13 +145,7 @@ export default { nodes: dataResources, } - const share = { - nodeType: 'context', - nodeId: this.contextId, - receiverType: 'user', - displayMode: 2, - } - const res = await this.$store.dispatch('updateContext', { id: this.contextId, data, share, receivers: this.receivers }) + const res = await this.$store.dispatch('updateContext', { id: this.contextId, data, receivers: this.receivers }) if (res) { showSuccess(t('tables', 'Updated context "{contextTitle}".', { contextTitle: this.title })) this.actionCancel() diff --git a/src/store/store.js b/src/store/store.js index 878e0ec8a..db91612f9 100644 --- a/src/store/store.js +++ b/src/store/store.js @@ -339,14 +339,20 @@ export default new Vuex.Store({ return true }, - async updateContext({ state, commit, dispatch }, { id, data, share, receivers }) { + async updateContext({ state, commit, dispatch }, { id, data, receivers }) { let res = null + let share = { + nodeType: 'context', + nodeId: id, + displayMode: 2, + } try { res = await axios.put(generateOcsUrl('/apps/tables/api/2/contexts/' + id), data) for (const receiver of receivers) { share.receiverType = receiver.isUser ? 'user' : 'group' share.receiver = receiver.user + console.log('share', share) await axios.post(generateUrl('/apps/tables/share'), share) } } catch (e) {