diff options
author | Vincent Petry <pvince81@owncloud.com> | 2016-01-27 10:52:00 +0100 |
---|---|---|
committer | Vincent Petry <pvince81@owncloud.com> | 2016-01-27 11:09:43 +0100 |
commit | cfba90a78dbb011ff268ec3053f15ca764939c78 (patch) | |
tree | 2c647086202268d4e62ca5e2f11ccc85151753c6 /apps/dav | |
parent | 1594371c8c0124af2469bd70b9b917bfd845ae19 (diff) | |
download | nextcloud-server-cfba90a78dbb011ff268ec3053f15ca764939c78.tar.gz nextcloud-server-cfba90a78dbb011ff268ec3053f15ca764939c78.zip |
Fix system tags proppatch with booleans
Backbone webdav adapter now converts booleans and ints to strings.
Fixed system tags to use "true" / "false" strings for booleans instead
of 1 / 0.
Diffstat (limited to 'apps/dav')
-rw-r--r-- | apps/dav/lib/systemtag/systemtagplugin.php | 10 | ||||
-rw-r--r-- | apps/dav/tests/unit/systemtag/systemtagplugin.php | 8 |
2 files changed, 10 insertions, 8 deletions
diff --git a/apps/dav/lib/systemtag/systemtagplugin.php b/apps/dav/lib/systemtag/systemtagplugin.php index e104bb8dac4..4636ed428b1 100644 --- a/apps/dav/lib/systemtag/systemtagplugin.php +++ b/apps/dav/lib/systemtag/systemtagplugin.php @@ -199,11 +199,11 @@ class SystemTagPlugin extends \Sabre\DAV\ServerPlugin { }); $propFind->handle(self::USERVISIBLE_PROPERTYNAME, function() use ($node) { - return (int)$node->getSystemTag()->isUserVisible(); + return $node->getSystemTag()->isUserVisible() ? 'true' : 'false'; }); $propFind->handle(self::USERASSIGNABLE_PROPERTYNAME, function() use ($node) { - return (int)$node->getSystemTag()->isUserAssignable(); + return $node->getSystemTag()->isUserAssignable() ? 'true' : 'false'; }); } @@ -236,11 +236,13 @@ class SystemTagPlugin extends \Sabre\DAV\ServerPlugin { } if (isset($props[self::USERVISIBLE_PROPERTYNAME])) { - $userVisible = (bool)$props[self::USERVISIBLE_PROPERTYNAME]; + $propValue = $props[self::USERVISIBLE_PROPERTYNAME]; + $userVisible = ($propValue !== 'false' && $propValue !== '0'); } if (isset($props[self::USERASSIGNABLE_PROPERTYNAME])) { - $userAssignable = (bool)$props[self::USERASSIGNABLE_PROPERTYNAME]; + $propValue = $props[self::USERASSIGNABLE_PROPERTYNAME]; + $userAssignable = ($propValue !== 'false' && $propValue !== '0'); } $node->update($name, $userVisible, $userAssignable); diff --git a/apps/dav/tests/unit/systemtag/systemtagplugin.php b/apps/dav/tests/unit/systemtag/systemtagplugin.php index 1d22af75188..873dd7088a8 100644 --- a/apps/dav/tests/unit/systemtag/systemtagplugin.php +++ b/apps/dav/tests/unit/systemtag/systemtagplugin.php @@ -77,8 +77,8 @@ class SystemTagPlugin extends \Test\TestCase { 200 => [ self::ID_PROPERTYNAME => '1', self::DISPLAYNAME_PROPERTYNAME => 'Test', - self::USERVISIBLE_PROPERTYNAME => 1, - self::USERASSIGNABLE_PROPERTYNAME => 1, + self::USERVISIBLE_PROPERTYNAME => 'true', + self::USERASSIGNABLE_PROPERTYNAME => 'true', ] ]; @@ -133,8 +133,8 @@ class SystemTagPlugin extends \Test\TestCase { // properties to set $propPatch = new \Sabre\DAV\PropPatch(array( self::DISPLAYNAME_PROPERTYNAME => 'Test changed', - self::USERVISIBLE_PROPERTYNAME => 0, - self::USERASSIGNABLE_PROPERTYNAME => 1, + self::USERVISIBLE_PROPERTYNAME => 'false', + self::USERASSIGNABLE_PROPERTYNAME => 'true', )); $this->plugin->handleUpdateProperties( |