summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/js/systemtags/systemtagscollection.js2
-rw-r--r--core/js/tests/specs/systemtags/systemtagsinputfieldSpec.js54
-rw-r--r--lib/private/api.php5
3 files changed, 55 insertions, 6 deletions
diff --git a/core/js/systemtags/systemtagscollection.js b/core/js/systemtags/systemtagscollection.js
index 0f8a7aa980e..8a5d309bacb 100644
--- a/core/js/systemtags/systemtagscollection.js
+++ b/core/js/systemtags/systemtagscollection.js
@@ -11,7 +11,7 @@
(function(OC) {
function filterFunction(model, term) {
- return model.get('name').substr(0, term.length) === term;
+ return model.get('name').substr(0, term.length).toLowerCase() === term.toLowerCase();
}
/**
diff --git a/core/js/tests/specs/systemtags/systemtagsinputfieldSpec.js b/core/js/tests/specs/systemtags/systemtagsinputfieldSpec.js
index 08470fbdd8a..d62ef672f4d 100644
--- a/core/js/tests/specs/systemtags/systemtagsinputfieldSpec.js
+++ b/core/js/tests/specs/systemtags/systemtagsinputfieldSpec.js
@@ -346,6 +346,7 @@ describe('OC.SystemTags.SystemTagsInputField tests', function() {
new OC.SystemTags.SystemTagModel({id: '1', name: 'abc'}),
new OC.SystemTags.SystemTagModel({id: '2', name: 'def'}),
new OC.SystemTags.SystemTagModel({id: '3', name: 'abd', userAssignable: false}),
+ new OC.SystemTags.SystemTagModel({id: '4', name: 'Deg'}),
]);
});
afterEach(function() {
@@ -377,6 +378,32 @@ describe('OC.SystemTags.SystemTagsInputField tests', function() {
}
]);
});
+ it('completes case insensitive', function() {
+ var callback = sinon.stub();
+ opts.query({
+ term: 'de',
+ callback: callback
+ });
+ expect(fetchStub.calledOnce).toEqual(true);
+
+ fetchStub.yieldTo('success', view.collection);
+
+ expect(callback.calledOnce).toEqual(true);
+ expect(callback.getCall(0).args[0].results).toEqual([
+ {
+ id: '2',
+ name: 'def',
+ userVisible: true,
+ userAssignable: true
+ },
+ {
+ id: '4',
+ name: 'Deg',
+ userVisible: true,
+ userAssignable: true
+ }
+ ]);
+ });
});
});
@@ -446,6 +473,7 @@ describe('OC.SystemTags.SystemTagsInputField tests', function() {
new OC.SystemTags.SystemTagModel({id: '1', name: 'abc'}),
new OC.SystemTags.SystemTagModel({id: '2', name: 'def'}),
new OC.SystemTags.SystemTagModel({id: '3', name: 'abd', userAssignable: false}),
+ new OC.SystemTags.SystemTagModel({id: '4', name: 'Deg'}),
]);
});
afterEach(function() {
@@ -471,6 +499,32 @@ describe('OC.SystemTags.SystemTagsInputField tests', function() {
}
]);
});
+ it('completes case insensitive', function() {
+ var callback = sinon.stub();
+ opts.query({
+ term: 'de',
+ callback: callback
+ });
+ expect(fetchStub.calledOnce).toEqual(true);
+
+ fetchStub.yieldTo('success', view.collection);
+
+ expect(callback.calledOnce).toEqual(true);
+ expect(callback.getCall(0).args[0].results).toEqual([
+ {
+ id: '2',
+ name: 'def',
+ userVisible: true,
+ userAssignable: true
+ },
+ {
+ id: '4',
+ name: 'Deg',
+ userVisible: true,
+ userAssignable: true
+ }
+ ]);
+ });
});
});
});
diff --git a/lib/private/api.php b/lib/private/api.php
index 1fbe3201f85..452612d4c16 100644
--- a/lib/private/api.php
+++ b/lib/private/api.php
@@ -292,11 +292,9 @@ class OC_API {
case API::GUEST_AUTH:
// Anyone can access
return true;
- break;
case API::USER_AUTH:
// User required
return self::loginUser();
- break;
case API::SUBADMIN_AUTH:
// Check for subadmin
$user = self::loginUser();
@@ -315,7 +313,6 @@ class OC_API {
return false;
}
}
- break;
case API::ADMIN_AUTH:
// Check for admin
$user = self::loginUser();
@@ -324,11 +321,9 @@ class OC_API {
} else {
return OC_User::isAdminUser($user);
}
- break;
default:
// oops looks like invalid level supplied
return false;
- break;
}
}