Merge pull request #1799 from nextcloud/bugfix/noid/participant-primary-key

This commit is contained in:
Julius Härtl 2020-05-06 13:48:11 +02:00 коммит произвёл GitHub
Родитель 36bae29cef 7e03cf8ae4
Коммит f926000bd4
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
13 изменённых файлов: 42 добавлений и 30 удалений

1
.gitignore поставляемый
Просмотреть файл

@ -5,6 +5,7 @@ css/style.css
css/vendor.css
tests/integration/vendor/
tests/integration/composer.lock
tests/.phpunit.result.cache
vendor/
*.lock
.php_cs.cache

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

@ -23,15 +23,13 @@
namespace OCA\Deck\Db;
use OCP\Share\IShare;
class Circle extends RelationalObject {
/** @var \OCA\Circles\Model\Circle */
protected $object;
public function __construct(\OCA\Circles\Model\Circle $circle) {
$primaryKey = IShare::TYPE_CIRCLE . ':' . $circle->getUniqueId();
$primaryKey = $circle->getUniqueId();
parent::__construct($primaryKey, $circle);
}
@ -40,7 +38,8 @@ class Circle extends RelationalObject {
'uid' => $this->object->getUniqueId(),
'displayname' => $this->object->getName(),
'typeString' => $this->object->getTypeString(),
'circleOwner' => $this->object->getOwner()
'circleOwner' => $this->object->getOwner(),
'type' => 7
];
}
}

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

@ -24,18 +24,18 @@
namespace OCA\Deck\Db;
use OCP\IGroup;
use OCP\Share\IShare;
class Group extends RelationalObject {
public function __construct(IGroup $group) {
$primaryKey = IShare::TYPE_GROUP . ':' . $group->getGID();
$primaryKey = $group->getGID();
parent::__construct($primaryKey, $group);
}
public function getObjectSerialization() {
return [
'uid' => $this->object->getGID(),
'displayname' => $this->object->getDisplayName()
'displayname' => $this->object->getDisplayName(),
'type' => 1
];
}
}

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

