summaryrefslogtreecommitdiffstats
path: root/src/mixins
diff options
context:
space:
mode:
authorJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2021-07-01 11:07:58 +0200
committerJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2021-07-01 11:15:57 +0200
commit904273d4a1ade3fa07e26cac1fab44f0c2cb0333 (patch)
treedb11f228be8426da053cc2f79573b5d8f3f87b63 /src/mixins
parentee443f249edd2a7f8506b98ade7e58eacfed5def (diff)
Properlyu manage initiator on join/leave
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Diffstat (limited to 'src/mixins')
-rw-r--r--src/mixins/CircleActionsMixin.js11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/mixins/CircleActionsMixin.js b/src/mixins/CircleActionsMixin.js
index 60e83765..d79b6511 100644
--- a/src/mixins/CircleActionsMixin.js
+++ b/src/mixins/CircleActionsMixin.js
@@ -94,6 +94,9 @@ export default {
member,
leave: true,
})
+
+ // Reset initiator
+ this.circle.initiator = null
} catch (error) {
console.error('Could not leave the circle', member, error)
showError(t('contacts', 'Could not leave the circle {displayName}', this.circle))
@@ -107,7 +110,13 @@ export default {
this.loadingJoin = true
try {
const initiator = await joinCircle(this.circle.id)
- this.circle.initiator = new Member(initiator)
+ const member = new Member(initiator, this.circle)
+
+ // Update initiator with newest membership values
+ this.circle.initiator = member
+
+ // Append new member
+ member.circle.addMember(member)
} catch (error) {
showError(t('contacts', 'Unable to join the circle'))
console.error('Unable to join the circle', error)