summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
m---------3rdparty0
-rw-r--r--apps/dav/lib/carddav/addressbookimpl.php2
-rw-r--r--apps/dav/lib/carddav/carddavbackend.php17
-rw-r--r--apps/dav/tests/unit/carddav/addressbookimpltest.php2
-rw-r--r--apps/dav/tests/unit/carddav/carddavbackendtest.php12
-rw-r--r--apps/files/js/filelist.js14
-rw-r--r--apps/files/tests/js/filelistSpec.js31
-rw-r--r--core/command/app/enable.php4
-rw-r--r--lib/public/constants.php5
-rw-r--r--tests/lib/util.php14
10 files changed, 64 insertions, 37 deletions
diff --git a/3rdparty b/3rdparty
-Subproject 7e0c3708d7b44a132e2e360fd39a663af7c1f13
+Subproject 495e415ebccc94feda0d9c7490b629806d0199f
diff --git a/apps/dav/lib/carddav/addressbookimpl.php b/apps/dav/lib/carddav/addressbookimpl.php
index 1d7b55c1a5d..795a30064b7 100644
--- a/apps/dav/lib/carddav/addressbookimpl.php
+++ b/apps/dav/lib/carddav/addressbookimpl.php
@@ -178,7 +178,7 @@ class AddressBookImpl implements IAddressBook {
protected function createUid() {
do {
$uid = $this->getUid();
- $contact = $this->backend->getContact($uid . '.vcf');
+ $contact = $this->backend->getContact($this->getKey(), $uid . '.vcf');
} while (!empty($contact));
return $uid;
diff --git a/apps/dav/lib/carddav/carddavbackend.php b/apps/dav/lib/carddav/carddavbackend.php
index aa2490ab11a..78706ae6bff 100644
--- a/apps/dav/lib/carddav/carddavbackend.php
+++ b/apps/dav/lib/carddav/carddavbackend.php
@@ -548,7 +548,7 @@ class CardDavBackend implements BackendInterface, SyncSupport {
*/
function deleteCard($addressBookId, $cardUri) {
try {
- $cardId = $this->getCardId($cardUri);
+ $cardId = $this->getCardId($addressBookId, $cardUri);
} catch (\InvalidArgumentException $e) {
$cardId = null;
}
@@ -807,15 +807,16 @@ class CardDavBackend implements BackendInterface, SyncSupport {
/**
* return contact with the given URI
*
+ * @param int $addressBookId
* @param string $uri
* @returns array
*/
- public function getContact($uri) {
+ public function getContact($addressBookId, $uri) {
$result = [];
$query = $this->db->getQueryBuilder();
$query->select('*')->from($this->dbCardsTable)
- ->where($query->expr()->eq('uri', $query->createParameter('uri')))
- ->setParameter('uri', $uri);
+ ->where($query->expr()->eq('uri', $query->createNamedParameter($uri)))
+ ->where($query->expr()->eq('addressbookid', $query->createNamedParameter($addressBookId)));
$queryResult = $query->execute();
$contact = $queryResult->fetch();
$queryResult->closeCursor();
@@ -851,7 +852,7 @@ class CardDavBackend implements BackendInterface, SyncSupport {
* @param string $vCardSerialized
*/
protected function updateProperties($addressBookId, $cardUri, $vCardSerialized) {
- $cardId = $this->getCardId($cardUri);
+ $cardId = $this->getCardId($addressBookId, $cardUri);
$vCard = $this->readCard($vCardSerialized);
$this->purgeProperties($addressBookId, $cardId);
@@ -913,13 +914,15 @@ class CardDavBackend implements BackendInterface, SyncSupport {
/**
* get ID from a given contact
*
+ * @param int $addressBookId
* @param string $uri
* @return int
*/
- protected function getCardId($uri) {
+ protected function getCardId($addressBookId, $uri) {
$query = $this->db->getQueryBuilder();
$query->select('id')->from($this->dbCardsTable)
- ->where($query->expr()->eq('uri', $query->createNamedParameter($uri)));
+ ->where($query->expr()->eq('uri', $query->createNamedParameter($uri)))
+ ->andWhere($query->expr()->eq('addressbookid', $query->createNamedParameter($addressBookId)));
$result = $query->execute();
$cardIds = $result->fetch();
diff --git a/apps/dav/tests/unit/carddav/addressbookimpltest.php b/apps/dav/tests/unit/carddav/addressbookimpltest.php
index ff7b982abd4..f2c739e046d 100644
--- a/apps/dav/tests/unit/carddav/addressbookimpltest.php
+++ b/apps/dav/tests/unit/carddav/addressbookimpltest.php
@@ -261,7 +261,7 @@ class AddressBookImplTest extends TestCase {
// simulate that 'uid0' already exists, so the second uid will be returned
$this->backend->expects($this->exactly(2))->method('getContact')
->willReturnCallback(
- function($uid) {
+ function($id, $uid) {
return ($uid === 'uid0.vcf');
}
);
diff --git a/apps/dav/tests/unit/carddav/carddavbackendtest.php b/apps/dav/tests/unit/carddav/carddavbackendtest.php
index f7e59b3fda9..3b5395fb09e 100644
--- a/apps/dav/tests/unit/carddav/carddavbackendtest.php
+++ b/apps/dav/tests/unit/carddav/carddavbackendtest.php
@@ -44,7 +44,7 @@ class CardDavBackendTest extends TestCase {
/** @var CardDavBackend */
private $backend;
- /** @var Principal | \PHPUnit_Framework_MockObject_MockObject */
+ /** @var Principal | \PHPUnit_Framework_MockObject_MockObject */
private $principal;
/** @var IDBConnection */
@@ -268,7 +268,7 @@ class CardDavBackendTest extends TestCase {
// create a new address book
$this->backend->expects($this->once())
->method('getCardId')
- ->with($uri)
+ ->with($bookId, $uri)
->willThrowException(new \InvalidArgumentException());
$this->backend->expects($this->exactly(2))
->method('addChange')
@@ -445,14 +445,14 @@ class CardDavBackendTest extends TestCase {
$id = $query->getLastInsertId();
$this->assertSame($id,
- $this->invokePrivate($this->backend, 'getCardId', ['uri']));
+ $this->invokePrivate($this->backend, 'getCardId', [1, 'uri']));
}
/**
* @expectedException InvalidArgumentException
*/
public function testGetCardIdFailed() {
- $this->invokePrivate($this->backend, 'getCardId', ['uri']);
+ $this->invokePrivate($this->backend, 'getCardId', [1, 'uri']);
}
/**
@@ -596,7 +596,7 @@ class CardDavBackendTest extends TestCase {
$query->execute();
}
- $result = $this->backend->getContact('uri0');
+ $result = $this->backend->getContact(0, 'uri0');
$this->assertSame(7, count($result));
$this->assertSame(0, (int)$result['addressbookid']);
$this->assertSame('uri0', $result['uri']);
@@ -606,7 +606,7 @@ class CardDavBackendTest extends TestCase {
}
public function testGetContactFail() {
- $this->assertEmpty($this->backend->getContact('uri'));
+ $this->assertEmpty($this->backend->getContact(0, 'uri'));
}
public function testCollectCardProperties() {
diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js
index 1a6f38d3d7c..dd03b0c895a 100644
--- a/apps/files/js/filelist.js
+++ b/apps/files/js/filelist.js
@@ -510,8 +510,9 @@
delete this._selectedFiles[$tr.data('id')];
this._selectionSummary.remove(data);
}
- if (this._detailsView && this._selectionSummary.getTotal() === 1 && !this._detailsView.$el.hasClass('disappear')) {
- this._updateDetailsView(_.values(this._selectedFiles)[0].name);
+ if (this._detailsView && !this._detailsView.$el.hasClass('disappear')) {
+ // hide sidebar
+ this._updateDetailsView(null);
}
this.$el.find('.select-all').prop('checked', this._selectionSummary.getTotal() === this.files.length);
},
@@ -591,8 +592,9 @@
this._selectFileEl($tr, state);
this._lastChecked = $tr;
this.updateSelectionSummary();
- if (state) {
- this._updateDetailsView($tr.attr('data-file'));
+ if (this._detailsView && !this._detailsView.$el.hasClass('disappear')) {
+ // hide sidebar
+ this._updateDetailsView(null);
}
},
@@ -613,6 +615,10 @@
}
}
this.updateSelectionSummary();
+ if (this._detailsView && !this._detailsView.$el.hasClass('disappear')) {
+ // hide sidebar
+ this._updateDetailsView(null);
+ }
},
/**
diff --git a/apps/files/tests/js/filelistSpec.js b/apps/files/tests/js/filelistSpec.js
index 0091a9ee6e4..ed56011866e 100644
--- a/apps/files/tests/js/filelistSpec.js
+++ b/apps/files/tests/js/filelistSpec.js
@@ -86,7 +86,7 @@ describe('OCA.Files.FileList tests', function() {
'<table id="filestable">' +
'<thead><tr>' +
'<th id="headerName" class="hidden column-name">' +
- '<input type="checkbox" id="select_all_files" class="select-all">' +
+ '<input type="checkbox" id="select_all_files" class="select-all checkbox">' +
'<a class="name columntitle" data-sort="name"><span>Name</span><span class="sort-indicator"></span></a>' +
'<span id="selectedActionsList" class="selectedActions hidden">' +
'<a href class="download"><img src="actions/download.svg">Download</a>' +
@@ -1969,14 +1969,35 @@ describe('OCA.Files.FileList tests', function() {
expect($tr.hasClass('highlighted')).toEqual(true);
expect(fileList._detailsView.getFileInfo().id).toEqual(1);
});
- it('keeps the last highlighted file when unselecting file using checkbox', function() {
+ it('removes last highlighted file when selecting via checkbox', function() {
var $tr = fileList.findFileEl('One.txt');
+
+ // select
+ $tr.find('td.filename>a.name').click();
$tr.find('input:checkbox').click();
- expect($tr.hasClass('highlighted')).toEqual(true);
+ expect($tr.hasClass('highlighted')).toEqual(false);
+
+ // deselect
+ $tr.find('td.filename>a.name').click();
$tr.find('input:checkbox').click();
+ expect($tr.hasClass('highlighted')).toEqual(false);
- expect($tr.hasClass('highlighted')).toEqual(true);
- expect(fileList._detailsView.getFileInfo().id).toEqual(1);
+ expect(fileList._detailsView.getFileInfo()).toEqual(null);
+ });
+ it('removes last highlighted file when selecting all files via checkbox', function() {
+ var $tr = fileList.findFileEl('One.txt');
+
+ // select
+ $tr.find('td.filename>a.name').click();
+ fileList.$el.find('.select-all.checkbox').click();
+ expect($tr.hasClass('highlighted')).toEqual(false);
+
+ // deselect
+ $tr.find('td.filename>a.name').click();
+ fileList.$el.find('.select-all.checkbox').click();
+ expect($tr.hasClass('highlighted')).toEqual(false);
+
+ expect(fileList._detailsView.getFileInfo()).toEqual(null);
});
it('closes sidebar whenever the currently highlighted file was removed from the list', function() {
var $tr = fileList.findFileEl('One.txt');
diff --git a/core/command/app/enable.php b/core/command/app/enable.php
index 4315972bae2..fb2097356f5 100644
--- a/core/command/app/enable.php
+++ b/core/command/app/enable.php
@@ -70,10 +70,6 @@ class Enable extends Command {
}
$groups = $input->getOption('groups');
- if ($this->manager->isInstalled($appId) && empty($groups)) {
- $output->writeln($appId . ' is already enabled');
- }
-
if (empty($groups)) {
\OC_App::enable($appId);
$output->writeln($appId . ' enabled');
diff --git a/lib/public/constants.php b/lib/public/constants.php
index 518fbcf7ebe..4dd6793a13a 100644
--- a/lib/public/constants.php
+++ b/lib/public/constants.php
@@ -68,7 +68,8 @@ class Constants {
const PERMISSION_ALL = 31;
/**
- * @since 8.0.0
+ * @since 8.0.0 - Updated in 9.0.0 to allow all POSIX chars since we no
+ * longer support windows as server platform.
*/
- const FILENAME_INVALID_CHARS = "\\/<>:\"|?*\n";
+ const FILENAME_INVALID_CHARS = "\\/";
}
diff --git a/tests/lib/util.php b/tests/lib/util.php
index 7880d56f63b..4d788353881 100644
--- a/tests/lib/util.php
+++ b/tests/lib/util.php
@@ -214,13 +214,13 @@ class Test_Util extends \Test\TestCase {
array('..', false),
array('back\\slash', false),
array('sl/ash', false),
- array('lt<lt', false),
- array('gt>gt', false),
- array('col:on', false),
- array('double"quote', false),
- array('pi|pe', false),
- array('dont?ask?questions?', false),
- array('super*star', false),
+ array('lt<lt', true),
+ array('gt>gt', true),
+ array('col:on', true),
+ array('double"quote', true),
+ array('pi|pe', true),
+ array('dont?ask?questions?', true),
+ array('super*star', true),
array('new\nline', false),
// better disallow these to avoid unexpected trimming to have side effects
array(' ..', false),