@ -24,18 +24,18 @@
namespace OCA\Deck\Db;
use OCP\IUser;
use OCP\Share\IShare;
class User extends RelationalObject {
public function __construct(IUser $user) {
$primaryKey = IShare::TYPE_USER . ':' . $user->getUID();
$primaryKey = $user->getUID();
parent::__construct($primaryKey, $user);
}
public function getObjectSerialization() {
return [
'uid' => $this->object->getUID(),
'displayname' => $this->object->getDisplayName()
'displayname' => $this->object->getDisplayName(),
'type' => 0
];
}

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

@ -7,8 +7,8 @@
:options="formatedSharees"
:user-select="true"
label="displayName"
track-by="user"
:internal-search="false"
track-by="multiselectKey"
:internal-search="true"
@input="clickAddAcl"
@search-change="asyncFind" />
@ -24,7 +24,7 @@
</span>
</span>
</li>
<li v-for="acl in board.acl" :key="acl.participant.primaryKey">
<li v-for="acl in board.acl" :key="acl.id">
<Avatar v-if="acl.type===0" :user="acl.participant.uid" />
<div v-if="acl.type===1" class="avatardiv icon icon-group" />
<div v-if="acl.type===7" class="avatardiv icon icon-circles" />
@ -101,11 +101,11 @@ export default {
},
formatedSharees() {
return this.unallocatedSharees.map(item => {
const sharee = {
user: item.label,
displayName: item.label,
icon: 'icon-user',
multiselectKey: item.shareType + ':' + item.primaryKey,
}
if (item.value.shareType === 1) {
@ -124,7 +124,7 @@ export default {
unallocatedSharees() {
return this.sharees.filter((sharee) => {
const foundIndex = this.board.acl.findIndex((acl) => {
return acl.participant.uid === sharee.value.shareWith
return acl.participant.uid === sharee.value.shareWith && acl.participant.type === sharee.value.shareType
})
if (foundIndex === -1) {
return true

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

@ -72,7 +72,7 @@
:auto-limit="false"
:placeholder="t('deck', 'Assign a user to this card…')"
label="displayname"
track-by="primaryKey"
track-by="multiselectKey"
@select="assignUserToCard"
@remove="removeUserFromCard">
<template #tag="scope">
@ -80,6 +80,7 @@
<Avatar :user="scope.option.uid"
:display-name="scope.option.displayname"
:size="24"
:is-no-user="scope.option.isNoUser"
:disable-menu="true" />
</div>
</template>
@ -89,6 +90,7 @@
:key="option.primaryKey"
:user="option.participant.uid"
:display-name="option.participant.displayname"
:is-no-user="scope.option.isNoUser"
:size="32" />
</div>
</div>
@ -294,6 +296,7 @@ export default {
displayName: item.displayname,
icon: 'icon-user',
isNoUser: false,
multiselectKey: item.type + ':' + item.uid,
}
if (item.type === 1) {
@ -349,7 +352,11 @@ export default {
this.allLabels = this.currentCard.labels
if (this.currentCard.assignedUsers && this.currentCard.assignedUsers.length > 0) {
this.assignedUsers = this.currentCard.assignedUsers.map((item) => item.participant)
this.assignedUsers = this.currentCard.assignedUsers.map((item) => ({
...item.participant,
isNoUser: item.participant.type !== 0,
multiselectKey: item.participant.type + ':' + item.participant.primaryKey,
}))
} else {
this.assignedUsers = []
}

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

@ -33,14 +33,14 @@
:disable-menu="true"
:size="32" />
<Avatar v-if="user.type === 1"
:user="user.participant.primaryKey"
:user="user.participant.uid"
:display-name="user.participant.displayname"
:tooltip-message="user.participant.displayname + ' ' + t('deck', '(group)')"
:is-no-user="true"
:disable-="true"
:size="32" />
<Avatar v-if="user.type === 7"
:user="user.participant.primaryKey"
:user="user.participant.uid"
:display-name="user.participant.displayname"
:tooltip-message="user.participant.displayname + ' ' + t('deck', '(circle)')"
:is-no-user="true"

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

@ -181,7 +181,7 @@ export default new Vuex.Store({
state.boards = boards
},
setSharees(state, shareesUsersAndGroups) {
state.sharees = shareesUsersAndGroups.exact.users
Vue.set(state, 'sharees', shareesUsersAndGroups.exact.users)
state.sharees.push(...shareesUsersAndGroups.exact.groups)
state.sharees.push(...shareesUsersAndGroups.exact.circles)

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

@ -1 +0,0 @@
C:37:"PHPUnit\Runner\DefaultTestResultCache":3426:{a:2:{s:7:"defects";a:5:{s:89:"Test\Authentication\Login\FinishRememberedLoginCommandTest::testProcessNotRememberedLogin";i:4;s:71:"Test\Authentication\Login\FinishRememberedLoginCommandTest::testProcess";i:3;s:102:"Test\Authentication\Login\FinishRememberedLoginCommandTest::testProcessNotRemeberedLoginWithAutologout";i:4;s:52:"OCA\Files_Sharing\Tests\ApiTest::testCreateShareLink";i:4;s:64:"OCA\Files_Sharing\Tests\ApiTest::testCreateShareLinkPublicUpload";i:3;}s:5:"times";a:38:{s:89:"Test\Authentication\Login\FinishRememberedLoginCommandTest::testProcessNotRememberedLogin";d:0.008;s:71:"Test\Authentication\Login\FinishRememberedLoginCommandTest::testProcess";d:0.001;s:102:"Test\Authentication\Login\FinishRememberedLoginCommandTest::testProcessNotRemeberedLoginWithAutologout";d:0.001;s:52:"OCA\Files_Sharing\Tests\ApiTest::testCreateShareLink";d:0.19;s:56:"OCA\Files_Sharing\Tests\ApiTest::testCreateShareUserFile";d:0.485;s:58:"OCA\Files_Sharing\Tests\ApiTest::testCreateShareUserFolder";d:0.226;s:57:"OCA\Files_Sharing\Tests\ApiTest::testCreateShareGroupFile";d:0.244;s:59:"OCA\Files_Sharing\Tests\ApiTest::testCreateShareGroupFolder";d:0.222;s:64:"OCA\Files_Sharing\Tests\ApiTest::testCreateShareLinkPublicUpload";d:0.121;s:56:"OCA\Files_Sharing\Tests\ApiTest::testEnforceLinkPassword";d:0.576;s:53:"OCA\Files_Sharing\Tests\ApiTest::testSharePermissions";d:0.167;s:49:"OCA\Files_Sharing\Tests\ApiTest::testGetAllShares";d:0.129;s:55:"OCA\Files_Sharing\Tests\ApiTest::testGetAllSharesWithMe";d:0.182;s:50:"OCA\Files_Sharing\Tests\ApiTest::testPublicLinkUrl";d:0.133;s:55:"OCA\Files_Sharing\Tests\ApiTest::testGetShareFromSource";d:0.135;s:67:"OCA\Files_Sharing\Tests\ApiTest::testGetShareFromSourceWithReshares";d:0.162;s:51:"OCA\Files_Sharing\Tests\ApiTest::testGetShareFromId";d:0.13;s:55:"OCA\Files_Sharing\Tests\ApiTest::testGetShareFromFolder";d:0.165;s:63:"OCA\Files_Sharing\Tests\ApiTest::testGetShareFromFolderWithFile";d:0.125;s:63:"OCA\Files_Sharing\Tests\ApiTest::testGetShareFromFolderReshares";d:0.185;s:66:"OCA\Files_Sharing\Tests\ApiTest::testGetShareFromSubFolderReShares";d:0.183;s:65:"OCA\Files_Sharing\Tests\ApiTest::testGetShareMultipleSharedFolder";d:0.263;s:63:"OCA\Files_Sharing\Tests\ApiTest::testGetShareFromFileReReShares";d:0.203;s:58:"OCA\Files_Sharing\Tests\ApiTest::testGetShareFromUnknownId";d:0.11;s:48:"OCA\Files_Sharing\Tests\ApiTest::testUpdateShare";d:0.391;s:54:"OCA\Files_Sharing\Tests\ApiTest::testUpdateShareUpload";d:0.142;s:58:"OCA\Files_Sharing\Tests\ApiTest::testUpdateShareExpireDate";d:0.146;s:48:"OCA\Files_Sharing\Tests\ApiTest::testDeleteShare";d:0.159;s:50:"OCA\Files_Sharing\Tests\ApiTest::testDeleteReshare";d:0.177;s:63:"OCA\Files_Sharing\Tests\ApiTest::testShareFolderWithAMountPoint";d:0.236;s:59:"OCA\Files_Sharing\Tests\ApiTest::testShareStorageMountPoint";d:0.165;s:74:"OCA\Files_Sharing\Tests\ApiTest::testPublicLinkExpireDate with data set #0";d:0.088;s:74:"OCA\Files_Sharing\Tests\ApiTest::testPublicLinkExpireDate with data set #1";d:0.111;s:74:"OCA\Files_Sharing\Tests\ApiTest::testPublicLinkExpireDate with data set #2";d:0.119;s:68:"OCA\Files_Sharing\Tests\ApiTest::testCreatePublicLinkExpireDateValid";d:0.135;s:76:"OCA\Files_Sharing\Tests\ApiTest::testCreatePublicLinkExpireDateInvalidFuture";d:0.119;s:56:"OCA\Files_Sharing\Tests\ApiTest::testInvisibleSharesUser";d:0.154;s:57:"OCA\Files_Sharing\Tests\ApiTest::testInvisibleSharesGroup";d:0.165;}}}

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

@ -38,7 +38,8 @@ class GroupTest extends \Test\TestCase {
$groupRelationalObject = new Group($group);
$expected = [
'uid' => 'mygroup',
'displayname' => 'My Group'
'displayname' => 'My Group',
'type' => 1
];
$this->assertEquals($expected, $groupRelationalObject->getObjectSerialization());
}
@ -56,7 +57,8 @@ class GroupTest extends \Test\TestCase {
$expected = [
'uid' => 'mygroup',
'displayname' => 'My Group',
'primaryKey' => '1:mygroup'
'primaryKey' => 'mygroup',
'type' => 1
];
$actual = $groupRelationalObject->jsonSerialize();

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

@ -38,7 +38,8 @@ class UserTest extends \Test\TestCase {
$userRelationalObject = new User($user);
$expected = [
'uid' => 'myuser',
'displayname' => 'myuser displayname'
'displayname' => 'myuser displayname',
'type' => 0
];
$this->assertEquals($expected, $userRelationalObject->getObjectSerialization());
}
@ -56,7 +57,8 @@ class UserTest extends \Test\TestCase {
$expected = [
'uid' => 'myuser',
'displayname' => 'myuser displayname',
'primaryKey' => '0:myuser'
'primaryKey' => 'myuser',
'type' => 0,
];
$this->assertEquals($expected, $userRelationalObject->jsonSerialize());
}

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

@ -34,7 +34,9 @@ class LabelApiControllerTest extends \Test\TestCase {
private $request;
private $labelService;
private $userId = 'admin';
private $exampleLabel;
private $exampleLabel = [
'id' => 123
];
public function setUp(): void {
parent::setUp();

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

@ -36,8 +36,8 @@ class StackApiControllerTest extends \Test\TestCase {
private $controller;
private $boardService;
private $stackService;
private $exampleStack;
private $exampleBoard;
private $exampleStack = [];
private $exampleBoard = [];
public function setUp(): void {
parent::setUp();
@ -45,13 +45,13 @@ class StackApiControllerTest extends \Test\TestCase {
$this->boardService = $this->createMock(BoardService::class);
$this->stackService = $this->createMock(StackService::class);
$this->exampleBoard['boardId'] = '89';
$this->exampleStack['id'] = 345;
$this->exampleStack['boardId'] = $this->exampleBoard['boardId'];
$this->exampleStack['order'] = 0;
$this->exampleStack['title'] = 'Example Stack From API';
$this->exampleBoard['boardId'] = '89';
$this->controller = new StackApiController(
$this->appName,
$this->request,