Skip to content

Commit

Permalink
fixup! feat(systemtags): add color support backend
Browse files Browse the repository at this point in the history
Signed-off-by: skjnldsv <[email protected]>
  • Loading branch information
skjnldsv committed Nov 15, 2024
1 parent ee76fe1 commit 13dea2a
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 21 deletions.
28 changes: 14 additions & 14 deletions apps/dav/tests/unit/SystemTag/SystemTagNodeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,19 +85,19 @@ public function tagNodeProvider() {
[
true,
new SystemTag(1, 'Original', true, true),
['Renamed', true, true]
['Renamed', true, true, '']
],
[
true,
new SystemTag(1, 'Original', true, true),
['Original', false, false]
['Original', false, false, '']
],
// non-admin
[
// renaming allowed
false,
new SystemTag(1, 'Original', true, true),
['Rename', true, true]
['Rename', true, true, '#0082c9']
],
];
}
Expand All @@ -116,47 +116,47 @@ public function testUpdateTag($isAdmin, ISystemTag $originalTag, $changedArgs):
->willReturn($originalTag->isUserAssignable() || $isAdmin);
$this->tagManager->expects($this->once())
->method('updateTag')
->with(1, $changedArgs[0], $changedArgs[1], $changedArgs[2]);
->with(1, $changedArgs[0], $changedArgs[1], $changedArgs[2], $changedArgs[3]);
$this->getTagNode($isAdmin, $originalTag)
->update($changedArgs[0], $changedArgs[1], $changedArgs[2]);
->update($changedArgs[0], $changedArgs[1], $changedArgs[2], $changedArgs[3]);
}

