From 66589f70e266947234320ea28e15a0319d0e446f Mon Sep 17 00:00:00 2001
From: Hermann <blumh@ethz.ch>
Date: Wed, 18 Jul 2018 21:31:14 +0200
Subject: [PATCH] fix reloading of group after patching

---
 src/groups/viewGroup.js | 8 +++++---
 src/views/itemView.js   | 2 --
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/groups/viewGroup.js b/src/groups/viewGroup.js
index adf27fc..4ec2255 100644
--- a/src/groups/viewGroup.js
+++ b/src/groups/viewGroup.js
@@ -181,6 +181,8 @@ class EmailTable {
 
 export default class viewGroup extends ItemView {
   view() {
+    // update the reference to the controller data, as this may be refreshed in between
+    this.data = this.controller.data;
     return this.layout([
       // this div is the title line
       m('div.maincontainer', [
@@ -214,7 +216,7 @@ export default class viewGroup extends ItemView {
             list: this.data.receive_from || [],
             onSubmit: (newItem) => {
               const oldList = this.data.receive_from || [];
-              this.handler.patch({
+              this.controller.patch({
                 _id: this.data._id,
                 _etag: this.data._etag,
                 receive_from: [...oldList, newItem],
@@ -226,11 +228,11 @@ export default class viewGroup extends ItemView {
               const index = oldList.indexOf(item);
               if (index !== -1) {
                 oldList.splice(index, 1);
-                this.handler.patch({
+                this.controller.patch({
                   _id: this.data._id,
                   _etag: this.data._etag,
                   receive_from: oldList,
-                }).then(() => m.redraw());
+                });
               }
             },
           }),
diff --git a/src/views/itemView.js b/src/views/itemView.js
index 07de2f8..780cce9 100644
--- a/src/views/itemView.js
+++ b/src/views/itemView.js
@@ -52,8 +52,6 @@ export default class ItemView {
 
   layout(children) {
     if (!this.controller || !this.controller.data) return m(loadingScreen);
-    // update the reference to the controller data, as this may be refreshed in between
-    this.data = this.controller.data;
     return m('div', [
       m(Toolbar, m('div.pe-button-row', [
         m(Button, {
-- 
GitLab