From d3e7f0b67b80ddb382541eaa8cbcdc7331098813 Mon Sep 17 00:00:00 2001 From: Ruben van der Linde Date: Tue, 29 Sep 2026 18:36:59 +0200 Subject: [PATCH 1/2] fix(organisations): the concept-organisations widget lists Draft organisations and accepts them as Active The widget filtered on 'concept' and wrote 'actief'; neither is in the organization status enum (Draft, Active, Inactive, merged), so it listed nothing and every accept was refused. composer test:unit now points at phpunit-unit.xml instead of the missing tests/phpunit.xml. --- composer.json | 2 +- src/utils/organisationStatus.js | 35 ++++++++++ .../widgets/ConceptOrganisatiesWidget.vue | 9 ++- tests/vitest/organisationStatus.spec.js | 69 +++++++++++++++++++ 4 files changed, 109 insertions(+), 6 deletions(-) create mode 100644 src/utils/organisationStatus.js create mode 100644 tests/vitest/organisationStatus.spec.js diff --git a/composer.json b/composer.json index 0d4773e31..42b141ca4 100644 --- a/composer.json +++ b/composer.json @@ -32,7 +32,7 @@ "phpmetrics:violations": "./vendor/bin/phpmetrics --violations-xml=phpmetrics/violations.xml lib/", "psalm": "if [ -f vendor/bin/psalm ]; then ./vendor/bin/psalm --threads=1 --no-cache --memory-limit=2G; else echo 'Psalm not installed, skipping...'; fi", "phpstan": "if [ -f vendor/bin/phpstan ]; then ./vendor/bin/phpstan analyse --memory-limit=1G; else echo 'PHPStan not installed, skipping...'; fi", - "test:unit": "phpunit tests -c tests/phpunit.xml --colors=always --fail-on-warning --fail-on-risky", + "test:unit": "phpunit -c phpunit-unit.xml --colors=always --fail-on-warning --fail-on-risky", "test:all": "if [ ! -f vendor/bin/phpunit ]; then echo 'SKIPPED: phpunit not installed - run composer install'; elif [ ! -f ../../lib/base.php ]; then echo 'SKIPPED: tests/bootstrap.php requires a Nextcloud server tree (../../lib/base.php not found) - run from inside a Nextcloud checkout or in CI'; else ./vendor/bin/phpunit --colors=always; fi", "check": "E=0; for CMD in lint phpcs psalm test:unit; do echo; echo \"=== $CMD ===\"; composer $CMD || E=1; done; echo; if [ $E -eq 0 ]; then echo \"ALL CHECKS PASSED\"; else echo \"SOME CHECKS FAILED (see above)\"; fi; exit $E", "check:full": "E=0; for CMD in lint phpcs psalm phpstan test:all; do echo; echo \"=== $CMD ===\"; composer $CMD || E=1; done; echo; if [ $E -eq 0 ]; then echo \"ALL CHECKS PASSED\"; else echo \"SOME CHECKS FAILED (see above)\"; fi; exit $E", diff --git a/src/utils/organisationStatus.js b/src/utils/organisationStatus.js new file mode 100644 index 000000000..564ea60bb --- /dev/null +++ b/src/utils/organisationStatus.js @@ -0,0 +1,35 @@ +/** + * Organisation status values the concept-organisations dashboard widget reads + * and writes. They must be members of the `status` enum of the organization + * schema in lib/Settings/softwarecatalogus_register.json, or OpenRegister + * refuses the accept and the widget never lists anything. + * + * @spec openspec/specs/fe-organizations/spec.md + */ + +/** Status of an organisation still waiting for review. */ +export const CONCEPT_STATUS = 'Draft' + +/** Status an organisation gets once it is accepted. */ +export const ACCEPTED_STATUS = 'Active' + +/** + * Whether an organisation is still a concept, compared case-insensitively. + * + * @param {object} organisation The organisation object from the store + * @return {boolean} True when its status is the concept status + * @spec openspec/specs/fe-organizations/spec.md + */ +export function isConceptOrganisation(organisation) { + return String(organisation?.status ?? '').toLowerCase() === CONCEPT_STATUS.toLowerCase() +} + +/** + * The patch payload that accepts an organisation. + * + * @return {{status: string}} The payload for objectStore.patchObject() + * @spec openspec/specs/fe-organizations/spec.md + */ +export function acceptPayload() { + return { status: ACCEPTED_STATUS } +} diff --git a/src/views/widgets/ConceptOrganisatiesWidget.vue b/src/views/widgets/ConceptOrganisatiesWidget.vue index 82acc1fda..8606df0ec 100644 --- a/src/views/widgets/ConceptOrganisatiesWidget.vue +++ b/src/views/widgets/ConceptOrganisatiesWidget.vue @@ -1,6 +1,7 @@