aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorskjnldsv <skjnldsv@protonmail.com>2024-10-24 15:35:19 +0200
committerskjnldsv <skjnldsv@protonmail.com>2024-10-29 09:08:31 +0100
commitd51cf4536c665ea208ca9bb452ec8841c15a5f35 (patch)
tree674a9a29a6a671f26b120d9b28da40bfdeca644f /apps
parentdb546e1f55814c4eee8df792a66922bf8d9c926f (diff)
downloadnextcloud-server-d51cf4536c665ea208ca9bb452ec8841c15a5f35.tar.gz
nextcloud-server-d51cf4536c665ea208ca9bb452ec8841c15a5f35.zip
feat(systemtags): add cypress tests and fix a few logic issues
Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
Diffstat (limited to 'apps')
-rw-r--r--apps/dav/lib/SystemTag/SystemTagPlugin.php7
-rw-r--r--apps/files/src/components/FileEntry/FileEntryCheckbox.vue1
-rw-r--r--apps/files/src/components/FilesListTableHeader.vue2
-rw-r--r--apps/files/src/components/FilesListTableHeaderActions.vue3
-rw-r--r--apps/systemtags/src/components/SystemTagPicker.vue28
-rw-r--r--apps/systemtags/src/event-bus.d.ts4
-rw-r--r--apps/systemtags/src/files_actions/bulkSystemTagsAction.ts2
7 files changed, 33 insertions, 14 deletions
diff --git a/apps/dav/lib/SystemTag/SystemTagPlugin.php b/apps/dav/lib/SystemTag/SystemTagPlugin.php
index c88a69f1154..00585953b29 100644
--- a/apps/dav/lib/SystemTag/SystemTagPlugin.php
+++ b/apps/dav/lib/SystemTag/SystemTagPlugin.php
@@ -21,7 +21,6 @@ use OCP\Util;
use Sabre\DAV\Exception\BadRequest;
use Sabre\DAV\Exception\Conflict;
use Sabre\DAV\Exception\Forbidden;
-use Sabre\DAV\Exception\PreconditionFailed;
use Sabre\DAV\Exception\UnsupportedMediaType;
use Sabre\DAV\PropFind;
use Sabre\DAV\PropPatch;
@@ -218,8 +217,8 @@ class SystemTagPlugin extends \Sabre\DAV\ServerPlugin {
$propFind->setPath(str_replace('systemtags-assigned/', 'systemtags/', $propFind->getPath()));
}
- $propFind->handle(FilesPlugin::GETETAG_PROPERTYNAME, function () use ($node): string|null {
- return $node->getSystemTag()->getETag();
+ $propFind->handle(FilesPlugin::GETETAG_PROPERTYNAME, function () use ($node): string {
+ return '"' . ($node->getSystemTag()->getETag() ?? '') . '"';
});
$propFind->handle(self::ID_PROPERTYNAME, function () use ($node) {
@@ -379,7 +378,7 @@ class SystemTagPlugin extends \Sabre\DAV\ServerPlugin {
if (isset($props[self::OBJECTIDS_PROPERTYNAME])) {
$propValue = $props[self::OBJECTIDS_PROPERTYNAME];
- if (!($propValue instanceof SystemTagsObjectList) || count($propValue?->getObjects() ?: []) === 0) {
+ if (!($propValue instanceof SystemTagsObjectList) || count($propValue->getObjects()) === 0) {
throw new BadRequest('Invalid object-ids property');
}
diff --git a/apps/files/src/components/FileEntry/FileEntryCheckbox.vue b/apps/files/src/components/FileEntry/FileEntryCheckbox.vue
index f2ab39d7525..9caa08cfe22 100644
--- a/apps/files/src/components/FileEntry/FileEntryCheckbox.vue
+++ b/apps/files/src/components/FileEntry/FileEntryCheckbox.vue
@@ -9,6 +9,7 @@
<NcCheckboxRadioSwitch v-else
:aria-label="ariaLabel"
:checked="isSelected"
+ data-cy-files-list-row-checkbox
@update:checked="onSelectionChange" />
</td>
</template>
diff --git a/apps/files/src/components/FilesListTableHeader.vue b/apps/files/src/components/FilesListTableHeader.vue
index e91cfa055c1..c8334abda5e 100644
--- a/apps/files/src/components/FilesListTableHeader.vue
+++ b/apps/files/src/components/FilesListTableHeader.vue
@@ -6,7 +6,7 @@
<tr class="files-list__row-head">
<th class="files-list__column files-list__row-checkbox"
@keyup.esc.exact="resetSelection">
- <NcCheckboxRadioSwitch v-bind="selectAllBind" @update:checked="onToggleAll" />
+ <NcCheckboxRadioSwitch v-bind="selectAllBind" data-cy-files-list-selection-checkbox @update:checked="onToggleAll" />
</th>
<!-- Columns display -->
diff --git a/apps/files/src/components/FilesListTableHeaderActions.vue b/apps/files/src/components/FilesListTableHeaderActions.vue
index a5732220441..fa5f7d4bd5f 100644
--- a/apps/files/src/components/FilesListTableHeaderActions.vue
+++ b/apps/files/src/components/FilesListTableHeaderActions.vue
@@ -3,7 +3,7 @@
- SPDX-License-Identifier: AGPL-3.0-or-later
-->
<template>
- <div class="files-list__column files-list__row-actions-batch">
+ <div class="files-list__column files-list__row-actions-batch" data-cy-files-list-selection-actions>
<NcActions ref="actionsMenu"
container="#app-content-vue"
:disabled="!!loading || areSomeNodesLoading"
@@ -15,6 +15,7 @@
:key="action.id"
:aria-label="action.displayName(nodes, currentView) + ' ' + t('files', '(selected)') /** TRANSLATORS: Selected like 'selected files and folders' */"
:class="'files-list__row-actions-batch-' + action.id"
+ :data-cy-files-list-selection-action="action.id"
@click="onActionClick(action)">
<template #icon>
<NcLoadingIcon v-if="loading === action.id" :size="18" />
diff --git a/apps/systemtags/src/components/SystemTagPicker.vue b/apps/systemtags/src/components/SystemTagPicker.vue
index c06bebc3bdc..732d509ac24 100644
--- a/apps/systemtags/src/components/SystemTagPicker.vue
+++ b/apps/systemtags/src/components/SystemTagPicker.vue
@@ -23,22 +23,28 @@
<!-- Search or create input -->
<form class="systemtags-picker__create" @submit.stop.prevent="onNewTag">
<NcTextField :value.sync="input"
- :label="t('systemtags', 'Search or create tag')">
+ :label="t('systemtags', 'Search or create tag')"
+ data-cy-systemtags-picker-input>
<TagIcon :size="20" />
</NcTextField>
- <NcButton :disabled="status === Status.CREATING_TAG" native-type="submit">
+ <NcButton :disabled="status === Status.CREATING_TAG"
+ native-type="submit"
+ data-cy-systemtags-picker-input-submit>
{{ t('systemtags', 'Create tag') }}
</NcButton>
</form>
<!-- Tags list -->
- <div v-if="filteredTags.length > 0" class="systemtags-picker__tags">
+ <div v-if="filteredTags.length > 0"
+ class="systemtags-picker__tags"
+ data-cy-systemtags-picker-tags>
<NcCheckboxRadioSwitch v-for="tag in filteredTags"
:key="tag.id"
:label="tag.displayName"
:checked="isChecked(tag)"
:indeterminate="isIndeterminate(tag)"
:disabled="!tag.canAssign"
+ :data-cy-systemtags-picker-tag="tag.id"
@update:checked="onCheckUpdate(tag, $event)">
{{ formatTagName(tag) }}
</NcCheckboxRadioSwitch>
@@ -61,10 +67,15 @@
</template>
<template #actions>
- <NcButton :disabled="status !== Status.BASE" type="tertiary" @click="onCancel">
+ <NcButton :disabled="status !== Status.BASE"
+ type="tertiary"
+ data-cy-systemtags-picker-button-cancel
+ @click="onCancel">
{{ t('systemtags', 'Cancel') }}
</NcButton>
- <NcButton :disabled="!hasChanges || status !== Status.BASE" @click="onSubmit">
+ <NcButton :disabled="!hasChanges || status !== Status.BASE"
+ data-cy-systemtags-picker-button-submit
+ @click="onSubmit">
{{ t('systemtags', 'Apply changes') }}
</NcButton>
</template>
@@ -270,11 +281,11 @@ export default defineComponent({
},
formatTagName(tag: TagWithId): string {
- if (tag.userVisible) {
+ if (!tag.userVisible) {
return t('systemtags', '{displayName} (hidden)', { displayName: tag.displayName })
}
- if (tag.userAssignable) {
+ if (!tag.userAssignable) {
return t('systemtags', '{displayName} (restricted)', { displayName: tag.displayName })
}
@@ -317,6 +328,9 @@ export default defineComponent({
const tag = await fetchTag(id)
this.tags.push(tag)
this.input = ''
+
+ // Check the newly created tag
+ this.onCheckUpdate(tag, true)
} catch (error) {
showError((error as Error)?.message || t('systemtags', 'Failed to create tag'))
} finally {
diff --git a/apps/systemtags/src/event-bus.d.ts b/apps/systemtags/src/event-bus.d.ts
index 368d0acaf0f..4009f3f372b 100644
--- a/apps/systemtags/src/event-bus.d.ts
+++ b/apps/systemtags/src/event-bus.d.ts
@@ -1,3 +1,7 @@
+/**
+ * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
import type { Node } from '@nextcloud/files'
declare module '@nextcloud/event-bus' {
diff --git a/apps/systemtags/src/files_actions/bulkSystemTagsAction.ts b/apps/systemtags/src/files_actions/bulkSystemTagsAction.ts
index 709a4c7ebcb..ad2ebab70c4 100644
--- a/apps/systemtags/src/files_actions/bulkSystemTagsAction.ts
+++ b/apps/systemtags/src/files_actions/bulkSystemTagsAction.ts
@@ -19,7 +19,7 @@ export const action = new FileAction({
// If the app is disabled, the action is not available anyway
enabled(nodes) {
- if (nodes.length > 0) {
+ if (nodes.length === 0) {
return false
}