Browse code

BM-12928 Fix: tbird non expanded verbs check

Nicolas Lascombes authored on 08/03/2018 09:41:32
Showing 4 changed files
... ...
@@ -265,7 +265,7 @@ var _adaptContainer = function(container) {
265 265
     folder.owner = container.owner;
266 266
     folder.ownerDisplayname = container.ownerDisplayname;
267 267
     folder.isSync = container.offlineSync;
268
-    folder.isReadable = container.verbs.indexOf("Read") != -1;
268
+    folder.isReadable = BMFolderHome.isReadable(container.verbs);
269 269
     return folder;
270 270
 };
271 271
 
... ...
@@ -21,6 +21,7 @@
21 21
 Components.utils.import("resource://bm/bmUtils.jsm");
22 22
 Components.utils.import("resource://bm/bmService.jsm");
23 23
 Components.utils.import("resource://bm/core2/BMAuthService.jsm");
24
+Components.utils.import("resource://bm/core2/BMFolderHome.jsm");
24 25
 
25 26
 var gBMCalPrefsSubscribe = {
26 27
     _logger: Components.classes["@blue-mind.net/logger;1"].getService().wrappedJSObject
... ...
@@ -84,7 +85,7 @@ var gBMCalPrefsSubscribe = {
84 84
         return client.listSubscriptions(user.uid, "calendar");
85 85
       }).then(function(list) {
86 86
         for (let item of list) {
87
-            if (item.verbs.indexOf("Read") != -1) {
87
+            if (BMFolderHome.isReadable(item.verbs)) {
88 88
               self._addItem(item);
89 89
             }
90 90
         }
... ...
@@ -382,6 +382,11 @@ let BMFolderHome = {
382 382
             return Promise.reject(new Error("Folder [" + aFolder.name + "] not exist"));
383 383
         }
384 384
     },
385
+    isReadable(aVerbs) {
386
+        return aVerbs.indexOf("All") != -1
387
+            || aVerbs.indexOf("Write") != -1
388
+            || aVerbs.indexOf("Read") != -1;
389
+    },
385 390
     _isRemoteDir: function(aUri) {
386 391
         return aUri.indexOf("bmdirectory://") == 0;
387 392
     },
... ...
@@ -39,7 +39,7 @@ add_test(function _testSync() {
39 39
             "owner" : "test",
40 40
             "ownerDisplayname" : "test",
41 41
             "offlineSync": true,
42
-            "verbs": ["Manage","Invitation","Read","Write","All","Freebusy"]
42
+            "verbs": ["All"]
43 43
         }, {
44 44
             "uid" : "t2",
45 45
             "name" : "test2",