Merge pull request #117 from owncloud/fix-order-issue

Fix order issue
This commit is contained in:
Joas Schilling 2014-07-14 15:03:57 +02:00
Родитель 71d39f3f02 a1b35825ec
Коммит 7a8b4417de
3 изменённых файлов: 83 добавлений и 1 удалений

Просмотреть файл

@ -234,7 +234,7 @@ class Data
'SELECT * ' 'SELECT * '
. ' FROM `*PREFIX*activity` ' . ' FROM `*PREFIX*activity` '
. ' WHERE `affecteduser` = ? ' . $limitActivities . ' WHERE `affecteduser` = ? ' . $limitActivities
. ' ORDER BY `timestamp` desc', . ' ORDER BY `timestamp` DESC',
$count, $start); $count, $start);
$result = $query->execute($parameters); $result = $query->execute($parameters);

Просмотреть файл

@ -64,6 +64,12 @@ class GroupHelper
} }
if (!$this->getGroupKey($activity)) { if (!$this->getGroupKey($activity)) {
if (!empty($this->openGroup)) {
$this->activities[] = $this->openGroup;
$this->openGroup = array();
$this->groupKey = '';
$this->groupTime = 0;
}
$this->activities[] = $activity; $this->activities[] = $activity;
return; return;
} }

Просмотреть файл

@ -153,6 +153,82 @@ class GroupHelperTest extends \PHPUnit_Framework_TestCase {
), ),
), ),
), ),
array(
true,
array(
array(
'activity_id' => 3,
'user' => 'user',
'affecteduser' => 'affecteduser',
'app' => 'files',
'type' => 'file_created',
'subject' => 'created_self',
'subjectparams' => serialize(array('testing/file3.txt')),
'message' => '',
'messageparams' => serialize(array()),
'file' => 'testing/file3.txt',
'timestamp' => time(),
),
array(
'activity_id' => 2,
'user' => 'user',
'affecteduser' => 'affecteduser',
'app' => 'files',
'type' => 'file_created',
'subject' => 'created_self',
'subjectparams' => serialize(array('testing/file2.txt')),
'message' => '',
'messageparams' => serialize(array()),
'file' => 'testing/file2.txt',
'timestamp' => time(),
),
array(
'activity_id' => 1,
'user' => 'user',
'affecteduser' => 'affecteduser',
'app' => 'files',
'type' => 'shared',
'subject' => 'shared_link_self',
'subjectparams' => serialize(array('testing/file1.txt')),
'message' => '',
'messageparams' => serialize(array()),
'file' => 'testing/file1.txt',
'timestamp' => time() - 10,
),
),
array(
array(
'activity_id' => 3,
'activity_ids' => array(3, 2),
'user' => 'user',
'affecteduser' => 'affecteduser',
'app' => 'files',
'type' => 'file_created',
'subject' => 'created_self',
'subjectparams' => array(array(
'testing/file3.txt',
'testing/file2.txt',
)),
'message' => '',
'messageparams' => array(),
'file' => 'testing/file3.txt',
'typeicon' => 'icon-add-color',
),
array(
'activity_id' => 1,
'user' => 'user',
'affecteduser' => 'affecteduser',
'app' => 'files',
'type' => 'shared',
'subject' => 'shared_link_self',
'subjectparams' => array('testing/file1.txt'),
'message' => '',
'messageparams' => array(),
'file' => 'testing/file1.txt',
'typeicon' => 'icon-share',
),
),
),
array( array(
true, true,
array( array(