public function tagNodeProviderPermissionException() {
return [
[
// changing permissions not allowed
new SystemTag(1, 'Original', true, true),
['Original', false, true],
['Original', false, true, ''],
'Sabre\DAV\Exception\Forbidden',
],
[
// changing permissions not allowed
new SystemTag(1, 'Original', true, true),
['Original', true, false],
['Original', true, false, ''],
'Sabre\DAV\Exception\Forbidden',
],
[
// changing permissions not allowed
new SystemTag(1, 'Original', true, true),
['Original', false, false],
['Original', false, false, ''],
'Sabre\DAV\Exception\Forbidden',
],
[
// changing non-assignable not allowed
new SystemTag(1, 'Original', true, false),
['Rename', true, false],
['Rename', true, false, ''],
'Sabre\DAV\Exception\Forbidden',
],
[
// changing non-assignable not allowed
new SystemTag(1, 'Original', true, false),
['Original', true, true],
['Original', true, true, ''],
'Sabre\DAV\Exception\Forbidden',
],
[
// invisible tag does not exist
new SystemTag(1, 'Original', false, false),
['Rename', false, false],
['Rename', false, false, ''],
'Sabre\DAV\Exception\NotFound',
],
];
Expand All @@ -181,7 +181,7 @@ public function testUpdateTagPermissionException(ISystemTag $originalTag, $chang

try {
$this->getTagNode(false, $originalTag)
->update($changedArgs[0], $changedArgs[1], $changedArgs[2]);
->update($changedArgs[0], $changedArgs[1], $changedArgs[2], $changedArgs[3]);
} catch (\Exception $e) {
$thrown = $e;
}
Expand All @@ -206,7 +206,7 @@ public function testUpdateTagAlreadyExists(): void {
->method('updateTag')
->with(1, 'Renamed', true, true)
->will($this->throwException(new TagAlreadyExistsException()));
$this->getTagNode(false, $tag)->update('Renamed', true, true);
$this->getTagNode(false, $tag)->update('Renamed', true, true, '');
}


Expand All @@ -226,7 +226,7 @@ public function testUpdateTagNotFound(): void {
->method('updateTag')
->with(1, 'Renamed', true, true)
->will($this->throwException(new TagNotFoundException()));
$this->getTagNode(false, $tag)->update('Renamed', true, true);
$this->getTagNode(false, $tag)->update('Renamed', true, true, '');
}

/**
Expand Down
1 change: 0 additions & 1 deletion lib/composer/composer/autoload_classmap.php
Original file line number Diff line number Diff line change
Expand Up @@ -1386,7 +1386,6 @@
'OC\\Core\\Migrations\\Version30000Date20240814180800' => $baseDir . '/core/Migrations/Version30000Date20240814180800.php',
'OC\\Core\\Migrations\\Version30000Date20240815080800' => $baseDir . '/core/Migrations/Version30000Date20240815080800.php',
'OC\\Core\\Migrations\\Version30000Date20240906095113' => $baseDir . '/core/Migrations/Version30000Date20240906095113.php',
'OC\\Core\\Migrations\\Version31000Date20241018063111' => $baseDir . '/core/Migrations/Version31000Date20241018063111.php',
'OC\\Core\\Notification\\CoreNotifier' => $baseDir . '/core/Notification/CoreNotifier.php',
'OC\\Core\\ResponseDefinitions' => $baseDir . '/core/ResponseDefinitions.php',
'OC\\Core\\Service\\LoginFlowV2Service' => $baseDir . '/core/Service/LoginFlowV2Service.php',
Expand Down
1 change: 0 additions & 1 deletion lib/composer/composer/autoload_static.php
Original file line number Diff line number Diff line change
Expand Up @@ -1427,7 +1427,6 @@ class ComposerStaticInit749170dad3f5e7f9ca158f5a9f04f6a2
'OC\\Core\\Migrations\\Version30000Date20240814180800' => __DIR__ . '/../../..' . '/core/Migrations/Version30000Date20240814180800.php',
'OC\\Core\\Migrations\\Version30000Date20240815080800' => __DIR__ . '/../../..' . '/core/Migrations/Version30000Date20240815080800.php',
'OC\\Core\\Migrations\\Version30000Date20240906095113' => __DIR__ . '/../../..' . '/core/Migrations/Version30000Date20240906095113.php',
'OC\\Core\\Migrations\\Version31000Date20241018063111' => __DIR__ . '/../../..' . '/core/Migrations/Version31000Date20241018063111.php',
'OC\\Core\\Notification\\CoreNotifier' => __DIR__ . '/../../..' . '/core/Notification/CoreNotifier.php',
'OC\\Core\\ResponseDefinitions' => __DIR__ . '/../../..' . '/core/ResponseDefinitions.php',
'OC\\Core\\Service\\LoginFlowV2Service' => __DIR__ . '/../../..' . '/core/Service/LoginFlowV2Service.php',
Expand Down
4 changes: 2 additions & 2 deletions lib/composer/composer/installed.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
'name' => '__root__',
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'reference' => 'd481e4c575c189d6ddb128740892dd54a7c7ed48',
'reference' => 'ee76fe192de8656d216b4079a6c50dda3fc9cdb1',
'type' => 'library',
'install_path' => __DIR__ . '/../../../',
'aliases' => array(),
Expand All @@ -13,7 +13,7 @@
'__root__' => array(
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'reference' => 'd481e4c575c189d6ddb128740892dd54a7c7ed48',
'reference' => 'ee76fe192de8656d216b4079a6c50dda3fc9cdb1',
'type' => 'library',
'install_path' => __DIR__ . '/../../../',
'aliases' => array(),
Expand Down
2 changes: 1 addition & 1 deletion lib/private/SystemTag/SystemTag.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public function __construct(
private bool $userVisible,
private bool $userAssignable,
private ?string $etag = null,
private ?string $color = null
private ?string $color = null,
) {
}

Expand Down
2 changes: 1 addition & 1 deletion lib/private/SystemTag/SystemTagManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ public function updateTag(
string $newName,
bool $userVisible,
bool $userAssignable,
string $color = ''
string $color,
): void {
try {
$tags = $this->getTagsByIds($tagId);
Expand Down
4 changes: 3 additions & 1 deletion lib/public/SystemTag/ISystemTagManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,16 @@ public function getAllTags($visibilityFilter = null, $nameSearchPattern = null):
* @param string $newName the new tag name
* @param bool $userVisible whether the tag is visible by users
* @param bool $userAssignable whether the tag is assignable by users
* @param string $color color
*
* @throws TagNotFoundException if tag with the given id does not exist
* @throws TagAlreadyExistsException if there is already another tag
* with the same attributes
*
* @since 9.0.0
* @since 31.0.0 `$color` parameter added
*/
public function updateTag(string $tagId, string $newName, bool $userVisible, bool $userAssignable);
public function updateTag(string $tagId, string $newName, bool $userVisible, bool $userAssignable, string $color);

/**
* Delete the given tags from the database and all their relationships.
Expand Down

0 comments on commit 13dea2a

Please sign in to comment.