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..21fa3c19c --- /dev/null +++ b/src/utils/organisationStatus.js @@ -0,0 +1,38 @@ +/** + * 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..086852eff 100644 --- a/src/views/widgets/ConceptOrganisatiesWidget.vue +++ b/src/views/widgets/ConceptOrganisatiesWidget.vue @@ -1,6 +1,10 @@