Compare commits
74 Commits
automated/
...
improve-cy
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3abdb438c0 | ||
|
|
1b9b80a9b2 | ||
|
|
42cf69a05c | ||
|
|
20b5716e33 | ||
|
|
60d02ff837 | ||
|
|
604018008c | ||
|
|
5cf486150a | ||
|
|
64741e455d | ||
|
|
9a7eb9b8de | ||
|
|
8ad3c9ac5c | ||
|
|
445d842481 | ||
|
|
6a7c02d8d8 | ||
|
|
f347f96474 | ||
|
|
5828f90163 | ||
|
|
6ccb4b7c3f | ||
|
|
094efdaa06 | ||
|
|
161003faf9 | ||
|
|
fa31256b8a | ||
|
|
c590c25f68 | ||
|
|
05832f69e9 | ||
|
|
c9bacabd4c | ||
|
|
4abf895d22 | ||
|
|
d216e56dac | ||
|
|
15514162f3 | ||
|
|
b3bb29157c | ||
|
|
12b656dd8c | ||
|
|
661eea3018 | ||
|
|
ecd3cb42de | ||
|
|
f49c8f6ee4 | ||
|
|
96b56a2447 | ||
|
|
26badb58dd | ||
|
|
04d9433bdd | ||
|
|
a69eb654fd | ||
|
|
ab5ccb7bc1 | ||
|
|
f054cc2fbd | ||
|
|
1afc5cdbcc | ||
|
|
1a6e5929b2 | ||
|
|
74a3ab5008 | ||
|
|
0ebd05e649 | ||
|
|
3611c8f8ac | ||
|
|
da3b857ab0 | ||
|
|
199b698cb7 | ||
|
|
fb1132652a | ||
|
|
f78c3d42df | ||
|
|
4a879ab1fb | ||
|
|
b4e9dd39cc | ||
|
|
9035a23af8 | ||
|
|
bffa4d0925 | ||
|
|
516294ee23 | ||
|
|
5a39996357 | ||
|
|
569a0961fd | ||
|
|
376f46b7ba | ||
|
|
447dc60f37 | ||
|
|
480af39d56 | ||
|
|
7d18f3a48b | ||
|
|
51f5b8f023 | ||
|
|
1e68e1ff03 | ||
|
|
a13619690e | ||
|
|
3115363c28 | ||
|
|
6ace1867e1 | ||
|
|
af4a610a25 | ||
|
|
d40661a985 | ||
|
|
0a14a0dfd8 | ||
|
|
72d3cfa771 | ||
|
|
411c0d9d46 | ||
|
|
ec33c26fe4 | ||
|
|
8fcb4a47ae | ||
|
|
44d244f9aa | ||
|
|
3ed1fbcc40 | ||
|
|
7394cb2d48 | ||
|
|
4f39328d59 | ||
|
|
a3fa72341d | ||
|
|
eee35ac6ad | ||
|
|
152181ff67 |
17
.github/dependabot.yml
vendored
17
.github/dependabot.yml
vendored
@@ -13,6 +13,23 @@ updates:
|
|||||||
- juliushaertl
|
- juliushaertl
|
||||||
- luka-nextcloud
|
- luka-nextcloud
|
||||||
|
|
||||||
|
- package-ecosystem: npm
|
||||||
|
target-branch: stable32
|
||||||
|
versioning-strategy: lockfile-only
|
||||||
|
directory: "/"
|
||||||
|
schedule:
|
||||||
|
interval: weekly
|
||||||
|
day: saturday
|
||||||
|
time: "03:15"
|
||||||
|
timezone: Europe/Paris
|
||||||
|
ignore:
|
||||||
|
- dependency-name: "*"
|
||||||
|
update-types: ["version-update:semver-major"]
|
||||||
|
open-pull-requests-limit: 30
|
||||||
|
labels:
|
||||||
|
- 3. to review
|
||||||
|
- dependencies
|
||||||
|
|
||||||
- package-ecosystem: npm
|
- package-ecosystem: npm
|
||||||
target-branch: stable31
|
target-branch: stable31
|
||||||
versioning-strategy: lockfile-only
|
versioning-strategy: lockfile-only
|
||||||
|
|||||||
20
.github/workflows/cypress-e2e.yml
vendored
20
.github/workflows/cypress-e2e.yml
vendored
@@ -20,9 +20,11 @@ jobs:
|
|||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
node-version: [20.x]
|
node-version: [20.x]
|
||||||
# containers: [1, 2, 3]
|
containers: [1, 2, 3]
|
||||||
php-versions: [ '8.2' ]
|
php-versions: [ '8.2' ]
|
||||||
server-versions: [ 'stable32' ]
|
server-versions: [ 'master' ]
|
||||||
|
|
||||||
|
name: runner ${{ matrix.containers }}
|
||||||
|
|
||||||
env:
|
env:
|
||||||
extensions: mbstring, iconv, fileinfo, intl, sqlite, pdo_sqlite, zip, gd, apcu
|
extensions: mbstring, iconv, fileinfo, intl, sqlite, pdo_sqlite, zip, gd, apcu
|
||||||
@@ -135,6 +137,8 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
|
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
|
||||||
npm_package_name: ${{ env.APP_NAME }}
|
npm_package_name: ${{ env.APP_NAME }}
|
||||||
|
SPLIT: ${{ strategy.job-total }}
|
||||||
|
SPLIT_INDEX: ${{ strategy.job-index }}
|
||||||
|
|
||||||
- name: Upload test failure screenshots
|
- name: Upload test failure screenshots
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
@@ -151,3 +155,15 @@ jobs:
|
|||||||
name: Upload nextcloud log
|
name: Upload nextcloud log
|
||||||
path: data/nextcloud.log
|
path: data/nextcloud.log
|
||||||
retention-days: 5
|
retention-days: 5
|
||||||
|
|
||||||
|
summary:
|
||||||
|
runs-on: ubuntu-latest-low
|
||||||
|
needs: [ cypress ]
|
||||||
|
|
||||||
|
if: always()
|
||||||
|
|
||||||
|
name: cypress-summary
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Summary status
|
||||||
|
run: if ${{ needs.cypress.result != 'success' && needs.cypress.result != 'skipped' }}; then exit 1; fi
|
||||||
|
|||||||
2
.github/workflows/integration.yml
vendored
2
.github/workflows/integration.yml
vendored
@@ -28,7 +28,7 @@ jobs:
|
|||||||
matrix:
|
matrix:
|
||||||
php-versions: ['8.1']
|
php-versions: ['8.1']
|
||||||
databases: ['sqlite', 'mysql', 'pgsql']
|
databases: ['sqlite', 'mysql', 'pgsql']
|
||||||
server-versions: ['stable32']
|
server-versions: ['master']
|
||||||
|
|
||||||
name: php${{ matrix.php-versions }}-${{ matrix.databases }}-${{ matrix.server-versions }}
|
name: php${{ matrix.php-versions }}-${{ matrix.databases }}-${{ matrix.server-versions }}
|
||||||
|
|
||||||
|
|||||||
2
.github/workflows/npm-audit-fix.yml
vendored
2
.github/workflows/npm-audit-fix.yml
vendored
@@ -24,7 +24,7 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
branches: ['main', 'master', 'stable31', 'stable30']
|
branches: ['main', 'master', 'stable32', 'stable31', 'stable30']
|
||||||
|
|
||||||
name: npm-audit-fix-${{ matrix.branches }}
|
name: npm-audit-fix-${{ matrix.branches }}
|
||||||
|
|
||||||
|
|||||||
2
.github/workflows/update-nextcloud-ocp.yml
vendored
2
.github/workflows/update-nextcloud-ocp.yml
vendored
@@ -23,7 +23,7 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
branches: ['main', 'master', 'stable31', 'stable30']
|
branches: ['main', 'master', 'stable32', 'stable31', 'stable30']
|
||||||
|
|
||||||
name: update-nextcloud-ocp-${{ matrix.branches }}
|
name: update-nextcloud-ocp-${{ matrix.branches }}
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
- Adrian Missy <adrian.missy@onewavestudios.com>
|
- Adrian Missy <adrian.missy@onewavestudios.com>
|
||||||
- Alexandru Puiu <alexpuiu20@yahoo.com>
|
- Alexandru Puiu <alexpuiu20@yahoo.com>
|
||||||
|
- Arne Bartelt <arne.bartelt@gmail.com>
|
||||||
- Chandi Langecker <git@chandi.it>
|
- Chandi Langecker <git@chandi.it>
|
||||||
- Christoph Wurst <christoph@winzerhof-wurst.at>
|
- Christoph Wurst <christoph@winzerhof-wurst.at>
|
||||||
- Gary Kim <gary@garykim.dev>
|
- Gary Kim <gary@garykim.dev>
|
||||||
|
|||||||
18
CHANGELOG.md
18
CHANGELOG.md
@@ -5,24 +5,6 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
|
|
||||||
## 1.16.0
|
|
||||||
### Added
|
|
||||||
- feat: update default content @luka-nextcloud [#6740](https://github.com/nextcloud/deck/pull/6740)
|
|
||||||
- feat: add board import and export @luka-nextcloud [#6872](https://github.com/nextcloud/deck/pull/6872)
|
|
||||||
- feat: use outline icons @luka-nextcloud [#7114](https://github.com/nextcloud/deck/pull/7114)
|
|
||||||
- Add OCC commands for global calendar feature opt-in and opt-out in Deck @Fledermaus-20 [#7080](https://github.com/nextcloud/deck/pull/7080)
|
|
||||||
- [stable32] Migrate delete icon to Material Symbol outline variant @backportbot [#7211](https://github.com/nextcloud/deck/pull/7211)
|
|
||||||
- Chore(deps): Bump @nextcloud/vue from 8.27.0 to 8.31.0 @luka-nextcloud [#7271](https://github.com/nextcloud/deck/pull/7271)
|
|
||||||
|
|
||||||
### Fixed
|
|
||||||
- CSV export fixes @gidan80 [#6800](https://github.com/nextcloud/deck/pull/6800)
|
|
||||||
- [stable32] fix: Fix colors from due dates and done @backportbot [#7239](https://github.com/nextcloud/deck/pull/7239)
|
|
||||||
- [stable32] fix(darkmode): Fix activity icon colors @backportbot [#7241](https://github.com/nextcloud/deck/pull/7241)
|
|
||||||
- [stable32] fix: redirect to cleaner URL if RewriteBase is enabled @backportbot [#7268](https://github.com/nextcloud/deck/pull/7268)
|
|
||||||
- [stable32] fix: missing push notifications @backportbot [#7270](https://github.com/nextcloud/deck/pull/7270)
|
|
||||||
- [stable32] fix: use text cursor for card title on dashboard @backportbot [#7273](https://github.com/nextcloud/deck/pull/7273)
|
|
||||||
- [stable32] fix: parse arguments to CardService.reorder correctly to int @backportbot [#7276](https://github.com/nextcloud/deck/pull/7276)
|
|
||||||
|
|
||||||
## 1.16.0-beta.1
|
## 1.16.0-beta.1
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
- 🚀 Get your project organized
|
- 🚀 Get your project organized
|
||||||
|
|
||||||
</description>
|
</description>
|
||||||
<version>1.16.0</version>
|
<version>2.0.0-dev.0</version>
|
||||||
<licence>agpl</licence>
|
<licence>agpl</licence>
|
||||||
<author>Julius Härtl</author>
|
<author>Julius Härtl</author>
|
||||||
<namespace>Deck</namespace>
|
<namespace>Deck</namespace>
|
||||||
@@ -42,7 +42,7 @@
|
|||||||
<database min-version="9.4">pgsql</database>
|
<database min-version="9.4">pgsql</database>
|
||||||
<database>sqlite</database>
|
<database>sqlite</database>
|
||||||
<database min-version="8.0">mysql</database>
|
<database min-version="8.0">mysql</database>
|
||||||
<nextcloud min-version="32" max-version="32"/>
|
<nextcloud min-version="33" max-version="33"/>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<background-jobs>
|
<background-jobs>
|
||||||
<job>OCA\Deck\Cron\DeleteCron</job>
|
<job>OCA\Deck\Cron\DeleteCron</job>
|
||||||
|
|||||||
@@ -9,31 +9,35 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"require": {
|
"require": {
|
||||||
"justinrainbow/json-schema": "^6.0"
|
"justinrainbow/json-schema": "^6.0",
|
||||||
|
"bamarni/composer-bin-plugin": "^1.8"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"roave/security-advisories": "dev-master",
|
"roave/security-advisories": "dev-master",
|
||||||
"phpunit/phpunit": "^9",
|
"phpunit/phpunit": "^9",
|
||||||
"nextcloud/coding-standard": "^1.1",
|
"nextcloud/coding-standard": "^1.1",
|
||||||
"nextcloud/ocp": "dev-stable32",
|
"nextcloud/ocp": "dev-master"
|
||||||
"psalm/phar": "^5.13"
|
|
||||||
},
|
},
|
||||||
"config": {
|
"config": {
|
||||||
"optimize-autoloader": true,
|
"optimize-autoloader": true,
|
||||||
"allow-plugins": {
|
"allow-plugins": {
|
||||||
"composer/package-versions-deprecated": true
|
"composer/package-versions-deprecated": true,
|
||||||
|
"bamarni/composer-bin-plugin": true
|
||||||
},
|
},
|
||||||
"platform": {
|
"platform": {
|
||||||
"php": "8.1"
|
"php": "8.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
"post-install-cmd": [
|
||||||
|
"@composer bin all install --ansi"
|
||||||
|
],
|
||||||
"lint": "find . -name \\*.php -not -path './vendor/*' -print0 | xargs -0 -n1 php -l",
|
"lint": "find . -name \\*.php -not -path './vendor/*' -print0 | xargs -0 -n1 php -l",
|
||||||
"cs:check": "php-cs-fixer fix --dry-run --diff",
|
"cs:check": "php-cs-fixer fix --dry-run --diff",
|
||||||
"cs:fix": "php-cs-fixer fix",
|
"cs:fix": "php-cs-fixer fix",
|
||||||
"psalm": "psalm.phar",
|
"psalm": "psalm",
|
||||||
"psalm:update-baseline": "psalm.phar --update-baseline",
|
"psalm:update-baseline": "psalm --threads=$(nproc) --no-cache --update-baseline",
|
||||||
"psalm:fix": "psalm.phar --alter --issues=InvalidReturnType,InvalidNullableReturnType,MismatchingDocblockParamType,MismatchingDocblockReturnType,MissingParamType,InvalidFalsableReturnType",
|
"psalm:fix": "psalm --alter --issues=InvalidReturnType,InvalidNullableReturnType,MismatchingDocblockParamType,MismatchingDocblockReturnType,MissingParamType,InvalidFalsableReturnType",
|
||||||
"test": [
|
"test": [
|
||||||
"@test:unit",
|
"@test:unit",
|
||||||
"@test:integration"
|
"@test:integration"
|
||||||
|
|||||||
109
composer.lock
generated
109
composer.lock
generated
@@ -4,8 +4,65 @@
|
|||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"content-hash": "a802f567c811977afdf6203368ae43e9",
|
"content-hash": "263f9ff9e6a13d50ab09bc9f4e06b749",
|
||||||
"packages": [
|
"packages": [
|
||||||
|
{
|
||||||
|
"name": "bamarni/composer-bin-plugin",
|
||||||
|
"version": "1.8.2",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/bamarni/composer-bin-plugin.git",
|
||||||
|
"reference": "92fd7b1e6e9cdae19b0d57369d8ad31a37b6a880"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/bamarni/composer-bin-plugin/zipball/92fd7b1e6e9cdae19b0d57369d8ad31a37b6a880",
|
||||||
|
"reference": "92fd7b1e6e9cdae19b0d57369d8ad31a37b6a880",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"composer-plugin-api": "^2.0",
|
||||||
|
"php": "^7.2.5 || ^8.0"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"composer/composer": "^2.0",
|
||||||
|
"ext-json": "*",
|
||||||
|
"phpstan/extension-installer": "^1.1",
|
||||||
|
"phpstan/phpstan": "^1.8",
|
||||||
|
"phpstan/phpstan-phpunit": "^1.1",
|
||||||
|
"phpunit/phpunit": "^8.5 || ^9.5",
|
||||||
|
"symfony/console": "^2.8.52 || ^3.4.35 || ^4.4 || ^5.0 || ^6.0",
|
||||||
|
"symfony/finder": "^2.8.52 || ^3.4.35 || ^4.4 || ^5.0 || ^6.0",
|
||||||
|
"symfony/process": "^2.8.52 || ^3.4.35 || ^4.4 || ^5.0 || ^6.0"
|
||||||
|
},
|
||||||
|
"type": "composer-plugin",
|
||||||
|
"extra": {
|
||||||
|
"class": "Bamarni\\Composer\\Bin\\BamarniBinPlugin"
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Bamarni\\Composer\\Bin\\": "src"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"description": "No conflicts for your bin dependencies",
|
||||||
|
"keywords": [
|
||||||
|
"composer",
|
||||||
|
"conflict",
|
||||||
|
"dependency",
|
||||||
|
"executable",
|
||||||
|
"isolation",
|
||||||
|
"tool"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/bamarni/composer-bin-plugin/issues",
|
||||||
|
"source": "https://github.com/bamarni/composer-bin-plugin/tree/1.8.2"
|
||||||
|
},
|
||||||
|
"time": "2022-10-31T08:38:03+00:00"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "justinrainbow/json-schema",
|
"name": "justinrainbow/json-schema",
|
||||||
"version": "6.4.2",
|
"version": "6.4.2",
|
||||||
@@ -376,16 +433,16 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "nextcloud/ocp",
|
"name": "nextcloud/ocp",
|
||||||
"version": "dev-stable32",
|
"version": "dev-master",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/nextcloud-deps/ocp.git",
|
"url": "https://github.com/nextcloud-deps/ocp.git",
|
||||||
"reference": "251d379ae2c80830880d49e1070926f89bc48669"
|
"reference": "9a2e6c0bf6f2d87e1db8d18063a5bedf85040bb2"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/nextcloud-deps/ocp/zipball/251d379ae2c80830880d49e1070926f89bc48669",
|
"url": "https://api.github.com/repos/nextcloud-deps/ocp/zipball/9a2e6c0bf6f2d87e1db8d18063a5bedf85040bb2",
|
||||||
"reference": "251d379ae2c80830880d49e1070926f89bc48669",
|
"reference": "9a2e6c0bf6f2d87e1db8d18063a5bedf85040bb2",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@@ -395,10 +452,11 @@
|
|||||||
"psr/event-dispatcher": "^1.0",
|
"psr/event-dispatcher": "^1.0",
|
||||||
"psr/log": "^3.0.2"
|
"psr/log": "^3.0.2"
|
||||||
},
|
},
|
||||||
|
"default-branch": true,
|
||||||
"type": "library",
|
"type": "library",
|
||||||
"extra": {
|
"extra": {
|
||||||
"branch-alias": {
|
"branch-alias": {
|
||||||
"dev-stable32": "32.0.0-dev"
|
"dev-master": "33.0.0-dev"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"notification-url": "https://packagist.org/downloads/",
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
@@ -418,9 +476,9 @@
|
|||||||
"description": "Composer package containing Nextcloud's public OCP API and the unstable NCU API",
|
"description": "Composer package containing Nextcloud's public OCP API and the unstable NCU API",
|
||||||
"support": {
|
"support": {
|
||||||
"issues": "https://github.com/nextcloud-deps/ocp/issues",
|
"issues": "https://github.com/nextcloud-deps/ocp/issues",
|
||||||
"source": "https://github.com/nextcloud-deps/ocp/tree/stable32"
|
"source": "https://github.com/nextcloud-deps/ocp/tree/master"
|
||||||
},
|
},
|
||||||
"time": "2025-10-03T00:46:18+00:00"
|
"time": "2025-09-27T00:45:05+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "nikic/php-parser",
|
"name": "nikic/php-parser",
|
||||||
@@ -1072,41 +1130,6 @@
|
|||||||
],
|
],
|
||||||
"time": "2024-12-05T13:48:26+00:00"
|
"time": "2024-12-05T13:48:26+00:00"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "psalm/phar",
|
|
||||||
"version": "5.26.1",
|
|
||||||
"source": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "https://github.com/psalm/phar.git",
|
|
||||||
"reference": "8a38e7ad04499a0ccd2c506fd1da6fc01fff4547"
|
|
||||||
},
|
|
||||||
"dist": {
|
|
||||||
"type": "zip",
|
|
||||||
"url": "https://api.github.com/repos/psalm/phar/zipball/8a38e7ad04499a0ccd2c506fd1da6fc01fff4547",
|
|
||||||
"reference": "8a38e7ad04499a0ccd2c506fd1da6fc01fff4547",
|
|
||||||
"shasum": ""
|
|
||||||
},
|
|
||||||
"require": {
|
|
||||||
"php": "^7.1 || ^8.0"
|
|
||||||
},
|
|
||||||
"conflict": {
|
|
||||||
"vimeo/psalm": "*"
|
|
||||||
},
|
|
||||||
"bin": [
|
|
||||||
"psalm.phar"
|
|
||||||
],
|
|
||||||
"type": "library",
|
|
||||||
"notification-url": "https://packagist.org/downloads/",
|
|
||||||
"license": [
|
|
||||||
"MIT"
|
|
||||||
],
|
|
||||||
"description": "Composer-based Psalm Phar",
|
|
||||||
"support": {
|
|
||||||
"issues": "https://github.com/psalm/phar/issues",
|
|
||||||
"source": "https://github.com/psalm/phar/tree/5.26.1"
|
|
||||||
},
|
|
||||||
"time": "2024-09-09T16:22:43+00:00"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "psr/clock",
|
"name": "psr/clock",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
|
|
||||||
input[type=submit].icon-confirm {
|
input[type=submit].icon-confirm {
|
||||||
border-color: var(--color-border-maxcontrast) !important;
|
border-color: var(--color-border-maxcontrast) !important;
|
||||||
|
border-style: solid;
|
||||||
border-left: none;
|
border-left: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
const { defineConfig } = require('cypress')
|
const { defineConfig } = require('cypress')
|
||||||
|
const cypressSplit = require('cypress-split')
|
||||||
|
|
||||||
module.exports = defineConfig({
|
module.exports = defineConfig({
|
||||||
projectId: '1s7wkc',
|
projectId: '1s7wkc',
|
||||||
@@ -8,9 +9,12 @@ module.exports = defineConfig({
|
|||||||
// We've imported your old cypress plugins here.
|
// We've imported your old cypress plugins here.
|
||||||
// You may want to clean this up later by importing these.
|
// You may want to clean this up later by importing these.
|
||||||
setupNodeEvents(on, config) {
|
setupNodeEvents(on, config) {
|
||||||
return require('./cypress/plugins/index.js')(on, config)
|
cypressSplit(on, config)
|
||||||
|
require('./cypress/plugins/index.js')(on, config)
|
||||||
|
return config
|
||||||
},
|
},
|
||||||
baseUrl: 'http://nextcloud.local/index.php',
|
baseUrl: 'http://nextcloud.local/index.php',
|
||||||
specPattern: 'cypress/e2e/**/*.{js,jsx,ts,tsx}',
|
specPattern: 'cypress/e2e/**/*.{js,jsx,ts,tsx}',
|
||||||
|
experimentalMemoryManagement: true,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|||||||
103
cypress/e2e/cardActions.js
Normal file
103
cypress/e2e/cardActions.js
Normal file
@@ -0,0 +1,103 @@
|
|||||||
|
/**
|
||||||
|
* SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
|
||||||
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||||
|
*/
|
||||||
|
import { randUser } from '../utils/index.js'
|
||||||
|
import { sampleBoard } from '../utils/sampleBoard'
|
||||||
|
|
||||||
|
const user = randUser()
|
||||||
|
const boardData = sampleBoard()
|
||||||
|
|
||||||
|
const auth = {
|
||||||
|
user: user.userId,
|
||||||
|
password: user.password,
|
||||||
|
}
|
||||||
|
|
||||||
|
const useModal = (useModal) => {
|
||||||
|
return cy.request({
|
||||||
|
method: 'POST',
|
||||||
|
url: `${Cypress.env('baseUrl')}/ocs/v2.php/apps/deck/api/v1.0/config/cardDetailsInModal?format=json`,
|
||||||
|
auth,
|
||||||
|
body: { value: useModal },
|
||||||
|
}).then((response) => {
|
||||||
|
expect(response.status).to.eq(200)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('Card actions', function () {
|
||||||
|
let boardId
|
||||||
|
before(function () {
|
||||||
|
cy.createUser(user)
|
||||||
|
cy.login(user)
|
||||||
|
cy.createExampleBoard({
|
||||||
|
user,
|
||||||
|
board: boardData,
|
||||||
|
}).then((board) => {
|
||||||
|
boardId = board.id
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
beforeEach(function () {
|
||||||
|
cy.login(user)
|
||||||
|
useModal(false).then(() => {
|
||||||
|
cy.visit(`/apps/deck/#/board/${boardId}`)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
it('Custom card actions', () => {
|
||||||
|
const myAction = {
|
||||||
|
label: 'Test action',
|
||||||
|
icon: 'icon-user',
|
||||||
|
callback(card) {
|
||||||
|
console.log('Called callback', card)
|
||||||
|
},
|
||||||
|
}
|
||||||
|
cy.spy(myAction, 'callback').as('myAction.callback')
|
||||||
|
|
||||||
|
cy.window().then(win => {
|
||||||
|
win.OCA.Deck.registerCardAction(myAction)
|
||||||
|
})
|
||||||
|
|
||||||
|
cy.get('.card:contains("Hello world")').should('be.visible').click()
|
||||||
|
cy.get('#app-sidebar-vue')
|
||||||
|
.find('.ProseMirror h1').contains('Hello world').should('be.visible')
|
||||||
|
|
||||||
|
cy.get('.app-sidebar-header .action-item__menutoggle').click()
|
||||||
|
cy.get('.v-popper__popper button:contains("Test action")').click()
|
||||||
|
|
||||||
|
cy.get('@myAction.callback')
|
||||||
|
.should('be.called')
|
||||||
|
.its('firstCall.args.0')
|
||||||
|
.as('args')
|
||||||
|
|
||||||
|
cy.url().then(url => {
|
||||||
|
const cardId = url.split('/').pop()
|
||||||
|
cy.get('@args').should('have.property', 'name', 'Hello world')
|
||||||
|
cy.get('@args').should('have.property', 'stackname', 'TestList')
|
||||||
|
cy.get('@args').should('have.property', 'boardname', 'MyTestBoard')
|
||||||
|
cy.get('@args').its('link').then((url) => {
|
||||||
|
expect(url.split('/').pop() === cardId).to.be.true
|
||||||
|
cy.visit(url)
|
||||||
|
cy.get('#app-sidebar-vue')
|
||||||
|
.find('.ProseMirror h1').contains('Hello world').should('be.visible')
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
it('clone card', () => {
|
||||||
|
cy.intercept({ method: 'POST', url: '**/apps/deck/**/cards/*/clone' }).as('clone')
|
||||||
|
cy.get('.card:contains("Hello world")').should('be.visible').click()
|
||||||
|
cy.get('#app-sidebar-vue')
|
||||||
|
.find('.ProseMirror h1').contains('Hello world').should('be.visible')
|
||||||
|
|
||||||
|
cy.get('.app-sidebar-header .action-item__menutoggle').click()
|
||||||
|
cy.get('.v-popper__popper button:contains("Move/copy card")').click()
|
||||||
|
cy.get('.vs__dropdown-menu span[title="MyTestBoard"]').should('be.visible').click()
|
||||||
|
cy.wait(3000) // wait for select component to load stacks
|
||||||
|
cy.get('[data-cy="select-stack"] .vs__dropdown-toggle').should('be.visible').click()
|
||||||
|
cy.get('.vs__dropdown-menu span[title="TestList"]').should('be.visible').click()
|
||||||
|
cy.get('.modal-container button:contains("Copy card")').click()
|
||||||
|
cy.wait('@clone', { timeout: 7000 })
|
||||||
|
cy.get('.card:contains("Hello world")').should('have.length', 2)
|
||||||
|
})
|
||||||
|
})
|
||||||
@@ -321,69 +321,4 @@ describe('Card', function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('Card actions', () => {
|
|
||||||
beforeEach(function () {
|
|
||||||
cy.login(user)
|
|
||||||
useModal(false).then(() => {
|
|
||||||
cy.visit(`/apps/deck/#/board/${boardId}`)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
it('Custom card actions', () => {
|
|
||||||
const myAction = {
|
|
||||||
label: 'Test action',
|
|
||||||
icon: 'icon-user',
|
|
||||||
callback(card) {
|
|
||||||
console.log('Called callback', card)
|
|
||||||
},
|
|
||||||
}
|
|
||||||
cy.spy(myAction, 'callback').as('myAction.callback')
|
|
||||||
|
|
||||||
cy.window().then(win => {
|
|
||||||
win.OCA.Deck.registerCardAction(myAction)
|
|
||||||
})
|
|
||||||
|
|
||||||
cy.get('.card:contains("Hello world")').should('be.visible').click()
|
|
||||||
cy.get('#app-sidebar-vue')
|
|
||||||
.find('.ProseMirror h1').contains('Hello world').should('be.visible')
|
|
||||||
|
|
||||||
cy.get('.app-sidebar-header .action-item__menutoggle').click()
|
|
||||||
cy.get('.v-popper__popper button:contains("Test action")').click()
|
|
||||||
|
|
||||||
cy.get('@myAction.callback')
|
|
||||||
.should('be.called')
|
|
||||||
.its('firstCall.args.0')
|
|
||||||
.as('args')
|
|
||||||
|
|
||||||
cy.url().then(url => {
|
|
||||||
const cardId = url.split('/').pop()
|
|
||||||
cy.get('@args').should('have.property', 'name', 'Hello world')
|
|
||||||
cy.get('@args').should('have.property', 'stackname', 'TestList')
|
|
||||||
cy.get('@args').should('have.property', 'boardname', 'MyTestBoard')
|
|
||||||
cy.get('@args').its('link').then((url) => {
|
|
||||||
expect(url.split('/').pop() === cardId).to.be.true
|
|
||||||
cy.visit(url)
|
|
||||||
cy.get('#app-sidebar-vue')
|
|
||||||
.find('.ProseMirror h1').contains('Hello world').should('be.visible')
|
|
||||||
})
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
it('clone card', () => {
|
|
||||||
cy.intercept({ method: 'POST', url: '**/apps/deck/**/cards/*/clone' }).as('clone')
|
|
||||||
cy.get('.card:contains("Hello world")').should('be.visible').click()
|
|
||||||
cy.get('#app-sidebar-vue')
|
|
||||||
.find('.ProseMirror h1').contains('Hello world').should('be.visible')
|
|
||||||
|
|
||||||
cy.get('.app-sidebar-header .action-item__menutoggle').click()
|
|
||||||
cy.get('.v-popper__popper button:contains("Move/copy card")').click()
|
|
||||||
cy.get('.vs__dropdown-menu span[title="MyTestBoard"]').should('be.visible').click()
|
|
||||||
cy.get('[data-cy="select-stack"] .vs__dropdown-toggle').should('be.visible').click()
|
|
||||||
cy.get('.vs__dropdown-menu span[title="TestList"]').should('be.visible').click()
|
|
||||||
cy.get('.modal-container button:contains("Copy card")').click()
|
|
||||||
cy.wait('@clone', { timeout: 7000 })
|
|
||||||
cy.get('.card:contains("Hello world")').should('have.length', 2)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
|
|||||||
24
docs/API.md
24
docs/API.md
@@ -6,7 +6,7 @@ The REST API provides access for authenticated users to their data inside the De
|
|||||||
|
|
||||||
# Prerequisites
|
# Prerequisites
|
||||||
|
|
||||||
- All requests require a `OCS-APIRequest` HTTP header to be set to `true` and a `Content-Type` of `application/json`.
|
- All requests require a `OCS-APIRequest` HTTP header to be set to `true` and a `Content-Type` of `application/json`. This does not apply to the endpoint for uploading attachments, which consumes `multipart/form-data`.
|
||||||
- The API is located at https://nextcloud.local/index.php/apps/deck/api/v1.0
|
- The API is located at https://nextcloud.local/index.php/apps/deck/api/v1.0
|
||||||
- All request parameters are required, unless otherwise specified
|
- All request parameters are required, unless otherwise specified
|
||||||
|
|
||||||
@@ -733,6 +733,7 @@ The board list endpoint supports setting an `If-Modified-Since` header to limit
|
|||||||
| Parameter | Type | Description |
|
| Parameter | Type | Description |
|
||||||
| --------- | ------- | --------------------------------------- |
|
| --------- | ------- | --------------------------------------- |
|
||||||
| labelId | Integer | The label id to assign to the card |
|
| labelId | Integer | The label id to assign to the card |
|
||||||
|
|
||||||
#### Response
|
#### Response
|
||||||
|
|
||||||
##### 200 Success
|
##### 200 Success
|
||||||
@@ -997,10 +998,12 @@ The request can fail with a bad request response for the following reasons:
|
|||||||
|
|
||||||
#### Request data
|
#### Request data
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
The request is performed as `multipart/form-data`.
|
||||||
| --------- | ------- | --------------------------------------------- |
|
|
||||||
| type | String | The type of the attachement |
|
| Parameter | Type | Description |
|
||||||
| file | Binary | File data to add as an attachment |
|
| --------- | ------- | ----------------------------------------------------------------------------------------------- |
|
||||||
|
| type | String | The type of the attachement. Use `file` or `deck_file`. |
|
||||||
|
| file | Binary | File data to add as an attachment together with the `filename` parameter according to RFC 7578. |
|
||||||
|
|
||||||
- Prior to Deck version v1.3.0 (API v1.0), attachments were stored within deck. For this type of attachments `deck_file` was used as the default type of attachments
|
- Prior to Deck version v1.3.0 (API v1.0), attachments were stored within deck. For this type of attachments `deck_file` was used as the default type of attachments
|
||||||
- Starting with Deck version 1.3.0 (API v1.1) files are stored within the users regular Nextcloud files and the type `file` has been introduced for that
|
- Starting with Deck version 1.3.0 (API v1.1) files are stored within the users regular Nextcloud files and the type `file` has been introduced for that
|
||||||
@@ -1022,12 +1025,13 @@ The request can fail with a bad request response for the following reasons:
|
|||||||
|
|
||||||
#### Request data
|
#### Request data
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
The request is performed as `multipart/form-data`.
|
||||||
| --------- | ------- | --------------------------------------------- |
|
|
||||||
| type | String | The type of the attachement |
|
| Parameter | Type | Description |
|
||||||
| file | Binary | File data to add as an attachment |
|
| --------- | ------- | ----------------------------------------------------------------------------------------------- |
|
||||||
|
| type | String | The type of the attachement. For now only `deck_file` is supported as an attachment type. |
|
||||||
|
| file | Binary | File data to add as an attachment together with the `filename` parameter according to RFC 7578. |
|
||||||
|
|
||||||
For now only `deck_file` is supported as an attachment type.
|
|
||||||
|
|
||||||
#### Response
|
#### Response
|
||||||
|
|
||||||
|
|||||||
@@ -373,7 +373,6 @@ OC.L10N.register(
|
|||||||
"Note: Only the JSON format is supported for importing back into the Deck app." : "Megjegyzés: Csak a JSON formátum támogatott a Kártyák alkalmazásba való importáláskor.",
|
"Note: Only the JSON format is supported for importing back into the Deck app." : "Megjegyzés: Csak a JSON formátum támogatott a Kártyák alkalmazásba való importáláskor.",
|
||||||
"Export" : "Exportálás",
|
"Export" : "Exportálás",
|
||||||
"Loading filtered view" : "Szűrt nézet betöltése",
|
"Loading filtered view" : "Szűrt nézet betöltése",
|
||||||
"Search for {searchQuery} in other boards" : "Keresés a(z) {searchQuery} kifejezésre a többi táblában",
|
|
||||||
"Search for {searchQuery} in all boards" : "Keresés a(z) {searchQuery} kifejezésre az összes táblában",
|
"Search for {searchQuery} in all boards" : "Keresés a(z) {searchQuery} kifejezésre az összes táblában",
|
||||||
"No results found" : "Nincs találat",
|
"No results found" : "Nincs találat",
|
||||||
"Deck board {name}\n* Last modified on {lastMod}" : "{name} kártyatábla\n* Legutóbb módosítva: {lastMod}",
|
"Deck board {name}\n* Last modified on {lastMod}" : "{name} kártyatábla\n* Legutóbb módosítva: {lastMod}",
|
||||||
|
|||||||
@@ -371,7 +371,6 @@
|
|||||||
"Note: Only the JSON format is supported for importing back into the Deck app." : "Megjegyzés: Csak a JSON formátum támogatott a Kártyák alkalmazásba való importáláskor.",
|
"Note: Only the JSON format is supported for importing back into the Deck app." : "Megjegyzés: Csak a JSON formátum támogatott a Kártyák alkalmazásba való importáláskor.",
|
||||||
"Export" : "Exportálás",
|
"Export" : "Exportálás",
|
||||||
"Loading filtered view" : "Szűrt nézet betöltése",
|
"Loading filtered view" : "Szűrt nézet betöltése",
|
||||||
"Search for {searchQuery} in other boards" : "Keresés a(z) {searchQuery} kifejezésre a többi táblában",
|
|
||||||
"Search for {searchQuery} in all boards" : "Keresés a(z) {searchQuery} kifejezésre az összes táblában",
|
"Search for {searchQuery} in all boards" : "Keresés a(z) {searchQuery} kifejezésre az összes táblában",
|
||||||
"No results found" : "Nincs találat",
|
"No results found" : "Nincs találat",
|
||||||
"Deck board {name}\n* Last modified on {lastMod}" : "{name} kártyatábla\n* Legutóbb módosítva: {lastMod}",
|
"Deck board {name}\n* Last modified on {lastMod}" : "{name} kártyatábla\n* Legutóbb módosítva: {lastMod}",
|
||||||
|
|||||||
19
l10n/mk.js
19
l10n/mk.js
@@ -81,14 +81,10 @@ OC.L10N.register(
|
|||||||
"Could not write file to disk" : "Неможе да се запишува на дискот",
|
"Could not write file to disk" : "Неможе да се запишува на дискот",
|
||||||
"A PHP extension stopped the file upload" : "PHP додаток го стопираше прикачувањето на датотеката",
|
"A PHP extension stopped the file upload" : "PHP додаток го стопираше прикачувањето на датотеката",
|
||||||
"No file uploaded or file size exceeds maximum of %s" : "Нема прикачена дадотека или големината го надмминува максимумот од %s",
|
"No file uploaded or file size exceeds maximum of %s" : "Нема прикачена дадотека или големината го надмминува максимумот од %s",
|
||||||
"Invalid file type. Only JSON files are allowed." : "Невалиден тип на датотека. Дозволени се само JSON датотеки.",
|
|
||||||
"Invalid JSON data" : "Невалидни JSON податоци",
|
|
||||||
"Failed to import board" : "Неуспешен увоз на табла",
|
|
||||||
"Cards due today" : "Картици со рок до денес",
|
"Cards due today" : "Картици со рок до денес",
|
||||||
"Cards due tomorrow" : "Картици со рок до утре",
|
"Cards due tomorrow" : "Картици со рок до утре",
|
||||||
"Upcoming cards" : "Престојни картици",
|
"Upcoming cards" : "Престојни картици",
|
||||||
"Load more" : "Вчитај повеќе",
|
"Load more" : "Вчитај повеќе",
|
||||||
"Welcome to Nextcloud Deck!" : "Добредојдовте во Nextcloud Deck!",
|
|
||||||
"The card \"%s\" on \"%s\" has been assigned to you by %s." : "Картицата \"%s\" на \"%s\" ти е доделена од %s.",
|
"The card \"%s\" on \"%s\" has been assigned to you by %s." : "Картицата \"%s\" на \"%s\" ти е доделена од %s.",
|
||||||
"{user} has assigned the card {deck-card} on {deck-board} to you." : "{user} ти ја додели картицата {deck-card} на {deck-board}.",
|
"{user} has assigned the card {deck-card} on {deck-board} to you." : "{user} ти ја додели картицата {deck-card} на {deck-board}.",
|
||||||
"The card \"%s\" on \"%s\" has reached its due date." : "Картицата \"%s\" на \"%s\" го достигна датумот на истекување.",
|
"The card \"%s\" on \"%s\" has reached its due date." : "Картицата \"%s\" на \"%s\" го достигна датумот на истекување.",
|
||||||
@@ -112,15 +108,9 @@ OC.L10N.register(
|
|||||||
"Later" : "Покасно",
|
"Later" : "Покасно",
|
||||||
"copy" : "копирај",
|
"copy" : "копирај",
|
||||||
"Read more inside" : "Прочитај повеќе",
|
"Read more inside" : "Прочитај повеќе",
|
||||||
"Custom lists - click to rename!" : "Прилагодени листи – кликнете за преименување!",
|
|
||||||
"To Do" : "За правење",
|
"To Do" : "За правење",
|
||||||
"In Progress" : "Во тек",
|
"In Progress" : "Во тек",
|
||||||
"Done" : "Готово",
|
"Done" : "Готово",
|
||||||
"1. Open to learn more about boards and cards" : "1. Отворете за да дознаете повеќе за таблите и картичките",
|
|
||||||
"2. Drag cards left and right, up and down" : "2. Влечете ги картичките лево и десно, горе и долу",
|
|
||||||
"3. Apply rich formatting and link content" : "3. Применете богато форматирање и поврзете содржина",
|
|
||||||
"4. Share, comment and collaborate!" : "4. Споделувајте, коментирајте и соработувајте!",
|
|
||||||
"Create your first card!" : "Креирајте ја вашата прва картичка!",
|
|
||||||
"This comment has more than %s characters.\nAdded as an attachment to the card with name %s.\nAccessible on URL: %s." : "Коментарот има повеќе од %s карактери.\nДодаден е како пролог на картицата со име %s.\nДостапен е на линк: %s.",
|
"This comment has more than %s characters.\nAdded as an attachment to the card with name %s.\nAccessible on URL: %s." : "Коментарот има повеќе од %s карактери.\nДодаден е како пролог на картицата со име %s.\nДостапен е на линк: %s.",
|
||||||
"Attachments" : "Прилози",
|
"Attachments" : "Прилози",
|
||||||
"File" : "Датотека",
|
"File" : "Датотека",
|
||||||
@@ -162,7 +152,6 @@ OC.L10N.register(
|
|||||||
"Filter by assigned user" : "Филтрирај по назначени корисници",
|
"Filter by assigned user" : "Филтрирај по назначени корисници",
|
||||||
"Unassigned" : "Неназначени",
|
"Unassigned" : "Неназначени",
|
||||||
"Filter by status" : "Филтрирај по статус",
|
"Filter by status" : "Филтрирај по статус",
|
||||||
"Open and completed" : "Отворени и завршени",
|
|
||||||
"Open" : "Отвори",
|
"Open" : "Отвори",
|
||||||
"Completed" : "Завршено",
|
"Completed" : "Завршено",
|
||||||
"Filter by due date" : "Филтрирај по краен рок",
|
"Filter by due date" : "Филтрирај по краен рок",
|
||||||
@@ -305,9 +294,7 @@ OC.L10N.register(
|
|||||||
"Action" : "Акција",
|
"Action" : "Акција",
|
||||||
"Shift" : "Shift",
|
"Shift" : "Shift",
|
||||||
"Scroll" : "Scroll",
|
"Scroll" : "Scroll",
|
||||||
"Scroll sideways" : "Лизгај странично",
|
|
||||||
"Navigate between cards" : "Навигација помеѓу картиците",
|
"Navigate between cards" : "Навигација помеѓу картиците",
|
||||||
"Esc" : "Esc",
|
|
||||||
"Close card details" : "Затвори детали на картица",
|
"Close card details" : "Затвори детали на картица",
|
||||||
"Ctrl" : "Ctrl",
|
"Ctrl" : "Ctrl",
|
||||||
"Search" : "Барај",
|
"Search" : "Барај",
|
||||||
@@ -355,9 +342,6 @@ OC.L10N.register(
|
|||||||
"Assigned cards" : "Доделени картици",
|
"Assigned cards" : "Доделени картици",
|
||||||
"No notifications" : "Нема известувања",
|
"No notifications" : "Нема известувања",
|
||||||
"Delete board" : "Избриши табла",
|
"Delete board" : "Избриши табла",
|
||||||
"Importing board..." : "Увезување табла...",
|
|
||||||
"Board imported successfully" : "Таблата е успешно увезена",
|
|
||||||
"Import board" : "Увези табла",
|
|
||||||
"Clone {boardTitle}" : "Клонирај {boardTitle}",
|
"Clone {boardTitle}" : "Клонирај {boardTitle}",
|
||||||
"Clone cards" : "Клинирај картици",
|
"Clone cards" : "Клинирај картици",
|
||||||
"Clone assignments" : "Клонирај задачи",
|
"Clone assignments" : "Клонирај задачи",
|
||||||
@@ -368,9 +352,6 @@ OC.L10N.register(
|
|||||||
"Restore archived cards" : "Врати архивирани картици",
|
"Restore archived cards" : "Врати архивирани картици",
|
||||||
"Clone" : "Клонирај",
|
"Clone" : "Клонирај",
|
||||||
"Export {boardTitle}" : "Извези {boardTitle}",
|
"Export {boardTitle}" : "Извези {boardTitle}",
|
||||||
"Export as JSON" : "Извези како JSON",
|
|
||||||
"Export as CSV" : "Извези како CSV",
|
|
||||||
"Note: Only the JSON format is supported for importing back into the Deck app." : "Забелешка: Поддржан е само JSON формат за увоз назад во апликацијата Deck.",
|
|
||||||
"Export" : "Извези",
|
"Export" : "Извези",
|
||||||
"Loading filtered view" : "Вчитување на филтриран поглед",
|
"Loading filtered view" : "Вчитување на филтриран поглед",
|
||||||
"Search for {searchQuery} in other boards" : "Барај {searchQuery} во други табли",
|
"Search for {searchQuery} in other boards" : "Барај {searchQuery} во други табли",
|
||||||
|
|||||||
19
l10n/mk.json
19
l10n/mk.json
@@ -79,14 +79,10 @@
|
|||||||
"Could not write file to disk" : "Неможе да се запишува на дискот",
|
"Could not write file to disk" : "Неможе да се запишува на дискот",
|
||||||
"A PHP extension stopped the file upload" : "PHP додаток го стопираше прикачувањето на датотеката",
|
"A PHP extension stopped the file upload" : "PHP додаток го стопираше прикачувањето на датотеката",
|
||||||
"No file uploaded or file size exceeds maximum of %s" : "Нема прикачена дадотека или големината го надмминува максимумот од %s",
|
"No file uploaded or file size exceeds maximum of %s" : "Нема прикачена дадотека или големината го надмминува максимумот од %s",
|
||||||
"Invalid file type. Only JSON files are allowed." : "Невалиден тип на датотека. Дозволени се само JSON датотеки.",
|
|
||||||
"Invalid JSON data" : "Невалидни JSON податоци",
|
|
||||||
"Failed to import board" : "Неуспешен увоз на табла",
|
|
||||||
"Cards due today" : "Картици со рок до денес",
|
"Cards due today" : "Картици со рок до денес",
|
||||||
"Cards due tomorrow" : "Картици со рок до утре",
|
"Cards due tomorrow" : "Картици со рок до утре",
|
||||||
"Upcoming cards" : "Престојни картици",
|
"Upcoming cards" : "Престојни картици",
|
||||||
"Load more" : "Вчитај повеќе",
|
"Load more" : "Вчитај повеќе",
|
||||||
"Welcome to Nextcloud Deck!" : "Добредојдовте во Nextcloud Deck!",
|
|
||||||
"The card \"%s\" on \"%s\" has been assigned to you by %s." : "Картицата \"%s\" на \"%s\" ти е доделена од %s.",
|
"The card \"%s\" on \"%s\" has been assigned to you by %s." : "Картицата \"%s\" на \"%s\" ти е доделена од %s.",
|
||||||
"{user} has assigned the card {deck-card} on {deck-board} to you." : "{user} ти ја додели картицата {deck-card} на {deck-board}.",
|
"{user} has assigned the card {deck-card} on {deck-board} to you." : "{user} ти ја додели картицата {deck-card} на {deck-board}.",
|
||||||
"The card \"%s\" on \"%s\" has reached its due date." : "Картицата \"%s\" на \"%s\" го достигна датумот на истекување.",
|
"The card \"%s\" on \"%s\" has reached its due date." : "Картицата \"%s\" на \"%s\" го достигна датумот на истекување.",
|
||||||
@@ -110,15 +106,9 @@
|
|||||||
"Later" : "Покасно",
|
"Later" : "Покасно",
|
||||||
"copy" : "копирај",
|
"copy" : "копирај",
|
||||||
"Read more inside" : "Прочитај повеќе",
|
"Read more inside" : "Прочитај повеќе",
|
||||||
"Custom lists - click to rename!" : "Прилагодени листи – кликнете за преименување!",
|
|
||||||
"To Do" : "За правење",
|
"To Do" : "За правење",
|
||||||
"In Progress" : "Во тек",
|
"In Progress" : "Во тек",
|
||||||
"Done" : "Готово",
|
"Done" : "Готово",
|
||||||
"1. Open to learn more about boards and cards" : "1. Отворете за да дознаете повеќе за таблите и картичките",
|
|
||||||
"2. Drag cards left and right, up and down" : "2. Влечете ги картичките лево и десно, горе и долу",
|
|
||||||
"3. Apply rich formatting and link content" : "3. Применете богато форматирање и поврзете содржина",
|
|
||||||
"4. Share, comment and collaborate!" : "4. Споделувајте, коментирајте и соработувајте!",
|
|
||||||
"Create your first card!" : "Креирајте ја вашата прва картичка!",
|
|
||||||
"This comment has more than %s characters.\nAdded as an attachment to the card with name %s.\nAccessible on URL: %s." : "Коментарот има повеќе од %s карактери.\nДодаден е како пролог на картицата со име %s.\nДостапен е на линк: %s.",
|
"This comment has more than %s characters.\nAdded as an attachment to the card with name %s.\nAccessible on URL: %s." : "Коментарот има повеќе од %s карактери.\nДодаден е како пролог на картицата со име %s.\nДостапен е на линк: %s.",
|
||||||
"Attachments" : "Прилози",
|
"Attachments" : "Прилози",
|
||||||
"File" : "Датотека",
|
"File" : "Датотека",
|
||||||
@@ -160,7 +150,6 @@
|
|||||||
"Filter by assigned user" : "Филтрирај по назначени корисници",
|
"Filter by assigned user" : "Филтрирај по назначени корисници",
|
||||||
"Unassigned" : "Неназначени",
|
"Unassigned" : "Неназначени",
|
||||||
"Filter by status" : "Филтрирај по статус",
|
"Filter by status" : "Филтрирај по статус",
|
||||||
"Open and completed" : "Отворени и завршени",
|
|
||||||
"Open" : "Отвори",
|
"Open" : "Отвори",
|
||||||
"Completed" : "Завршено",
|
"Completed" : "Завршено",
|
||||||
"Filter by due date" : "Филтрирај по краен рок",
|
"Filter by due date" : "Филтрирај по краен рок",
|
||||||
@@ -303,9 +292,7 @@
|
|||||||
"Action" : "Акција",
|
"Action" : "Акција",
|
||||||
"Shift" : "Shift",
|
"Shift" : "Shift",
|
||||||
"Scroll" : "Scroll",
|
"Scroll" : "Scroll",
|
||||||
"Scroll sideways" : "Лизгај странично",
|
|
||||||
"Navigate between cards" : "Навигација помеѓу картиците",
|
"Navigate between cards" : "Навигација помеѓу картиците",
|
||||||
"Esc" : "Esc",
|
|
||||||
"Close card details" : "Затвори детали на картица",
|
"Close card details" : "Затвори детали на картица",
|
||||||
"Ctrl" : "Ctrl",
|
"Ctrl" : "Ctrl",
|
||||||
"Search" : "Барај",
|
"Search" : "Барај",
|
||||||
@@ -353,9 +340,6 @@
|
|||||||
"Assigned cards" : "Доделени картици",
|
"Assigned cards" : "Доделени картици",
|
||||||
"No notifications" : "Нема известувања",
|
"No notifications" : "Нема известувања",
|
||||||
"Delete board" : "Избриши табла",
|
"Delete board" : "Избриши табла",
|
||||||
"Importing board..." : "Увезување табла...",
|
|
||||||
"Board imported successfully" : "Таблата е успешно увезена",
|
|
||||||
"Import board" : "Увези табла",
|
|
||||||
"Clone {boardTitle}" : "Клонирај {boardTitle}",
|
"Clone {boardTitle}" : "Клонирај {boardTitle}",
|
||||||
"Clone cards" : "Клинирај картици",
|
"Clone cards" : "Клинирај картици",
|
||||||
"Clone assignments" : "Клонирај задачи",
|
"Clone assignments" : "Клонирај задачи",
|
||||||
@@ -366,9 +350,6 @@
|
|||||||
"Restore archived cards" : "Врати архивирани картици",
|
"Restore archived cards" : "Врати архивирани картици",
|
||||||
"Clone" : "Клонирај",
|
"Clone" : "Клонирај",
|
||||||
"Export {boardTitle}" : "Извези {boardTitle}",
|
"Export {boardTitle}" : "Извези {boardTitle}",
|
||||||
"Export as JSON" : "Извези како JSON",
|
|
||||||
"Export as CSV" : "Извези како CSV",
|
|
||||||
"Note: Only the JSON format is supported for importing back into the Deck app." : "Забелешка: Поддржан е само JSON формат за увоз назад во апликацијата Deck.",
|
|
||||||
"Export" : "Извези",
|
"Export" : "Извези",
|
||||||
"Loading filtered view" : "Вчитување на филтриран поглед",
|
"Loading filtered view" : "Вчитување на филтриран поглед",
|
||||||
"Search for {searchQuery} in other boards" : "Барај {searchQuery} во други табли",
|
"Search for {searchQuery} in other boards" : "Барај {searchQuery} во други табли",
|
||||||
|
|||||||
@@ -266,7 +266,6 @@ OC.L10N.register(
|
|||||||
"{count} comments, {unread} unread" : "{count} reacties, {unread} ongelezen",
|
"{count} comments, {unread} unread" : "{count} reacties, {unread} ongelezen",
|
||||||
"Todo items" : "Te doen onderwerpen",
|
"Todo items" : "Te doen onderwerpen",
|
||||||
"Edit card title" : "Wijzig de titel van de kaart",
|
"Edit card title" : "Wijzig de titel van de kaart",
|
||||||
"Open link" : "Open link",
|
|
||||||
"Card deleted" : "Kaart verwijderd",
|
"Card deleted" : "Kaart verwijderd",
|
||||||
"Edit title" : "Titel bewerken",
|
"Edit title" : "Titel bewerken",
|
||||||
"Assign to me" : "Aan mij toewijzen",
|
"Assign to me" : "Aan mij toewijzen",
|
||||||
@@ -280,7 +279,6 @@ OC.L10N.register(
|
|||||||
"Shift" : "Shift",
|
"Shift" : "Shift",
|
||||||
"Ctrl" : "Ctrl",
|
"Ctrl" : "Ctrl",
|
||||||
"Search" : "Zoeken",
|
"Search" : "Zoeken",
|
||||||
"Enter" : "Enter",
|
|
||||||
"All boards" : "Alle borden",
|
"All boards" : "Alle borden",
|
||||||
"Archived boards" : "Gearchiveerde borden",
|
"Archived boards" : "Gearchiveerde borden",
|
||||||
"Shared with you" : "Deelde met jou",
|
"Shared with you" : "Deelde met jou",
|
||||||
|
|||||||
@@ -264,7 +264,6 @@
|
|||||||
"{count} comments, {unread} unread" : "{count} reacties, {unread} ongelezen",
|
"{count} comments, {unread} unread" : "{count} reacties, {unread} ongelezen",
|
||||||
"Todo items" : "Te doen onderwerpen",
|
"Todo items" : "Te doen onderwerpen",
|
||||||
"Edit card title" : "Wijzig de titel van de kaart",
|
"Edit card title" : "Wijzig de titel van de kaart",
|
||||||
"Open link" : "Open link",
|
|
||||||
"Card deleted" : "Kaart verwijderd",
|
"Card deleted" : "Kaart verwijderd",
|
||||||
"Edit title" : "Titel bewerken",
|
"Edit title" : "Titel bewerken",
|
||||||
"Assign to me" : "Aan mij toewijzen",
|
"Assign to me" : "Aan mij toewijzen",
|
||||||
@@ -278,7 +277,6 @@
|
|||||||
"Shift" : "Shift",
|
"Shift" : "Shift",
|
||||||
"Ctrl" : "Ctrl",
|
"Ctrl" : "Ctrl",
|
||||||
"Search" : "Zoeken",
|
"Search" : "Zoeken",
|
||||||
"Enter" : "Enter",
|
|
||||||
"All boards" : "Alle borden",
|
"All boards" : "Alle borden",
|
||||||
"Archived boards" : "Gearchiveerde borden",
|
"Archived boards" : "Gearchiveerde borden",
|
||||||
"Shared with you" : "Deelde met jou",
|
"Shared with you" : "Deelde met jou",
|
||||||
|
|||||||
@@ -516,7 +516,7 @@ class ActivityManager {
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
private function findDetailsForCard($cardId, $subject = null) {
|
private function findDetailsForCard(int $cardId, ?string $subject = null): array {
|
||||||
$card = $this->cardMapper->find($cardId);
|
$card = $this->cardMapper->find($cardId);
|
||||||
$stack = $this->stackMapper->find($card->getStackId());
|
$stack = $this->stackMapper->find($card->getStackId());
|
||||||
$board = $this->boardMapper->find($stack->getBoardId());
|
$board = $this->boardMapper->find($stack->getBoardId());
|
||||||
|
|||||||
@@ -7,6 +7,9 @@
|
|||||||
|
|
||||||
namespace OCA\Deck\Activity;
|
namespace OCA\Deck\Activity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @psalm-api SettingComment
|
||||||
|
*/
|
||||||
class SettingComment extends SettingBase {
|
class SettingComment extends SettingBase {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -6,9 +6,13 @@
|
|||||||
*/
|
*/
|
||||||
namespace OCA\Deck\Controller;
|
namespace OCA\Deck\Controller;
|
||||||
|
|
||||||
|
use OCA\Deck\Db\Attachment;
|
||||||
use OCA\Deck\Service\AttachmentService;
|
use OCA\Deck\Service\AttachmentService;
|
||||||
use OCP\AppFramework\ApiController;
|
use OCP\AppFramework\ApiController;
|
||||||
use OCP\AppFramework\Http;
|
use OCP\AppFramework\Http;
|
||||||
|
use OCP\AppFramework\Http\Attribute\CORS;
|
||||||
|
use OCP\AppFramework\Http\Attribute\NoAdminRequired;
|
||||||
|
use OCP\AppFramework\Http\Attribute\NoCSRFRequired;
|
||||||
use OCP\AppFramework\Http\DataResponse;
|
use OCP\AppFramework\Http\DataResponse;
|
||||||
use OCP\IRequest;
|
use OCP\IRequest;
|
||||||
|
|
||||||
@@ -21,72 +25,52 @@ class AttachmentApiController extends ApiController {
|
|||||||
parent::__construct($appName, $request);
|
parent::__construct($appName, $request);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
#[NoAdminRequired]
|
||||||
* @NoAdminRequired
|
#[CORS]
|
||||||
* @CORS
|
#[NoCSRFRequired]
|
||||||
* @NoCSRFRequired
|
public function getAll(string $apiVersion): DataResponse {
|
||||||
*
|
|
||||||
*/
|
|
||||||
public function getAll($apiVersion) {
|
|
||||||
$attachment = $this->attachmentService->findAll($this->request->getParam('cardId'), true);
|
$attachment = $this->attachmentService->findAll($this->request->getParam('cardId'), true);
|
||||||
if ($apiVersion === '1.0') {
|
if ($apiVersion === '1.0') {
|
||||||
$attachment = array_filter($attachment, function ($attachment) {
|
$attachment = array_filter($attachment, fn (Attachment $attachment): bool => $attachment->getType() === 'deck_file');
|
||||||
return $attachment->getType() === 'deck_file';
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
return new DataResponse($attachment, HTTP::STATUS_OK);
|
return new DataResponse($attachment, HTTP::STATUS_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
#[NoAdminRequired]
|
||||||
* @NoAdminRequired
|
#[CORS]
|
||||||
* @CORS
|
#[NoCSRFRequired]
|
||||||
* @NoCSRFRequired
|
public function display(int $cardId, int $attachmentId, string $type = 'deck_file') {
|
||||||
*
|
|
||||||
*/
|
|
||||||
public function display($cardId, $attachmentId, $type = 'deck_file') {
|
|
||||||
return $this->attachmentService->display($cardId, $attachmentId, $type);
|
return $this->attachmentService->display($cardId, $attachmentId, $type);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
#[NoAdminRequired]
|
||||||
* @NoAdminRequired
|
#[CORS]
|
||||||
* @CORS
|
#[NoCSRFRequired]
|
||||||
* @NoCSRFRequired
|
public function create(int $cardId, string $type, string $data): DataResponse {
|
||||||
*
|
|
||||||
*/
|
|
||||||
public function create($cardId, $type, $data) {
|
|
||||||
$attachment = $this->attachmentService->create($cardId, $type, $data);
|
$attachment = $this->attachmentService->create($cardId, $type, $data);
|
||||||
return new DataResponse($attachment, HTTP::STATUS_OK);
|
return new DataResponse($attachment, HTTP::STATUS_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
#[NoAdminRequired]
|
||||||
* @NoAdminRequired
|
#[CORS]
|
||||||
* @CORS
|
#[NoCSRFRequired]
|
||||||
* @NoCSRFRequired
|
public function update(int $cardId, int $attachmentId, string $data, string $type = 'deck_file'): DataResponse {
|
||||||
*
|
|
||||||
*/
|
|
||||||
public function update($cardId, $attachmentId, $data, $type = 'deck_file') {
|
|
||||||
$attachment = $this->attachmentService->update($cardId, $attachmentId, $data, $type);
|
$attachment = $this->attachmentService->update($cardId, $attachmentId, $data, $type);
|
||||||
return new DataResponse($attachment, HTTP::STATUS_OK);
|
return new DataResponse($attachment, HTTP::STATUS_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
#[NoAdminRequired]
|
||||||
* @NoAdminRequired
|
#[CORS]
|
||||||
* @CORS
|
#[NoCSRFRequired]
|
||||||
* @NoCSRFRequired
|
public function delete(int $cardId, int $attachmentId, string $type = 'deck_file'): DataResponse {
|
||||||
*
|
|
||||||
*/
|
|
||||||
public function delete($cardId, $attachmentId, $type = 'deck_file') {
|
|
||||||
$attachment = $this->attachmentService->delete($cardId, $attachmentId, $type);
|
$attachment = $this->attachmentService->delete($cardId, $attachmentId, $type);
|
||||||
return new DataResponse($attachment, HTTP::STATUS_OK);
|
return new DataResponse($attachment, HTTP::STATUS_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
#[NoAdminRequired]
|
||||||
* @NoAdminRequired
|
#[CORS]
|
||||||
* @CORS
|
#[NoCSRFRequired]
|
||||||
* @NoCSRFRequired
|
public function restore(int $cardId, int $attachmentId, string $type = 'deck_file'): DataResponse {
|
||||||
*
|
|
||||||
*/
|
|
||||||
public function restore($cardId, $attachmentId, $type = 'deck_file') {
|
|
||||||
$attachment = $this->attachmentService->restore($cardId, $attachmentId, $type);
|
$attachment = $this->attachmentService->restore($cardId, $attachmentId, $type);
|
||||||
return new DataResponse($attachment, HTTP::STATUS_OK);
|
return new DataResponse($attachment, HTTP::STATUS_OK);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,8 +7,13 @@
|
|||||||
|
|
||||||
namespace OCA\Deck\Controller;
|
namespace OCA\Deck\Controller;
|
||||||
|
|
||||||
|
use OCA\Deck\BadRequestException;
|
||||||
|
use OCA\Deck\Db\Attachment;
|
||||||
use OCA\Deck\Service\AttachmentService;
|
use OCA\Deck\Service\AttachmentService;
|
||||||
use OCP\AppFramework\Controller;
|
use OCP\AppFramework\Controller;
|
||||||
|
use OCP\AppFramework\Http\Attribute\NoAdminRequired;
|
||||||
|
use OCP\AppFramework\Http\Attribute\NoCSRFRequired;
|
||||||
|
use OCP\AppFramework\Http\Response;
|
||||||
use OCP\IRequest;
|
use OCP\IRequest;
|
||||||
|
|
||||||
class AttachmentController extends Controller {
|
class AttachmentController extends Controller {
|
||||||
@@ -20,74 +25,66 @@ class AttachmentController extends Controller {
|
|||||||
parent::__construct($appName, $request);
|
parent::__construct($appName, $request);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
#[NoAdminRequired]
|
||||||
* @NoAdminRequired
|
public function getAll(int $cardId): array {
|
||||||
*/
|
|
||||||
public function getAll($cardId) {
|
|
||||||
return $this->attachmentService->findAll($cardId, true);
|
return $this->attachmentService->findAll($cardId, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $cardId
|
|
||||||
* @param $attachmentId
|
|
||||||
* @NoCSRFRequired
|
|
||||||
* @NoAdminRequired
|
|
||||||
* @return \OCP\AppFramework\Http\Response
|
|
||||||
* @throws \OCA\Deck\NotFoundException
|
* @throws \OCA\Deck\NotFoundException
|
||||||
*/
|
*/
|
||||||
public function display($cardId, $attachmentId) {
|
#[NoAdminRequired]
|
||||||
if (!str_contains($attachmentId, ':')) {
|
#[NoCSRFRequired]
|
||||||
$type = 'deck_file';
|
public function display(int $cardId, string $attachmentId): Response {
|
||||||
} else {
|
['type' => $type, 'attachmentId' => $attachmentId] = $this->extractTypeAndAttachmentId($attachmentId);
|
||||||
[$type, $attachmentId] = explode(':', $attachmentId);
|
|
||||||
}
|
|
||||||
return $this->attachmentService->display($cardId, $attachmentId, $type);
|
return $this->attachmentService->display($cardId, $attachmentId, $type);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
#[NoAdminRequired]
|
||||||
* @NoAdminRequired
|
public function create(int $cardId): Attachment {
|
||||||
*/
|
|
||||||
public function create($cardId) {
|
|
||||||
return $this->attachmentService->create(
|
return $this->attachmentService->create(
|
||||||
$cardId,
|
$cardId,
|
||||||
$this->request->getParam('type'),
|
$this->request->getParam('type'),
|
||||||
$this->request->getParam('data')
|
$this->request->getParam('data') ?? '',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
#[NoAdminRequired]
|
||||||
* @NoAdminRequired
|
public function update(int $cardId, string $attachmentId): Attachment {
|
||||||
*/
|
['type' => $type, 'attachmentId' => $attachmentId] = $this->extractTypeAndAttachmentId($attachmentId);
|
||||||
public function update($cardId, $attachmentId) {
|
return $this->attachmentService->update($cardId, $attachmentId, $this->request->getParam('data') ?? '', $type);
|
||||||
if (!str_contains($attachmentId, ':')) {
|
|
||||||
$type = 'deck_file';
|
|
||||||
} else {
|
|
||||||
[$type, $attachmentId] = explode(':', $attachmentId);
|
|
||||||
}
|
|
||||||
return $this->attachmentService->update($cardId, $attachmentId, $this->request->getParam('data'), $type);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
#[NoAdminRequired]
|
||||||
* @NoAdminRequired
|
public function delete(int $cardId, string $attachmentId): Attachment {
|
||||||
*/
|
['type' => $type, 'attachmentId' => $attachmentId] = $this->extractTypeAndAttachmentId($attachmentId);
|
||||||
public function delete($cardId, $attachmentId) {
|
|
||||||
if (!str_contains($attachmentId, ':')) {
|
|
||||||
$type = 'deck_file';
|
|
||||||
} else {
|
|
||||||
[$type, $attachmentId] = explode(':', $attachmentId);
|
|
||||||
}
|
|
||||||
return $this->attachmentService->delete($cardId, $attachmentId, $type);
|
return $this->attachmentService->delete($cardId, $attachmentId, $type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[NoAdminRequired]
|
||||||
|
public function restore(int $cardId, string $attachmentId): Attachment {
|
||||||
|
['type' => $type, 'attachmentId' => $attachmentId] = $this->extractTypeAndAttachmentId($attachmentId);
|
||||||
|
return $this->attachmentService->restore($cardId, $attachmentId, $type);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @NoAdminRequired
|
* @return array{type: string, attachmentId: int}
|
||||||
|
* @throws BadRequestException
|
||||||
*/
|
*/
|
||||||
public function restore($cardId, $attachmentId) {
|
private function extractTypeAndAttachmentId(string $attachmentId): array {
|
||||||
if (!str_contains($attachmentId, ':')) {
|
if (!str_contains($attachmentId, ':')) {
|
||||||
$type = 'deck_file';
|
$type = 'deck_file';
|
||||||
} else {
|
} else {
|
||||||
[$type, $attachmentId] = explode(':', $attachmentId);
|
[$type, $attachmentId] = [...explode(':', $attachmentId), '', ''];
|
||||||
}
|
}
|
||||||
return $this->attachmentService->restore($cardId, $attachmentId, $type);
|
|
||||||
|
if ($type === '' || !is_numeric($attachmentId)) {
|
||||||
|
throw new BadRequestException('Invalid attachment id');
|
||||||
|
}
|
||||||
|
|
||||||
|
return [
|
||||||
|
'type' => $type,
|
||||||
|
'attachmentId' => (int)$attachmentId,
|
||||||
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,10 +12,13 @@ use OCA\Deck\Service\BoardService;
|
|||||||
use OCA\Deck\StatusException;
|
use OCA\Deck\StatusException;
|
||||||
use OCP\AppFramework\ApiController;
|
use OCP\AppFramework\ApiController;
|
||||||
use OCP\AppFramework\Http;
|
use OCP\AppFramework\Http;
|
||||||
|
use OCP\AppFramework\Http\Attribute\CORS;
|
||||||
|
use OCP\AppFramework\Http\Attribute\NoAdminRequired;
|
||||||
|
use OCP\AppFramework\Http\Attribute\NoCSRFRequired;
|
||||||
use OCP\AppFramework\Http\DataResponse;
|
use OCP\AppFramework\Http\DataResponse;
|
||||||
|
|
||||||
use OCP\IRequest;
|
use OCP\IRequest;
|
||||||
use Sabre\HTTP\Util;
|
|
||||||
|
use function Sabre\HTTP\parseDate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class BoardApiController
|
* Class BoardApiController
|
||||||
@@ -36,21 +39,18 @@ class BoardApiController extends ApiController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @NoAdminRequired
|
* Return all the boards that the current user has access to.
|
||||||
* @CORS
|
|
||||||
* @NoCSRFRequired
|
|
||||||
*
|
|
||||||
* Return all of the boards that the current user has access to.
|
|
||||||
*
|
|
||||||
* @param bool $details
|
|
||||||
* @throws StatusException
|
* @throws StatusException
|
||||||
*/
|
*/
|
||||||
public function index(bool $details = false) {
|
#[NoAdminRequired]
|
||||||
|
#[NoCSRFRequired]
|
||||||
|
#[CORS]
|
||||||
|
public function index(bool $details = false): DataResponse {
|
||||||
$modified = $this->request->getHeader('If-Modified-Since');
|
$modified = $this->request->getHeader('If-Modified-Since');
|
||||||
if ($modified === null || $modified === '') {
|
if ($modified === '') {
|
||||||
$boards = $this->boardService->findAll(0, $details === true);
|
$boards = $this->boardService->findAll(0, $details === true);
|
||||||
} else {
|
} else {
|
||||||
$date = Util::parseHTTPDate($modified);
|
$date = parseDate($modified);
|
||||||
if (!$date) {
|
if (!$date) {
|
||||||
throw new StatusException('Invalid If-Modified-Since header provided.');
|
throw new StatusException('Invalid If-Modified-Since header provided.');
|
||||||
}
|
}
|
||||||
@@ -64,14 +64,12 @@ class BoardApiController extends ApiController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @NoAdminRequired
|
|
||||||
* @CORS
|
|
||||||
* @NoCSRFRequired
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* Return the board specified by $this->request->getParam('boardId').
|
* Return the board specified by $this->request->getParam('boardId').
|
||||||
*/
|
*/
|
||||||
public function get() {
|
#[NoAdminRequired]
|
||||||
|
#[NoCSRFRequired]
|
||||||
|
#[CORS]
|
||||||
|
public function get(): DataResponse {
|
||||||
$board = $this->boardService->find($this->request->getParam('boardId'));
|
$board = $this->boardService->find($this->request->getParam('boardId'));
|
||||||
$response = new DataResponse($board, HTTP::STATUS_OK);
|
$response = new DataResponse($board, HTTP::STATUS_OK);
|
||||||
$response->setETag($board->getEtag());
|
$response->setETag($board->getEtag());
|
||||||
@@ -79,68 +77,53 @@ class BoardApiController extends ApiController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @NoAdminRequired
|
|
||||||
* @CORS
|
|
||||||
* @NoCSRFRequired
|
|
||||||
*
|
|
||||||
* @params $title
|
|
||||||
* @params $color
|
|
||||||
*
|
|
||||||
* Create a board with the specified title and color.
|
* Create a board with the specified title and color.
|
||||||
*/
|
*/
|
||||||
public function create($title, $color) {
|
#[NoAdminRequired]
|
||||||
|
#[NoCSRFRequired]
|
||||||
|
#[CORS]
|
||||||
|
public function create(string $title, string $color): DataResponse {
|
||||||
$board = $this->boardService->create($title, $this->userId, $color);
|
$board = $this->boardService->create($title, $this->userId, $color);
|
||||||
return new DataResponse($board, HTTP::STATUS_OK);
|
return new DataResponse($board, HTTP::STATUS_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @NoAdminRequired
|
|
||||||
* @CORS
|
|
||||||
* @NoCSRFRequired
|
|
||||||
*
|
|
||||||
* @params $title
|
|
||||||
* @params $color
|
|
||||||
* @params $archived
|
|
||||||
*
|
|
||||||
* Update a board with the specified boardId, title and color, and archived state.
|
* Update a board with the specified boardId, title and color, and archived state.
|
||||||
*/
|
*/
|
||||||
public function update($title, $color, $archived = false) {
|
#[NoAdminRequired]
|
||||||
|
#[NoCSRFRequired]
|
||||||
|
#[CORS]
|
||||||
|
public function update(string $title, string $color, bool $archived = false): DataResponse {
|
||||||
$board = $this->boardService->update($this->request->getParam('boardId'), $title, $color, $archived);
|
$board = $this->boardService->update($this->request->getParam('boardId'), $title, $color, $archived);
|
||||||
return new DataResponse($board, HTTP::STATUS_OK);
|
return new DataResponse($board, HTTP::STATUS_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @NoAdminRequired
|
|
||||||
* @CORS
|
|
||||||
* @NoCSRFRequired
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* Delete the board specified by $boardId. Return the board that was deleted.
|
* Delete the board specified by $boardId. Return the board that was deleted.
|
||||||
*/
|
*/
|
||||||
public function delete() {
|
#[NoAdminRequired]
|
||||||
|
#[NoCSRFRequired]
|
||||||
|
#[CORS]
|
||||||
|
public function delete(): DataResponse {
|
||||||
$board = $this->boardService->delete($this->request->getParam('boardId'));
|
$board = $this->boardService->delete($this->request->getParam('boardId'));
|
||||||
return new DataResponse($board, HTTP::STATUS_OK);
|
return new DataResponse($board, HTTP::STATUS_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @NoAdminRequired
|
|
||||||
* @CORS
|
|
||||||
* @NoCSRFRequired
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* Undo the deletion of the board specified by $boardId.
|
* Undo the deletion of the board specified by $boardId.
|
||||||
*/
|
*/
|
||||||
public function undoDelete() {
|
#[NoAdminRequired]
|
||||||
|
#[NoCSRFRequired]
|
||||||
|
#[CORS]
|
||||||
|
public function undoDelete(): DataResponse {
|
||||||
$board = $this->boardService->deleteUndo($this->request->getParam('boardId'));
|
$board = $this->boardService->deleteUndo($this->request->getParam('boardId'));
|
||||||
return new DataResponse($board, HTTP::STATUS_OK);
|
return new DataResponse($board, HTTP::STATUS_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
#[NoAdminRequired]
|
||||||
* @NoAdminRequired
|
#[NoCSRFRequired]
|
||||||
* @CORS
|
#[CORS]
|
||||||
* @NoCSRFRequired
|
public function addAcl(int $boardId, $type, $participant, $permissionEdit, $permissionShare, $permissionManage) {
|
||||||
*/
|
|
||||||
public function addAcl($boardId, $type, $participant, $permissionEdit, $permissionShare, $permissionManage) {
|
|
||||||
$acl = $this->boardService->addAcl($boardId, $type, $participant, $permissionEdit, $permissionShare, $permissionManage);
|
$acl = $this->boardService->addAcl($boardId, $type, $participant, $permissionEdit, $permissionShare, $permissionManage);
|
||||||
return new DataResponse($acl, HTTP::STATUS_OK);
|
return new DataResponse($acl, HTTP::STATUS_OK);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ use OCA\Deck\Service\Importer\BoardImportService;
|
|||||||
use OCA\Deck\Service\PermissionService;
|
use OCA\Deck\Service\PermissionService;
|
||||||
use OCP\AppFramework\ApiController;
|
use OCP\AppFramework\ApiController;
|
||||||
use OCP\AppFramework\Http;
|
use OCP\AppFramework\Http;
|
||||||
|
use OCP\AppFramework\Http\Attribute\NoAdminRequired;
|
||||||
use OCP\AppFramework\Http\DataResponse;
|
use OCP\AppFramework\Http\DataResponse;
|
||||||
use OCP\IL10N;
|
use OCP\IL10N;
|
||||||
use OCP\IRequest;
|
use OCP\IRequest;
|
||||||
@@ -31,68 +32,38 @@ class BoardController extends ApiController {
|
|||||||
parent::__construct($appName, $request);
|
parent::__construct($appName, $request);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
#[NoAdminRequired]
|
||||||
* @NoAdminRequired
|
|
||||||
*/
|
|
||||||
public function index() {
|
public function index() {
|
||||||
return $this->boardService->findAll();
|
return $this->boardService->findAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
#[NoAdminRequired]
|
||||||
* @NoAdminRequired
|
public function read(int $boardId): Board {
|
||||||
* @param $boardId
|
|
||||||
* @return \OCP\AppFramework\Db\Entity
|
|
||||||
*/
|
|
||||||
public function read(int $boardId) {
|
|
||||||
return $this->boardService->find($boardId);
|
return $this->boardService->find($boardId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
#[NoAdminRequired]
|
||||||
* @NoAdminRequired
|
public function create(string $title, string $color): Board {
|
||||||
* @param $title
|
|
||||||
* @param $color
|
|
||||||
* @return \OCP\AppFramework\Db\Entity
|
|
||||||
*/
|
|
||||||
public function create($title, $color) {
|
|
||||||
return $this->boardService->create($title, $this->userId, $color);
|
return $this->boardService->create($title, $this->userId, $color);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
#[NoAdminRequired]
|
||||||
* @NoAdminRequired
|
public function update(int $id, string $title, string $color, bool $archived): Board {
|
||||||
* @param $id
|
|
||||||
* @param $title
|
|
||||||
* @param $color
|
|
||||||
* @param $archived
|
|
||||||
* @return \OCP\AppFramework\Db\Entity
|
|
||||||
*/
|
|
||||||
public function update($id, $title, $color, $archived) {
|
|
||||||
return $this->boardService->update($id, $title, $color, $archived);
|
return $this->boardService->update($id, $title, $color, $archived);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
#[NoAdminRequired]
|
||||||
* @NoAdminRequired
|
public function delete(int $boardId): Board {
|
||||||
* @param $boardId
|
|
||||||
* @return \OCP\AppFramework\Db\Entity
|
|
||||||
*/
|
|
||||||
public function delete($boardId) {
|
|
||||||
return $this->boardService->delete($boardId);
|
return $this->boardService->delete($boardId);
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* @NoAdminRequired
|
#[NoAdminRequired]
|
||||||
* @param $boardId
|
public function deleteUndo(int $boardId): Board {
|
||||||
* @return \OCP\AppFramework\Db\Entity
|
|
||||||
*/
|
|
||||||
public function deleteUndo($boardId) {
|
|
||||||
return $this->boardService->deleteUndo($boardId);
|
return $this->boardService->deleteUndo($boardId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
#[NoAdminRequired]
|
||||||
* @NoAdminRequired
|
public function getUserPermissions(int $boardId): array {
|
||||||
* @param $boardId
|
|
||||||
* @return array|bool
|
|
||||||
* @internal param $userId
|
|
||||||
*/
|
|
||||||
public function getUserPermissions($boardId) {
|
|
||||||
$permissions = $this->permissionService->getPermissions($boardId);
|
$permissions = $this->permissionService->getPermissions($boardId);
|
||||||
return [
|
return [
|
||||||
'PERMISSION_READ' => $permissions[Acl::PERMISSION_READ],
|
'PERMISSION_READ' => $permissions[Acl::PERMISSION_READ],
|
||||||
@@ -103,16 +74,10 @@ class BoardController extends ApiController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @NoAdminRequired
|
|
||||||
* @param $boardId
|
|
||||||
* @param $type
|
|
||||||
* @param $participant
|
* @param $participant
|
||||||
* @param $permissionEdit
|
|
||||||
* @param $permissionShare
|
|
||||||
* @param $permissionManage
|
|
||||||
* @return \OCP\AppFramework\Db\Entity
|
|
||||||
*/
|
*/
|
||||||
public function addAcl($boardId, $type, $participant, $permissionEdit, $permissionShare, $permissionManage) {
|
#[NoAdminRequired]
|
||||||
|
public function addAcl(int $boardId, int $type, $participant, bool $permissionEdit, bool $permissionShare, bool $permissionManage): Acl {
|
||||||
return $this->boardService->addAcl($boardId, $type, $participant, $permissionEdit, $permissionShare, $permissionManage);
|
return $this->boardService->addAcl($boardId, $type, $participant, $permissionEdit, $permissionShare, $permissionManage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,9 @@ namespace OCA\Deck\Controller;
|
|||||||
|
|
||||||
use OCA\Deck\Service\Importer\BoardImportService;
|
use OCA\Deck\Service\Importer\BoardImportService;
|
||||||
use OCP\AppFramework\Http;
|
use OCP\AppFramework\Http;
|
||||||
|
use OCP\AppFramework\Http\Attribute\CORS;
|
||||||
|
use OCP\AppFramework\Http\Attribute\NoAdminRequired;
|
||||||
|
use OCP\AppFramework\Http\Attribute\NoCSRFRequired;
|
||||||
use OCP\AppFramework\Http\DataResponse;
|
use OCP\AppFramework\Http\DataResponse;
|
||||||
use OCP\AppFramework\OCSController;
|
use OCP\AppFramework\OCSController;
|
||||||
use OCP\IRequest;
|
use OCP\IRequest;
|
||||||
@@ -23,11 +26,9 @@ class BoardImportApiController extends OCSController {
|
|||||||
parent::__construct($appName, $request);
|
parent::__construct($appName, $request);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
#[NoAdminRequired]
|
||||||
* @NoAdminRequired
|
#[CORS]
|
||||||
* @CORS
|
#[NoCSRFRequired]
|
||||||
* @NoCSRFRequired
|
|
||||||
*/
|
|
||||||
public function import(string $system, array $config, array $data): DataResponse {
|
public function import(string $system, array $config, array $data): DataResponse {
|
||||||
$this->boardImportService->setSystem($system);
|
$this->boardImportService->setSystem($system);
|
||||||
$config = json_decode(json_encode($config));
|
$config = json_decode(json_encode($config));
|
||||||
@@ -38,21 +39,17 @@ class BoardImportApiController extends OCSController {
|
|||||||
return new DataResponse($this->boardImportService->getBoard(), Http::STATUS_OK);
|
return new DataResponse($this->boardImportService->getBoard(), Http::STATUS_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
#[NoAdminRequired]
|
||||||
* @NoAdminRequired
|
#[CORS]
|
||||||
* @CORS
|
#[NoCSRFRequired]
|
||||||
* @NoCSRFRequired
|
|
||||||
*/
|
|
||||||
public function getAllowedSystems(): DataResponse {
|
public function getAllowedSystems(): DataResponse {
|
||||||
$allowedSystems = $this->boardImportService->getAllowedImportSystems();
|
$allowedSystems = $this->boardImportService->getAllowedImportSystems();
|
||||||
return new DataResponse($allowedSystems, Http::STATUS_OK);
|
return new DataResponse($allowedSystems, Http::STATUS_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
#[NoAdminRequired]
|
||||||
* @NoAdminRequired
|
#[CORS]
|
||||||
* @CORS
|
#[NoCSRFRequired]
|
||||||
* @NoCSRFRequired
|
|
||||||
*/
|
|
||||||
public function getConfigSchema(string $name): DataResponse {
|
public function getConfigSchema(string $name): DataResponse {
|
||||||
$this->boardImportService->setSystem($name);
|
$this->boardImportService->setSystem($name);
|
||||||
$this->boardImportService->validateSystem();
|
$this->boardImportService->validateSystem();
|
||||||
|
|||||||
@@ -12,6 +12,9 @@ use OCA\Deck\Service\AssignmentService;
|
|||||||
use OCA\Deck\Service\CardService;
|
use OCA\Deck\Service\CardService;
|
||||||
use OCP\AppFramework\ApiController;
|
use OCP\AppFramework\ApiController;
|
||||||
use OCP\AppFramework\Http;
|
use OCP\AppFramework\Http;
|
||||||
|
use OCP\AppFramework\Http\Attribute\CORS;
|
||||||
|
use OCP\AppFramework\Http\Attribute\NoAdminRequired;
|
||||||
|
use OCP\AppFramework\Http\Attribute\NoCSRFRequired;
|
||||||
use OCP\AppFramework\Http\DataResponse;
|
use OCP\AppFramework\Http\DataResponse;
|
||||||
use OCP\IRequest;
|
use OCP\IRequest;
|
||||||
|
|
||||||
@@ -27,7 +30,7 @@ class CardApiController extends ApiController {
|
|||||||
* @param IRequest $request
|
* @param IRequest $request
|
||||||
* @param CardService $cardService
|
* @param CardService $cardService
|
||||||
* @param AssignmentService $assignmentService
|
* @param AssignmentService $assignmentService
|
||||||
* @param $userId
|
* @param string $userId
|
||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
string $appName,
|
string $appName,
|
||||||
@@ -80,112 +83,102 @@ class CardApiController extends ApiController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @NoAdminRequired
|
|
||||||
* @CORS
|
|
||||||
* @NoCSRFRequired
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* Update a card
|
* Update a card
|
||||||
*/
|
*/
|
||||||
public function update($title, $type, $owner, $description = '', $order = 0, $duedate = null, $archived = null) {
|
#[NoAdminRequired]
|
||||||
|
#[CORS]
|
||||||
|
#[NoCSRFRequired]
|
||||||
|
public function update(string $title, $type, string $owner, string $description = '', int $order = 0, $duedate = null, $archived = null): DataResponse {
|
||||||
$done = array_key_exists('done', $this->request->getParams()) ? new OptionalNullableValue($this->request->getParam('done', null)) : null;
|
$done = array_key_exists('done', $this->request->getParams()) ? new OptionalNullableValue($this->request->getParam('done', null)) : null;
|
||||||
$card = $this->cardService->update($this->request->getParam('cardId'), $title, $this->request->getParam('stackId'), $type, $owner, $description, $order, $duedate, 0, $archived, $done);
|
$card = $this->cardService->update($this->request->getParam('cardId'), $title, $this->request->getParam('stackId'), $type, $owner, $description, $order, $duedate, 0, $archived, $done);
|
||||||
return new DataResponse($card, HTTP::STATUS_OK);
|
return new DataResponse($card, HTTP::STATUS_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @NoAdminRequired
|
|
||||||
* @CORS
|
|
||||||
* @NoCSRFRequired
|
|
||||||
*
|
|
||||||
* Delete a specific card.
|
* Delete a specific card.
|
||||||
*/
|
*/
|
||||||
public function delete() {
|
#[NoAdminRequired]
|
||||||
|
#[CORS]
|
||||||
|
#[NoCSRFRequired]
|
||||||
|
public function delete(): DataResponse {
|
||||||
$card = $this->cardService->delete($this->request->getParam('cardId'));
|
$card = $this->cardService->delete($this->request->getParam('cardId'));
|
||||||
return new DataResponse($card, HTTP::STATUS_OK);
|
return new DataResponse($card, HTTP::STATUS_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @NoAdminRequired
|
|
||||||
* @CORS
|
|
||||||
* @NoCSRFRequired
|
|
||||||
*
|
|
||||||
* Assign a label to a card.
|
* Assign a label to a card.
|
||||||
*/
|
*/
|
||||||
public function assignLabel($labelId) {
|
#[NoAdminRequired]
|
||||||
|
#[CORS]
|
||||||
|
#[NoCSRFRequired]
|
||||||
|
public function assignLabel(int $labelId): DataResponse {
|
||||||
$card = $this->cardService->assignLabel($this->request->getParam('cardId'), $labelId);
|
$card = $this->cardService->assignLabel($this->request->getParam('cardId'), $labelId);
|
||||||
return new DataResponse($card, HTTP::STATUS_OK);
|
return new DataResponse($card, HTTP::STATUS_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @NoAdminRequired
|
|
||||||
* @CORS
|
|
||||||
* @NoCSRFRequired
|
|
||||||
*
|
|
||||||
* Assign a label to a card.
|
* Assign a label to a card.
|
||||||
*/
|
*/
|
||||||
public function removeLabel($labelId) {
|
#[NoAdminRequired]
|
||||||
|
#[CORS]
|
||||||
|
#[NoCSRFRequired]
|
||||||
|
public function removeLabel(int $labelId): DataResponse {
|
||||||
$card = $this->cardService->removeLabel($this->request->getParam('cardId'), $labelId);
|
$card = $this->cardService->removeLabel($this->request->getParam('cardId'), $labelId);
|
||||||
return new DataResponse($card, HTTP::STATUS_OK);
|
return new DataResponse($card, HTTP::STATUS_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @NoAdminRequired
|
|
||||||
* @CORS
|
|
||||||
* @NoCSRFRequired
|
|
||||||
*
|
|
||||||
* Assign a user to a card
|
* Assign a user to a card
|
||||||
*/
|
*/
|
||||||
public function assignUser($cardId, $userId, $type = 0) {
|
#[NoAdminRequired]
|
||||||
|
#[CORS]
|
||||||
|
#[NoCSRFRequired]
|
||||||
|
public function assignUser(int $cardId, string $userId, int $type = 0): DataResponse {
|
||||||
$card = $this->assignmentService->assignUser($cardId, $userId, $type);
|
$card = $this->assignmentService->assignUser($cardId, $userId, $type);
|
||||||
return new DataResponse($card, HTTP::STATUS_OK);
|
return new DataResponse($card, HTTP::STATUS_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @NoAdminRequired
|
|
||||||
* @CORS
|
|
||||||
* @NoCSRFRequired
|
|
||||||
*
|
|
||||||
* Unassign a user from a card
|
* Unassign a user from a card
|
||||||
*/
|
*/
|
||||||
public function unassignUser($cardId, $userId, $type = 0) {
|
#[NoAdminRequired]
|
||||||
|
#[CORS]
|
||||||
|
#[NoCSRFRequired]
|
||||||
|
public function unassignUser(int $cardId, string $userId, int $type = 0): DataResponse {
|
||||||
$card = $this->assignmentService->unassignUser($cardId, $userId, $type);
|
$card = $this->assignmentService->unassignUser($cardId, $userId, $type);
|
||||||
return new DataResponse($card, HTTP::STATUS_OK);
|
return new DataResponse($card, HTTP::STATUS_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @NoAdminRequired
|
|
||||||
* @CORS
|
|
||||||
* @NoCSRFRequired
|
|
||||||
*
|
|
||||||
* Archive card
|
* Archive card
|
||||||
*/
|
*/
|
||||||
public function archive($cardId) {
|
#[NoAdminRequired]
|
||||||
|
#[CORS]
|
||||||
|
#[NoCSRFRequired]
|
||||||
|
public function archive(int $cardId): DataResponse {
|
||||||
$card = $this->cardService->archive($cardId);
|
$card = $this->cardService->archive($cardId);
|
||||||
return new DataResponse($card, HTTP::STATUS_OK);
|
return new DataResponse($card, HTTP::STATUS_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @NoAdminRequired
|
|
||||||
* @CORS
|
|
||||||
* @NoCSRFRequired
|
|
||||||
*
|
|
||||||
* Unarchive card
|
* Unarchive card
|
||||||
*/
|
*/
|
||||||
public function unarchive($cardId) {
|
#[NoAdminRequired]
|
||||||
|
#[CORS]
|
||||||
|
#[NoCSRFRequired]
|
||||||
|
public function unarchive(int $cardId): DataResponse {
|
||||||
$card = $this->cardService->unarchive($cardId);
|
$card = $this->cardService->unarchive($cardId);
|
||||||
return new DataResponse($card, HTTP::STATUS_OK);
|
return new DataResponse($card, HTTP::STATUS_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @NoAdminRequired
|
|
||||||
* @CORS
|
|
||||||
* @NoCSRFRequired
|
|
||||||
*
|
|
||||||
* Reorder cards
|
* Reorder cards
|
||||||
*/
|
*/
|
||||||
public function reorder($stackId, $order) {
|
#[NoAdminRequired]
|
||||||
$card = $this->cardService->reorder((int)$this->request->getParam('cardId'), (int)$stackId, (int)$order);
|
#[CORS]
|
||||||
|
#[NoCSRFRequired]
|
||||||
|
public function reorder(int $stackId, int $order): DataResponse {
|
||||||
|
$card = $this->cardService->reorder((int)$this->request->getParam('cardId'), $stackId, $order);
|
||||||
return new DataResponse($card, HTTP::STATUS_OK);
|
return new DataResponse($card, HTTP::STATUS_OK);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,9 +7,12 @@
|
|||||||
|
|
||||||
namespace OCA\Deck\Controller;
|
namespace OCA\Deck\Controller;
|
||||||
|
|
||||||
|
use OCA\Deck\Db\Assignment;
|
||||||
|
use OCA\Deck\Db\Card;
|
||||||
use OCA\Deck\Service\AssignmentService;
|
use OCA\Deck\Service\AssignmentService;
|
||||||
use OCA\Deck\Service\CardService;
|
use OCA\Deck\Service\CardService;
|
||||||
use OCP\AppFramework\Controller;
|
use OCP\AppFramework\Controller;
|
||||||
|
use OCP\AppFramework\Http\Attribute\NoAdminRequired;
|
||||||
use OCP\IRequest;
|
use OCP\IRequest;
|
||||||
|
|
||||||
class CardController extends Controller {
|
class CardController extends Controller {
|
||||||
@@ -23,45 +26,26 @@ class CardController extends Controller {
|
|||||||
parent::__construct($appName, $request);
|
parent::__construct($appName, $request);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
#[NoAdminRequired]
|
||||||
* @NoAdminRequired
|
public function read(int $cardId): Card {
|
||||||
* @param $cardId
|
|
||||||
* @return \OCP\AppFramework\Db\Entity
|
|
||||||
*/
|
|
||||||
public function read($cardId) {
|
|
||||||
return $this->cardService->find($cardId);
|
return $this->cardService->find($cardId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @NoAdminRequired
|
* @return Card[]
|
||||||
* @param $cardId
|
|
||||||
* @param $stackId
|
|
||||||
* @param $order
|
|
||||||
* @return array
|
|
||||||
*/
|
*/
|
||||||
public function reorder($cardId, $stackId, $order) {
|
#[NoAdminRequired]
|
||||||
return $this->cardService->reorder((int)$cardId, (int)$stackId, (int)$order);
|
public function reorder(int $cardId, int $stackId, int $order): array {
|
||||||
|
return $this->cardService->reorder($cardId, $stackId, $order);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
#[NoAdminRequired]
|
||||||
* @NoAdminRequired
|
public function rename(int $cardId, string $title): Card {
|
||||||
* @param $cardId
|
|
||||||
* @param $title
|
|
||||||
* @return \OCP\AppFramework\Db\Entity
|
|
||||||
*/
|
|
||||||
public function rename($cardId, $title) {
|
|
||||||
return $this->cardService->rename($cardId, $title);
|
return $this->cardService->rename($cardId, $title);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
#[NoAdminRequired]
|
||||||
* @NoAdminRequired
|
public function create(string $title, int $stackId, string $type = 'plain', int $order = 999, string $description = '', $duedate = null, array $labels = [], array $users = []): Card {
|
||||||
* @param $title
|
|
||||||
* @param $stackId
|
|
||||||
* @param $type
|
|
||||||
* @param int $order
|
|
||||||
* @return \OCP\AppFramework\Db\Entity
|
|
||||||
*/
|
|
||||||
public function create($title, $stackId, $type = 'plain', $order = 999, string $description = '', $duedate = null, $labels = [], $users = []) {
|
|
||||||
$card = $this->cardService->create($title, $stackId, $type, $order, $this->userId, $description, $duedate);
|
$card = $this->cardService->create($title, $stackId, $type, $order, $this->userId, $description, $duedate);
|
||||||
|
|
||||||
foreach ($labels as $label) {
|
foreach ($labels as $label) {
|
||||||
@@ -76,113 +60,68 @@ class CardController extends Controller {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @NoAdminRequired
|
|
||||||
* @param $id
|
|
||||||
* @param $title
|
|
||||||
* @param $stackId
|
|
||||||
* @param $type
|
|
||||||
* @param $order
|
|
||||||
* @param $description
|
|
||||||
* @param $duedate
|
* @param $duedate
|
||||||
* @param $deletedAt
|
|
||||||
* @return \OCP\AppFramework\Db\Entity
|
|
||||||
*/
|
*/
|
||||||
public function update($id, $title, $stackId, $type, $order, $description, $duedate, $deletedAt) {
|
#[NoAdminRequired]
|
||||||
|
public function update(int $id, string $title, int $stackId, string $type, int $order, string $description, $duedate, $deletedAt): Card {
|
||||||
return $this->cardService->update($id, $title, $stackId, $type, $this->userId, $description, $order, $duedate, $deletedAt);
|
return $this->cardService->update($id, $title, $stackId, $type, $this->userId, $description, $order, $duedate, $deletedAt);
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* @NoAdminRequired
|
#[NoAdminRequired]
|
||||||
* @param $cardId
|
public function clone(int $cardId, ?int $targetStackId = null): Card {
|
||||||
* @param $targetStackId
|
|
||||||
* @return \OCP\AppFramework\Db\Entity
|
|
||||||
*/
|
|
||||||
public function clone(int $cardId, ?int $targetStackId = null) {
|
|
||||||
return $this->cardService->cloneCard($cardId, $targetStackId);
|
return $this->cardService->cloneCard($cardId, $targetStackId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
#[NoAdminRequired]
|
||||||
* @NoAdminRequired
|
public function delete(int $cardId): Card {
|
||||||
* @param $cardId
|
|
||||||
* @return \OCP\AppFramework\Db\Entity
|
|
||||||
*/
|
|
||||||
public function delete($cardId) {
|
|
||||||
return $this->cardService->delete($cardId);
|
return $this->cardService->delete($cardId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @NoAdminRequired
|
* @return Card[]
|
||||||
* @param $boardId
|
|
||||||
* @return \OCP\AppFramework\Db\Entity
|
|
||||||
*/
|
*/
|
||||||
public function deleted($boardId) {
|
#[NoAdminRequired]
|
||||||
|
public function deleted(int $boardId): array {
|
||||||
return $this->cardService->fetchDeleted($boardId);
|
return $this->cardService->fetchDeleted($boardId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
#[NoAdminRequired]
|
||||||
* @NoAdminRequired
|
|
||||||
* @param $cardId
|
|
||||||
* @return \OCP\AppFramework\Db\Entity
|
|
||||||
*/
|
|
||||||
public function archive($cardId) {
|
public function archive($cardId) {
|
||||||
return $this->cardService->archive($cardId);
|
return $this->cardService->archive($cardId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
#[NoAdminRequired]
|
||||||
* @NoAdminRequired
|
public function unarchive(int $cardId): Card {
|
||||||
* @param $cardId
|
|
||||||
* @return \OCP\AppFramework\Db\Entity
|
|
||||||
*/
|
|
||||||
public function unarchive($cardId) {
|
|
||||||
return $this->cardService->unarchive($cardId);
|
return $this->cardService->unarchive($cardId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
#[NoAdminRequired]
|
||||||
* @NoAdminRequired
|
public function done(int $cardId): Card {
|
||||||
* @param $cardId
|
|
||||||
* @return \OCP\AppFramework\Db\Entity
|
|
||||||
*/
|
|
||||||
public function done(int $cardId) {
|
|
||||||
return $this->cardService->done($cardId);
|
return $this->cardService->done($cardId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
#[NoAdminRequired]
|
||||||
* @NoAdminRequired
|
public function undone(int $cardId): Card {
|
||||||
* @param $cardId
|
|
||||||
* @return \OCP\AppFramework\Db\Entity
|
|
||||||
*/
|
|
||||||
public function undone(int $cardId) {
|
|
||||||
return $this->cardService->undone($cardId);
|
return $this->cardService->undone($cardId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
#[NoAdminRequired]
|
||||||
* @NoAdminRequired
|
public function assignLabel(int $cardId, int $labelId): void {
|
||||||
* @param $cardId
|
|
||||||
* @param $labelId
|
|
||||||
*/
|
|
||||||
public function assignLabel($cardId, $labelId) {
|
|
||||||
$this->cardService->assignLabel($cardId, $labelId);
|
$this->cardService->assignLabel($cardId, $labelId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
#[NoAdminRequired]
|
||||||
* @NoAdminRequired
|
public function removeLabel(int $cardId, int $labelId): void {
|
||||||
* @param $cardId
|
|
||||||
* @param $labelId
|
|
||||||
*/
|
|
||||||
public function removeLabel($cardId, $labelId) {
|
|
||||||
$this->cardService->removeLabel($cardId, $labelId);
|
$this->cardService->removeLabel($cardId, $labelId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
#[NoAdminRequired]
|
||||||
* @NoAdminRequired
|
public function assignUser(int $cardId, string $userId, int $type = 0): Assignment {
|
||||||
*/
|
|
||||||
public function assignUser($cardId, $userId, $type = 0) {
|
|
||||||
return $this->assignmentService->assignUser($cardId, $userId, $type);
|
return $this->assignmentService->assignUser($cardId, $userId, $type);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
#[NoAdminRequired]
|
||||||
* @NoAdminRequired
|
public function unassignUser(int $cardId, string $userId, int $type = 0): Assignment {
|
||||||
*/
|
|
||||||
public function unassignUser($cardId, $userId, $type = 0) {
|
|
||||||
return $this->assignmentService->unassignUser($cardId, $userId, $type);
|
return $this->assignmentService->unassignUser($cardId, $userId, $type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,11 +9,15 @@ namespace OCA\Deck\Controller;
|
|||||||
|
|
||||||
use OCA\Deck\Service\CommentService;
|
use OCA\Deck\Service\CommentService;
|
||||||
use OCA\Deck\StatusException;
|
use OCA\Deck\StatusException;
|
||||||
|
use OCP\AppFramework\Http\Attribute\NoAdminRequired;
|
||||||
use OCP\AppFramework\Http\DataResponse;
|
use OCP\AppFramework\Http\DataResponse;
|
||||||
|
|
||||||
use OCP\AppFramework\OCSController;
|
use OCP\AppFramework\OCSController;
|
||||||
use OCP\IRequest;
|
use OCP\IRequest;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @psalm-api
|
||||||
|
*/
|
||||||
class CommentsApiController extends OCSController {
|
class CommentsApiController extends OCSController {
|
||||||
public function __construct(
|
public function __construct(
|
||||||
string $appName,
|
string $appName,
|
||||||
@@ -27,33 +31,33 @@ class CommentsApiController extends OCSController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @NoAdminRequired
|
|
||||||
* @throws StatusException
|
* @throws StatusException
|
||||||
*/
|
*/
|
||||||
public function list(string $cardId, int $limit = 20, int $offset = 0): DataResponse {
|
#[NoAdminRequired]
|
||||||
|
public function list(int $cardId, int $limit = 20, int $offset = 0): DataResponse {
|
||||||
return $this->commentService->list($cardId, $limit, $offset);
|
return $this->commentService->list($cardId, $limit, $offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @NoAdminRequired
|
|
||||||
* @throws StatusException
|
* @throws StatusException
|
||||||
*/
|
*/
|
||||||
|
#[NoAdminRequired]
|
||||||
public function create(int $cardId, string $message, int $parentId = 0): DataResponse {
|
public function create(int $cardId, string $message, int $parentId = 0): DataResponse {
|
||||||
return $this->commentService->create($cardId, $message, $parentId);
|
return $this->commentService->create($cardId, $message, $parentId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @NoAdminRequired
|
|
||||||
* @throws StatusException
|
* @throws StatusException
|
||||||
*/
|
*/
|
||||||
|
#[NoAdminRequired]
|
||||||
public function update(int $cardId, int $commentId, string $message): DataResponse {
|
public function update(int $cardId, int $commentId, string $message): DataResponse {
|
||||||
return $this->commentService->update($cardId, $commentId, $message);
|
return $this->commentService->update($cardId, $commentId, $message);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @NoAdminRequired
|
|
||||||
* @throws StatusException
|
* @throws StatusException
|
||||||
*/
|
*/
|
||||||
|
#[NoAdminRequired]
|
||||||
public function delete(int $cardId, int $commentId): DataResponse {
|
public function delete(int $cardId, int $commentId): DataResponse {
|
||||||
return $this->commentService->delete($cardId, $commentId);
|
return $this->commentService->delete($cardId, $commentId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,8 @@
|
|||||||
namespace OCA\Deck\Controller;
|
namespace OCA\Deck\Controller;
|
||||||
|
|
||||||
use OCA\Deck\Service\ConfigService;
|
use OCA\Deck\Service\ConfigService;
|
||||||
|
use OCP\AppFramework\Http\Attribute\NoAdminRequired;
|
||||||
|
use OCP\AppFramework\Http\Attribute\NoCSRFRequired;
|
||||||
use OCP\AppFramework\Http\DataResponse;
|
use OCP\AppFramework\Http\DataResponse;
|
||||||
use OCP\AppFramework\Http\NotFoundResponse;
|
use OCP\AppFramework\Http\NotFoundResponse;
|
||||||
use OCP\AppFramework\OCSController;
|
use OCP\AppFramework\OCSController;
|
||||||
@@ -22,19 +24,15 @@ class ConfigController extends OCSController {
|
|||||||
parent::__construct($AppName, $request);
|
parent::__construct($AppName, $request);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
#[NoAdminRequired]
|
||||||
* @NoCSRFRequired
|
#[NoCSRFRequired]
|
||||||
* @NoAdminRequired
|
|
||||||
*/
|
|
||||||
public function get(): DataResponse {
|
public function get(): DataResponse {
|
||||||
return new DataResponse($this->configService->getAll());
|
return new DataResponse($this->configService->getAll());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
#[NoAdminRequired]
|
||||||
* @NoCSRFRequired
|
#[NoCSRFRequired]
|
||||||
* @NoAdminRequired
|
public function setValue(string $key, mixed $value): DataResponse|NotFoundResponse {
|
||||||
*/
|
|
||||||
public function setValue(string $key, $value) {
|
|
||||||
$result = $this->configService->set($key, $value);
|
$result = $this->configService->set($key, $value);
|
||||||
if ($result === null) {
|
if ($result === null) {
|
||||||
return new NotFoundResponse();
|
return new NotFoundResponse();
|
||||||
|
|||||||
@@ -10,6 +10,9 @@ namespace OCA\Deck\Controller;
|
|||||||
use OCA\Deck\Service\LabelService;
|
use OCA\Deck\Service\LabelService;
|
||||||
use OCP\AppFramework\ApiController;
|
use OCP\AppFramework\ApiController;
|
||||||
use OCP\AppFramework\Http;
|
use OCP\AppFramework\Http;
|
||||||
|
use OCP\AppFramework\Http\Attribute\CORS;
|
||||||
|
use OCP\AppFramework\Http\Attribute\NoAdminRequired;
|
||||||
|
use OCP\AppFramework\Http\Attribute\NoCSRFRequired;
|
||||||
use OCP\AppFramework\Http\DataResponse;
|
use OCP\AppFramework\Http\DataResponse;
|
||||||
use OCP\IRequest;
|
use OCP\IRequest;
|
||||||
|
|
||||||
@@ -26,59 +29,50 @@ class LabelApiController extends ApiController {
|
|||||||
$appName,
|
$appName,
|
||||||
IRequest $request,
|
IRequest $request,
|
||||||
private LabelService $labelService,
|
private LabelService $labelService,
|
||||||
private $userId,
|
|
||||||
) {
|
) {
|
||||||
parent::__construct($appName, $request);
|
parent::__construct($appName, $request);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @NoAdminRequired
|
|
||||||
* @CORS
|
|
||||||
* @NoCSRFRequired
|
|
||||||
*
|
|
||||||
* Get a specific label.
|
* Get a specific label.
|
||||||
*/
|
*/
|
||||||
public function get() {
|
#[NoAdminRequired]
|
||||||
|
#[NoCSRFRequired]
|
||||||
|
#[CORS]
|
||||||
|
public function get(): DataResponse {
|
||||||
$label = $this->labelService->find($this->request->getParam('labelId'));
|
$label = $this->labelService->find($this->request->getParam('labelId'));
|
||||||
return new DataResponse($label, HTTP::STATUS_OK);
|
return new DataResponse($label, HTTP::STATUS_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @NoAdminRequired
|
|
||||||
* @CORS
|
|
||||||
* @NoCSRFRequired
|
|
||||||
*
|
|
||||||
* @params $title
|
|
||||||
* @params $color
|
|
||||||
* Create a new label
|
* Create a new label
|
||||||
*/
|
*/
|
||||||
public function create($title, $color) {
|
#[NoAdminRequired]
|
||||||
|
#[NoCSRFRequired]
|
||||||
|
#[CORS]
|
||||||
|
public function create(string $title, string $color): DataResponse {
|
||||||
$label = $this->labelService->create($title, $color, $this->request->getParam('boardId'));
|
$label = $this->labelService->create($title, $color, $this->request->getParam('boardId'));
|
||||||
return new DataResponse($label, HTTP::STATUS_OK);
|
return new DataResponse($label, HTTP::STATUS_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @NoAdminRequired
|
|
||||||
* @CORS
|
|
||||||
* @NoCSRFRequired
|
|
||||||
*
|
|
||||||
* @params $title
|
|
||||||
* @params $color
|
|
||||||
* Update a specific label
|
* Update a specific label
|
||||||
*/
|
*/
|
||||||
public function update($title, $color) {
|
#[NoAdminRequired]
|
||||||
|
#[NoCSRFRequired]
|
||||||
|
#[CORS]
|
||||||
|
public function update(string $title, string $color): DataResponse {
|
||||||
$label = $this->labelService->update($this->request->getParam('labelId'), $title, $color);
|
$label = $this->labelService->update($this->request->getParam('labelId'), $title, $color);
|
||||||
return new DataResponse($label, HTTP::STATUS_OK);
|
return new DataResponse($label, HTTP::STATUS_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @NoAdminRequired
|
|
||||||
* @CORS
|
|
||||||
* @NoCSRFRequired
|
|
||||||
*
|
|
||||||
* Delete a specific label
|
* Delete a specific label
|
||||||
*/
|
*/
|
||||||
public function delete() {
|
#[NoAdminRequired]
|
||||||
|
#[NoCSRFRequired]
|
||||||
|
#[CORS]
|
||||||
|
public function delete(): DataResponse {
|
||||||
$label = $this->labelService->delete($this->request->getParam('labelId'));
|
$label = $this->labelService->delete($this->request->getParam('labelId'));
|
||||||
return new DataResponse($label, HTTP::STATUS_OK);
|
return new DataResponse($label, HTTP::STATUS_OK);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,8 +7,10 @@
|
|||||||
|
|
||||||
namespace OCA\Deck\Controller;
|
namespace OCA\Deck\Controller;
|
||||||
|
|
||||||
|
use OCA\Deck\Db\Label;
|
||||||
use OCA\Deck\Service\LabelService;
|
use OCA\Deck\Service\LabelService;
|
||||||
use OCP\AppFramework\Controller;
|
use OCP\AppFramework\Controller;
|
||||||
|
use OCP\AppFramework\Http\Attribute\NoAdminRequired;
|
||||||
use OCP\IRequest;
|
use OCP\IRequest;
|
||||||
|
|
||||||
class LabelController extends Controller {
|
class LabelController extends Controller {
|
||||||
@@ -20,34 +22,18 @@ class LabelController extends Controller {
|
|||||||
parent::__construct($appName, $request);
|
parent::__construct($appName, $request);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
#[NoAdminRequired]
|
||||||
* @NoAdminRequired
|
public function create(string $title, string $color, int $boardId): Label {
|
||||||
* @param $title
|
|
||||||
* @param $color
|
|
||||||
* @param $boardId
|
|
||||||
* @return \OCP\AppFramework\Db\Entity
|
|
||||||
*/
|
|
||||||
public function create($title, $color, $boardId) {
|
|
||||||
return $this->labelService->create($title, $color, $boardId);
|
return $this->labelService->create($title, $color, $boardId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
#[NoAdminRequired]
|
||||||
* @NoAdminRequired
|
public function update(int $id, string $title, string $color): Label {
|
||||||
* @param $id
|
|
||||||
* @param $title
|
|
||||||
* @param $color
|
|
||||||
* @return \OCP\AppFramework\Db\Entity
|
|
||||||
*/
|
|
||||||
public function update($id, $title, $color) {
|
|
||||||
return $this->labelService->update($id, $title, $color);
|
return $this->labelService->update($id, $title, $color);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
#[NoAdminRequired]
|
||||||
* @NoAdminRequired
|
public function delete(int $labelId): Label {
|
||||||
* @param $labelId
|
|
||||||
* @return \OCP\AppFramework\Db\Entity
|
|
||||||
*/
|
|
||||||
public function delete($labelId) {
|
|
||||||
return $this->labelService->delete($labelId);
|
return $this->labelService->delete($labelId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ declare(strict_types=1);
|
|||||||
namespace OCA\Deck\Controller;
|
namespace OCA\Deck\Controller;
|
||||||
|
|
||||||
use OCA\Deck\Service\OverviewService;
|
use OCA\Deck\Service\OverviewService;
|
||||||
|
use OCP\AppFramework\Http\Attribute\NoAdminRequired;
|
||||||
use OCP\AppFramework\Http\DataResponse;
|
use OCP\AppFramework\Http\DataResponse;
|
||||||
use OCP\AppFramework\OCSController;
|
use OCP\AppFramework\OCSController;
|
||||||
use OCP\IRequest;
|
use OCP\IRequest;
|
||||||
@@ -24,9 +25,7 @@ class OverviewApiController extends OCSController {
|
|||||||
parent::__construct($appName, $request);
|
parent::__construct($appName, $request);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
#[NoAdminRequired]
|
||||||
* @NoAdminRequired
|
|
||||||
*/
|
|
||||||
public function upcomingCards(): DataResponse {
|
public function upcomingCards(): DataResponse {
|
||||||
return new DataResponse($this->dashboardService->findUpcomingCards($this->userId));
|
return new DataResponse($this->dashboardService->findUpcomingCards($this->userId));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ namespace OCA\Deck\Controller;
|
|||||||
use OCA\Deck\Db\Card;
|
use OCA\Deck\Db\Card;
|
||||||
use OCA\Deck\Model\CardDetails;
|
use OCA\Deck\Model\CardDetails;
|
||||||
use OCA\Deck\Service\SearchService;
|
use OCA\Deck\Service\SearchService;
|
||||||
|
use OCP\AppFramework\Http\Attribute\NoAdminRequired;
|
||||||
use OCP\AppFramework\Http\DataResponse;
|
use OCP\AppFramework\Http\DataResponse;
|
||||||
use OCP\AppFramework\OCSController;
|
use OCP\AppFramework\OCSController;
|
||||||
use OCP\IRequest;
|
use OCP\IRequest;
|
||||||
@@ -26,9 +27,7 @@ class SearchController extends OCSController {
|
|||||||
parent::__construct($appName, $request);
|
parent::__construct($appName, $request);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
#[NoAdminRequired]
|
||||||
* @NoAdminRequired
|
|
||||||
*/
|
|
||||||
public function search(string $term, ?int $limit = null, ?int $cursor = null): DataResponse {
|
public function search(string $term, ?int $limit = null, ?int $cursor = null): DataResponse {
|
||||||
$cards = $this->searchService->searchCards($term, $limit, $cursor);
|
$cards = $this->searchService->searchCards($term, $limit, $cursor);
|
||||||
return new DataResponse(array_map(function (Card $card) {
|
return new DataResponse(array_map(function (Card $card) {
|
||||||
|
|||||||
@@ -7,14 +7,16 @@
|
|||||||
|
|
||||||
namespace OCA\Deck\Controller;
|
namespace OCA\Deck\Controller;
|
||||||
|
|
||||||
use OCA\Deck\Service\BoardService;
|
|
||||||
use OCA\Deck\Service\StackService;
|
use OCA\Deck\Service\StackService;
|
||||||
use OCA\Deck\StatusException;
|
use OCA\Deck\StatusException;
|
||||||
use OCP\AppFramework\ApiController;
|
use OCP\AppFramework\ApiController;
|
||||||
use OCP\AppFramework\Http;
|
use OCP\AppFramework\Http;
|
||||||
|
use OCP\AppFramework\Http\Attribute\CORS;
|
||||||
|
use OCP\AppFramework\Http\Attribute\NoAdminRequired;
|
||||||
|
use OCP\AppFramework\Http\Attribute\NoCSRFRequired;
|
||||||
use OCP\AppFramework\Http\DataResponse;
|
use OCP\AppFramework\Http\DataResponse;
|
||||||
use OCP\IRequest;
|
use OCP\IRequest;
|
||||||
use Sabre\HTTP\Util;
|
use function Sabre\HTTP\parseDate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class StackApiController
|
* Class StackApiController
|
||||||
@@ -29,23 +31,21 @@ class StackApiController extends ApiController {
|
|||||||
$appName,
|
$appName,
|
||||||
IRequest $request,
|
IRequest $request,
|
||||||
private StackService $stackService,
|
private StackService $stackService,
|
||||||
private BoardService $boardService,
|
|
||||||
) {
|
) {
|
||||||
parent::__construct($appName, $request);
|
parent::__construct($appName, $request);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @NoAdminRequired
|
* Return all the stacks in the specified board.
|
||||||
* @CORS
|
|
||||||
* @NoCSRFRequired
|
|
||||||
*
|
|
||||||
* Return all of the stacks in the specified board.
|
|
||||||
*/
|
*/
|
||||||
public function index() {
|
#[NoAdminRequired]
|
||||||
|
#[CORS]
|
||||||
|
#[NoCSRFRequired]
|
||||||
|
public function index(): DataResponse {
|
||||||
$since = 0;
|
$since = 0;
|
||||||
$modified = $this->request->getHeader('If-Modified-Since');
|
$modified = $this->request->getHeader('If-Modified-Since');
|
||||||
if ($modified !== null && $modified !== '') {
|
if ($modified !== '') {
|
||||||
$date = Util::parseHTTPDate($modified);
|
$date = parseDate($modified);
|
||||||
if (!$date) {
|
if (!$date) {
|
||||||
throw new StatusException('Invalid If-Modified-Since header provided.');
|
throw new StatusException('Invalid If-Modified-Since header provided.');
|
||||||
}
|
}
|
||||||
@@ -56,13 +56,12 @@ class StackApiController extends ApiController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @NoAdminRequired
|
* Return all the stacks in the specified board.
|
||||||
* @CORS
|
|
||||||
* @NoCSRFRequired
|
|
||||||
*
|
|
||||||
* Return all of the stacks in the specified board.
|
|
||||||
*/
|
*/
|
||||||
public function get() {
|
#[NoAdminRequired]
|
||||||
|
#[CORS]
|
||||||
|
#[NoCSRFRequired]
|
||||||
|
public function get(): DataResponse {
|
||||||
$stack = $this->stackService->find($this->request->getParam('stackId'));
|
$stack = $this->stackService->find($this->request->getParam('stackId'));
|
||||||
$response = new DataResponse($stack, HTTP::STATUS_OK);
|
$response = new DataResponse($stack, HTTP::STATUS_OK);
|
||||||
$response->setETag($stack->getETag());
|
$response->setETag($stack->getETag());
|
||||||
@@ -70,55 +69,45 @@ class StackApiController extends ApiController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @NoAdminRequired
|
|
||||||
* @CORS
|
|
||||||
* @NoCSRFRequired
|
|
||||||
*
|
|
||||||
* @params $title
|
|
||||||
* @params $order
|
|
||||||
*
|
|
||||||
* Create a stack with the specified title and order.
|
* Create a stack with the specified title and order.
|
||||||
*/
|
*/
|
||||||
public function create($title, $order) {
|
#[NoAdminRequired]
|
||||||
|
#[CORS]
|
||||||
|
#[NoCSRFRequired]
|
||||||
|
public function create(string $title, int $order): DataResponse {
|
||||||
$stack = $this->stackService->create($title, $this->request->getParam('boardId'), $order);
|
$stack = $this->stackService->create($title, $this->request->getParam('boardId'), $order);
|
||||||
return new DataResponse($stack, HTTP::STATUS_OK);
|
return new DataResponse($stack, HTTP::STATUS_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @NoAdminRequired
|
|
||||||
* @CORS
|
|
||||||
* @NoCSRFRequired
|
|
||||||
*
|
|
||||||
* @params $title
|
|
||||||
* @params $order
|
|
||||||
*
|
|
||||||
* Update a stack by the specified stackId and boardId with the values that were put.
|
* Update a stack by the specified stackId and boardId with the values that were put.
|
||||||
*/
|
*/
|
||||||
public function update($title, $order) {
|
#[NoAdminRequired]
|
||||||
|
#[CORS]
|
||||||
|
#[NoCSRFRequired]
|
||||||
|
public function update(string $title, int $order) {
|
||||||
$stack = $this->stackService->update($this->request->getParam('stackId'), $title, $this->request->getParam('boardId'), $order, 0);
|
$stack = $this->stackService->update($this->request->getParam('stackId'), $title, $this->request->getParam('boardId'), $order, 0);
|
||||||
return new DataResponse($stack, HTTP::STATUS_OK);
|
return new DataResponse($stack, HTTP::STATUS_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @NoAdminRequired
|
|
||||||
* @CORS
|
|
||||||
* @NoCSRFRequired
|
|
||||||
*
|
|
||||||
* Delete the stack specified by $this->request->getParam('stackId').
|
* Delete the stack specified by $this->request->getParam('stackId').
|
||||||
*/
|
*/
|
||||||
public function delete() {
|
#[NoAdminRequired]
|
||||||
|
#[CORS]
|
||||||
|
#[NoCSRFRequired]
|
||||||
|
public function delete(): DataResponse {
|
||||||
$stack = $this->stackService->delete($this->request->getParam('stackId'));
|
$stack = $this->stackService->delete($this->request->getParam('stackId'));
|
||||||
return new DataResponse($stack, HTTP::STATUS_OK);
|
return new DataResponse($stack, HTTP::STATUS_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @NoAdminRequired
|
* Get the stacks that have been archived.
|
||||||
* @CORS
|
|
||||||
* @NoCSRFRequired
|
|
||||||
*
|
|
||||||
* get the stacks that have been archived.
|
|
||||||
*/
|
*/
|
||||||
public function getArchived() {
|
#[NoAdminRequired]
|
||||||
|
#[CORS]
|
||||||
|
#[NoCSRFRequired]
|
||||||
|
public function getArchived(): DataResponse {
|
||||||
$stacks = $this->stackService->findAllArchived($this->request->getParam('boardId'));
|
$stacks = $this->stackService->findAllArchived($this->request->getParam('boardId'));
|
||||||
return new DataResponse($stacks, HTTP::STATUS_OK);
|
return new DataResponse($stacks, HTTP::STATUS_OK);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,10 +7,12 @@
|
|||||||
|
|
||||||
namespace OCA\Deck\Controller;
|
namespace OCA\Deck\Controller;
|
||||||
|
|
||||||
|
use OCA\Deck\Db\Stack;
|
||||||
use OCA\Deck\Service\StackService;
|
use OCA\Deck\Service\StackService;
|
||||||
|
|
||||||
use OCP\AppFramework\Controller;
|
use OCP\AppFramework\Controller;
|
||||||
|
|
||||||
|
use OCP\AppFramework\Http\Attribute\NoAdminRequired;
|
||||||
use OCP\IRequest;
|
use OCP\IRequest;
|
||||||
|
|
||||||
class StackController extends Controller {
|
class StackController extends Controller {
|
||||||
@@ -18,78 +20,54 @@ class StackController extends Controller {
|
|||||||
string $appName,
|
string $appName,
|
||||||
IRequest $request,
|
IRequest $request,
|
||||||
private StackService $stackService,
|
private StackService $stackService,
|
||||||
private $userId,
|
|
||||||
) {
|
) {
|
||||||
parent::__construct($appName, $request);
|
parent::__construct($appName, $request);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @NoAdminRequired
|
* @return Stack[]
|
||||||
* @param $boardId
|
|
||||||
* @return array
|
|
||||||
*/
|
*/
|
||||||
public function index($boardId) {
|
#[NoAdminRequired]
|
||||||
|
public function index(int $boardId): array {
|
||||||
return $this->stackService->findAll($boardId);
|
return $this->stackService->findAll($boardId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @NoAdminRequired
|
* @return Stack[]
|
||||||
* @param $boardId
|
|
||||||
* @return array
|
|
||||||
*/
|
*/
|
||||||
public function archived($boardId) {
|
#[NoAdminRequired]
|
||||||
|
public function archived(int $boardId): array {
|
||||||
return $this->stackService->findAllArchived($boardId);
|
return $this->stackService->findAllArchived($boardId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
#[NoAdminRequired]
|
||||||
* @NoAdminRequired
|
public function create(string $title, int $boardId, int $order = 999): Stack {
|
||||||
* @param $title
|
|
||||||
* @param $boardId
|
|
||||||
* @param int $order
|
|
||||||
* @return \OCP\AppFramework\Db\Entity
|
|
||||||
*/
|
|
||||||
public function create($title, $boardId, $order = 999) {
|
|
||||||
return $this->stackService->create($title, $boardId, $order);
|
return $this->stackService->create($title, $boardId, $order);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
#[NoAdminRequired]
|
||||||
* @NoAdminRequired
|
public function update(int $id, string $title, int $boardId, int $order, ?int $deletedAt = null): Stack {
|
||||||
* @param $id
|
|
||||||
* @param $title
|
|
||||||
* @param $boardId
|
|
||||||
* @param $order
|
|
||||||
* @param $deletedAt
|
|
||||||
* @return \OCP\AppFramework\Db\Entity
|
|
||||||
*/
|
|
||||||
public function update($id, $title, $boardId, $order, $deletedAt) {
|
|
||||||
return $this->stackService->update($id, $title, $boardId, $order, $deletedAt);
|
return $this->stackService->update($id, $title, $boardId, $order, $deletedAt);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @NoAdminRequired
|
* @return array<int, Stack>
|
||||||
* @param $stackId
|
|
||||||
* @param $order
|
|
||||||
* @return array
|
|
||||||
*/
|
*/
|
||||||
public function reorder($stackId, $order) {
|
#[NoAdminRequired]
|
||||||
return $this->stackService->reorder((int)$stackId, (int)$order);
|
public function reorder(int $stackId, int $order): array {
|
||||||
|
return $this->stackService->reorder($stackId, $order);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
#[NoAdminRequired]
|
||||||
* @NoAdminRequired
|
public function delete(int $stackId): Stack {
|
||||||
* @param $stackId
|
|
||||||
* @return \OCP\AppFramework\Db\Entity
|
|
||||||
*/
|
|
||||||
public function delete($stackId) {
|
|
||||||
return $this->stackService->delete($stackId);
|
return $this->stackService->delete($stackId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @NoAdminRequired
|
* @return Stack[]
|
||||||
* @param $boardId
|
|
||||||
* @return \OCP\AppFramework\Db\Entity
|
|
||||||
*/
|
*/
|
||||||
public function deleted($boardId) {
|
#[NoAdminRequired]
|
||||||
|
public function deleted(int $boardId): array {
|
||||||
return $this->stackService->fetchDeleted($boardId);
|
return $this->stackService->fetchDeleted($boardId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,20 @@
|
|||||||
|
|
||||||
namespace OCA\Deck\Db;
|
namespace OCA\Deck\Db;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @method int getBoardId()
|
||||||
|
* @method bool isPermissionEdit()
|
||||||
|
* @method void setPermissionEdit(bool $permissionEdit)
|
||||||
|
* @method bool isPermissionShare()
|
||||||
|
* @method void setPermissionShare(bool $permissionShare)
|
||||||
|
* @method bool isPermissionManage()
|
||||||
|
* @method void setPermissionManage(bool $permissionManage)
|
||||||
|
* @method int getType()
|
||||||
|
* @method void setType(int $type)
|
||||||
|
* @method bool isOwner()
|
||||||
|
* @method void setOwner(int $owner)
|
||||||
|
*
|
||||||
|
*/
|
||||||
class Acl extends RelationalEntity {
|
class Acl extends RelationalEntity {
|
||||||
public const PERMISSION_READ = 0;
|
public const PERMISSION_READ = 0;
|
||||||
public const PERMISSION_EDIT = 1;
|
public const PERMISSION_EDIT = 1;
|
||||||
@@ -37,17 +51,13 @@ class Acl extends RelationalEntity {
|
|||||||
$this->addResolvable('participant');
|
$this->addResolvable('participant');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getPermission($permission) {
|
public function getPermission(int $permission): bool {
|
||||||
switch ($permission) {
|
return match ($permission) {
|
||||||
case self::PERMISSION_READ:
|
self::PERMISSION_READ => true,
|
||||||
return true;
|
self::PERMISSION_EDIT => $this->getPermissionEdit(),
|
||||||
case self::PERMISSION_EDIT:
|
self::PERMISSION_SHARE => $this->getPermissionShare(),
|
||||||
return $this->getPermissionEdit();
|
self::PERMISSION_MANAGE => $this->getPermissionManage(),
|
||||||
case self::PERMISSION_SHARE:
|
default => false,
|
||||||
return $this->getPermissionShare();
|
};
|
||||||
case self::PERMISSION_MANAGE:
|
|
||||||
return $this->getPermissionManage();
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,13 +19,10 @@ class AclMapper extends DeckMapper implements IPermissionMapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param numeric $boardId
|
|
||||||
* @param int|null $limit
|
|
||||||
* @param int|null $offset
|
|
||||||
* @return Acl[]
|
* @return Acl[]
|
||||||
* @throws \OCP\DB\Exception
|
* @throws \OCP\DB\Exception
|
||||||
*/
|
*/
|
||||||
public function findAll($boardId, $limit = null, $offset = null) {
|
public function findAll(int $boardId, ?int $limit = null, ?int $offset = null) {
|
||||||
$qb = $this->db->getQueryBuilder();
|
$qb = $this->db->getQueryBuilder();
|
||||||
$qb->select('id', 'board_id', 'type', 'participant', 'permission_edit', 'permission_share', 'permission_manage')
|
$qb->select('id', 'board_id', 'type', 'participant', 'permission_edit', 'permission_share', 'permission_manage')
|
||||||
->from('deck_board_acl')
|
->from('deck_board_acl')
|
||||||
@@ -51,12 +48,9 @@ class AclMapper extends DeckMapper implements IPermissionMapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param numeric $userId
|
|
||||||
* @param numeric $id
|
|
||||||
* @return bool
|
|
||||||
* @throws \OCP\DB\Exception
|
* @throws \OCP\DB\Exception
|
||||||
*/
|
*/
|
||||||
public function isOwner($userId, $id): bool {
|
public function isOwner(string $userId, int $id): bool {
|
||||||
$aclId = $id;
|
$aclId = $id;
|
||||||
$qb = $this->db->getQueryBuilder();
|
$qb = $this->db->getQueryBuilder();
|
||||||
$qb->select('acl.id')
|
$qb->select('acl.id')
|
||||||
@@ -68,11 +62,7 @@ class AclMapper extends DeckMapper implements IPermissionMapper {
|
|||||||
return count($qb->executeQuery()->fetchAll()) > 0;
|
return count($qb->executeQuery()->fetchAll()) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function findBoardId(int $id): ?int {
|
||||||
* @param numeric $id
|
|
||||||
* @return int|null
|
|
||||||
*/
|
|
||||||
public function findBoardId($id): ?int {
|
|
||||||
try {
|
try {
|
||||||
$entity = $this->find($id);
|
$entity = $this->find($id);
|
||||||
return $entity->getBoardId();
|
return $entity->getBoardId();
|
||||||
@@ -87,7 +77,7 @@ class AclMapper extends DeckMapper implements IPermissionMapper {
|
|||||||
* @return Acl[]
|
* @return Acl[]
|
||||||
* @throws \OCP\DB\Exception
|
* @throws \OCP\DB\Exception
|
||||||
*/
|
*/
|
||||||
public function findByParticipant($type, $participant): array {
|
public function findByParticipant(int $type, string $participant): array {
|
||||||
$qb = $this->db->getQueryBuilder();
|
$qb = $this->db->getQueryBuilder();
|
||||||
|
|
||||||
$qb->select('*')
|
$qb->select('*')
|
||||||
|
|||||||
@@ -77,26 +77,41 @@ class AssignmentMapper extends DeckMapper implements IPermissionMapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function deleteByParticipantOnBoard(string $participant, int $boardId, $type = Assignment::TYPE_USER) {
|
public function deleteByParticipantOnBoard(string $participant, int $boardId, $type = Assignment::TYPE_USER) {
|
||||||
$qb = $this->db->getQueryBuilder();
|
// Step 1: Get all card IDs for the board that have assignments for this participant
|
||||||
|
// This avoids MySQL Error 1093 by separating the SELECT from the DELETE operation
|
||||||
$cardIdQuery = $this->db->getQueryBuilder();
|
$cardIdQuery = $this->db->getQueryBuilder();
|
||||||
$cardIdQuery->select('a.card_id')
|
$cardIdQuery->select('a.card_id')
|
||||||
->from('deck_assigned_users', 'a')
|
->from('deck_assigned_users', 'a')
|
||||||
->innerJoin('a', 'deck_cards', 'c', 'c.id = a.card_id')
|
->innerJoin('a', 'deck_cards', 'c', 'c.id = a.card_id')
|
||||||
->innerJoin('c', 'deck_stacks', 's', 's.id = c.stack_id')
|
->innerJoin('c', 'deck_stacks', 's', 's.id = c.stack_id')
|
||||||
->where($cardIdQuery->expr()->eq('a.participant', $qb->createNamedParameter($participant, IQueryBuilder::PARAM_STR)))
|
->where($cardIdQuery->expr()->eq('a.participant', $cardIdQuery->createNamedParameter($participant, IQueryBuilder::PARAM_STR)))
|
||||||
->andWhere($cardIdQuery->expr()->eq('s.board_id', $qb->createNamedParameter($boardId, IQueryBuilder::PARAM_INT)))
|
->andWhere($cardIdQuery->expr()->eq('s.board_id', $cardIdQuery->createNamedParameter($boardId, IQueryBuilder::PARAM_INT)))
|
||||||
->andWhere($cardIdQuery->expr()->eq('a.type', $qb->createNamedParameter($type, IQueryBuilder::PARAM_INT)));
|
->andWhere($cardIdQuery->expr()->eq('a.type', $cardIdQuery->createNamedParameter($type, IQueryBuilder::PARAM_INT)));
|
||||||
$qb->delete('deck_assigned_users')
|
|
||||||
->where($qb->expr()->in('card_id', $qb->createFunction($cardIdQuery->getSQL()), IQueryBuilder::PARAM_INT_ARRAY));
|
$result = $cardIdQuery->executeQuery();
|
||||||
$qb->executeStatement();
|
$cardIds = [];
|
||||||
|
while ($row = $result->fetch()) {
|
||||||
|
$cardIds[] = $row['card_id'];
|
||||||
|
}
|
||||||
|
$result->closeCursor();
|
||||||
|
|
||||||
|
// Step 2: If we have card IDs, delete the assignments
|
||||||
|
if (!empty($cardIds)) {
|
||||||
|
$deleteQuery = $this->db->getQueryBuilder();
|
||||||
|
$deleteQuery->delete('deck_assigned_users')
|
||||||
|
->where($deleteQuery->expr()->eq('participant', $deleteQuery->createNamedParameter($participant, IQueryBuilder::PARAM_STR)))
|
||||||
|
->andWhere($deleteQuery->expr()->eq('type', $deleteQuery->createNamedParameter($type, IQueryBuilder::PARAM_INT)))
|
||||||
|
->andWhere($deleteQuery->expr()->in('card_id', $deleteQuery->createNamedParameter($cardIds, IQueryBuilder::PARAM_INT_ARRAY)));
|
||||||
|
$deleteQuery->executeStatement();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function isOwner($userId, $id): bool {
|
public function isOwner(string $userId, int $id): bool {
|
||||||
return $this->cardMapper->isOwner($userId, $id);
|
return $this->cardMapper->isOwner($userId, $id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function findBoardId($id): ?int {
|
public function findBoardId(int $id): ?int {
|
||||||
return $this->cardMapper->findBoardId($id);
|
return $this->cardMapper->findBoardId($id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -108,6 +123,9 @@ class AssignmentMapper extends DeckMapper implements IPermissionMapper {
|
|||||||
* @throws NotFoundException
|
* @throws NotFoundException
|
||||||
*/
|
*/
|
||||||
public function insert(Entity $entity): Entity {
|
public function insert(Entity $entity): Entity {
|
||||||
|
if (!($entity instanceof Assignment)) {
|
||||||
|
throw new \LogicException('Trying to insert a ' . get_class($entity) . ' in the assignment mapper');
|
||||||
|
}
|
||||||
$origin = $this->getOrigin($entity);
|
$origin = $this->getOrigin($entity);
|
||||||
if ($origin === null) {
|
if ($origin === null) {
|
||||||
throw new NotFoundException('No origin found for assignment');
|
throw new NotFoundException('No origin found for assignment');
|
||||||
@@ -126,7 +144,7 @@ class AssignmentMapper extends DeckMapper implements IPermissionMapper {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isUserAssigned($cardId, $userId): bool {
|
public function isUserAssigned(int $cardId, string $userId): bool {
|
||||||
$assignments = $this->findAll($cardId);
|
$assignments = $this->findAll($cardId);
|
||||||
foreach ($assignments as $assignment) {
|
foreach ($assignments as $assignment) {
|
||||||
$origin = $this->getOrigin($assignment);
|
$origin = $this->getOrigin($assignment);
|
||||||
|
|||||||
@@ -36,13 +36,11 @@ class AttachmentMapper extends DeckMapper implements IPermissionMapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param int $id
|
|
||||||
* @return Attachment
|
|
||||||
* @throws DoesNotExistException
|
* @throws DoesNotExistException
|
||||||
* @throws MultipleObjectsReturnedException
|
* @throws MultipleObjectsReturnedException
|
||||||
* @throws \OCP\DB\Exception
|
* @throws \OCP\DB\Exception
|
||||||
*/
|
*/
|
||||||
public function find($id) {
|
public function find(int $id): Attachment {
|
||||||
$qb = $this->db->getQueryBuilder();
|
$qb = $this->db->getQueryBuilder();
|
||||||
$qb->select('*')
|
$qb->select('*')
|
||||||
->from($this->getTableName())
|
->from($this->getTableName())
|
||||||
@@ -52,14 +50,11 @@ class AttachmentMapper extends DeckMapper implements IPermissionMapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param int $cardId
|
|
||||||
* @param string $data
|
|
||||||
* @return Attachment
|
|
||||||
* @throws DoesNotExistException
|
* @throws DoesNotExistException
|
||||||
* @throws MultipleObjectsReturnedException
|
* @throws MultipleObjectsReturnedException
|
||||||
* @throws \OCP\DB\Exception
|
* @throws \OCP\DB\Exception
|
||||||
*/
|
*/
|
||||||
public function findByData($cardId, $data) {
|
public function findByData(int $cardId, string $data): Attachment {
|
||||||
$qb = $this->db->getQueryBuilder();
|
$qb = $this->db->getQueryBuilder();
|
||||||
$qb->select('*')
|
$qb->select('*')
|
||||||
->from($this->getTableName())
|
->from($this->getTableName())
|
||||||
@@ -70,11 +65,10 @@ class AttachmentMapper extends DeckMapper implements IPermissionMapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $cardId
|
|
||||||
* @return Entity[]
|
* @return Entity[]
|
||||||
* @throws \OCP\DB\Exception
|
* @throws \OCP\DB\Exception
|
||||||
*/
|
*/
|
||||||
public function findAll($cardId) {
|
public function findAll(int $cardId): array {
|
||||||
$qb = $this->db->getQueryBuilder();
|
$qb = $this->db->getQueryBuilder();
|
||||||
$qb->select('*')
|
$qb->select('*')
|
||||||
->from($this->getTableName())
|
->from($this->getTableName())
|
||||||
@@ -86,11 +80,9 @@ class AttachmentMapper extends DeckMapper implements IPermissionMapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param null $cardId
|
* @return Attachment[]
|
||||||
* @param bool $withOffset
|
|
||||||
* @return array
|
|
||||||
*/
|
*/
|
||||||
public function findToDelete($cardId = null, $withOffset = true) {
|
public function findToDelete(?int $cardId = null, bool $withOffset = true): array {
|
||||||
// add buffer of 5 min
|
// add buffer of 5 min
|
||||||
$timeLimit = time() - (60 * 5);
|
$timeLimit = time() - (60 * 5);
|
||||||
$qb = $this->db->getQueryBuilder();
|
$qb = $this->db->getQueryBuilder();
|
||||||
@@ -112,12 +104,8 @@ class AttachmentMapper extends DeckMapper implements IPermissionMapper {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if $userId is owner of Entity with $id
|
* Check if $userId is owner of Entity with $id
|
||||||
*
|
|
||||||
* @param $userId string userId
|
|
||||||
* @param $id int|string unique entity identifier
|
|
||||||
* @return boolean
|
|
||||||
*/
|
*/
|
||||||
public function isOwner($userId, $id): bool {
|
public function isOwner(string $userId, int $id): bool {
|
||||||
try {
|
try {
|
||||||
$attachment = $this->find($id);
|
$attachment = $this->find($id);
|
||||||
return $this->cardMapper->isOwner($userId, $attachment->getCardId());
|
return $this->cardMapper->isOwner($userId, $attachment->getCardId());
|
||||||
@@ -130,10 +118,10 @@ class AttachmentMapper extends DeckMapper implements IPermissionMapper {
|
|||||||
/**
|
/**
|
||||||
* Query boardId for Entity of given $id
|
* Query boardId for Entity of given $id
|
||||||
*
|
*
|
||||||
* @param $id int|string unique entity identifier
|
* @param $id int unique entity identifier
|
||||||
* @return int|null id of Board
|
* @return int|null id of Board
|
||||||
*/
|
*/
|
||||||
public function findBoardId($id): ?int {
|
public function findBoardId(int $id): ?int {
|
||||||
try {
|
try {
|
||||||
$attachment = $this->find($id);
|
$attachment = $this->find($id);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
|
|||||||
@@ -10,10 +10,20 @@ namespace OCA\Deck\Db;
|
|||||||
/**
|
/**
|
||||||
* @method int getId()
|
* @method int getId()
|
||||||
* @method string getTitle()
|
* @method string getTitle()
|
||||||
|
* @method void setTitle(string $title)
|
||||||
* @method int getShared()
|
* @method int getShared()
|
||||||
|
* @method void setShared(int $shared)
|
||||||
|
* @method bool isArchived()
|
||||||
* @method bool getArchived()
|
* @method bool getArchived()
|
||||||
|
* @method void setArchived(bool $archived)
|
||||||
* @method int getDeletedAt()
|
* @method int getDeletedAt()
|
||||||
|
* @method void setDeletedAt(int $deletedAt)
|
||||||
* @method int getLastModified()
|
* @method int getLastModified()
|
||||||
|
* @method void setLastModified(int $lastModified)
|
||||||
|
* @method string getOwner()
|
||||||
|
* @method void setOwner(string $owner)
|
||||||
|
* @method string getColor()
|
||||||
|
* @method void setColor(string $color)
|
||||||
*/
|
*/
|
||||||
class Board extends RelationalEntity {
|
class Board extends RelationalEntity {
|
||||||
protected $title;
|
protected $title;
|
||||||
|
|||||||
@@ -469,16 +469,16 @@ class BoardMapper extends QBMapper implements IPermissionMapper {
|
|||||||
return parent::delete($entity);
|
return parent::delete($entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isOwner($userId, $id): bool {
|
public function isOwner(string $userId, int $id): bool {
|
||||||
$board = $this->find($id);
|
$board = $this->find($id);
|
||||||
return ($board->getOwner() === $userId);
|
return ($board->getOwner() === $userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function findBoardId($id): ?int {
|
public function findBoardId(int $id): ?int {
|
||||||
return $id;
|
return $id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function mapAcl(Acl &$acl) {
|
public function mapAcl(Acl &$acl): void {
|
||||||
$acl->resolveRelation('participant', function ($participant) use (&$acl) {
|
$acl->resolveRelation('participant', function ($participant) use (&$acl) {
|
||||||
if ($acl->getType() === Acl::PERMISSION_TYPE_USER) {
|
if ($acl->getType() === Acl::PERMISSION_TYPE_USER) {
|
||||||
if ($this->userManager->userExists($acl->getParticipant())) {
|
if ($this->userManager->userExists($acl->getParticipant())) {
|
||||||
|
|||||||
@@ -15,13 +15,18 @@ use Sabre\VObject\Component\VCalendar;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @method string getTitle()
|
* @method string getTitle()
|
||||||
|
* @method void setTitle(string $title)
|
||||||
* @method string getDescription()
|
* @method string getDescription()
|
||||||
* @method string getDescriptionPrev()
|
* @method string getDescriptionPrev()
|
||||||
* @method int getStackId()
|
* @method int getStackId()
|
||||||
|
* @method void setStackId(int $stackId)
|
||||||
* @method int getOrder()
|
* @method int getOrder()
|
||||||
|
* @method void setOrder(int $order)
|
||||||
* @method int getLastModified()
|
* @method int getLastModified()
|
||||||
* @method int getCreatedAt()
|
* @method int getCreatedAt()
|
||||||
* @method bool getArchived()
|
* @method bool getArchived()
|
||||||
|
* @method string getType()
|
||||||
|
* @method void setType(string $type)
|
||||||
* @method int getDeletedAt()
|
* @method int getDeletedAt()
|
||||||
* @method void setDeletedAt(int $deletedAt)
|
* @method void setDeletedAt(int $deletedAt)
|
||||||
* @method bool getNotified()
|
* @method bool getNotified()
|
||||||
@@ -68,8 +73,8 @@ class Card extends RelationalEntity {
|
|||||||
protected $createdAt;
|
protected $createdAt;
|
||||||
protected $labels;
|
protected $labels;
|
||||||
protected $assignedUsers;
|
protected $assignedUsers;
|
||||||
protected $attachments;
|
protected array $attachments = [];
|
||||||
protected $attachmentCount;
|
protected int $attachmentCount = 0;
|
||||||
protected $owner;
|
protected $owner;
|
||||||
protected $order;
|
protected $order;
|
||||||
protected $archived = false;
|
protected $archived = false;
|
||||||
|
|||||||
@@ -86,16 +86,15 @@ class CardMapper extends QBMapper implements IPermissionMapper {
|
|||||||
$updatedFields = $entity->getUpdatedFields();
|
$updatedFields = $entity->getUpdatedFields();
|
||||||
if (isset($updatedFields['duedate']) && $updatedFields['duedate']) {
|
if (isset($updatedFields['duedate']) && $updatedFields['duedate']) {
|
||||||
try {
|
try {
|
||||||
/** @var Card $existing */
|
|
||||||
$existing = $this->find($entity->getId());
|
$existing = $this->find($entity->getId());
|
||||||
if ($existing && $entity->getDuedate() !== $existing->getDuedate()) {
|
if ($entity->getDueDate() !== $existing->getDueDate()) {
|
||||||
$entity->setNotified(false);
|
$entity->setNotified(false);
|
||||||
}
|
}
|
||||||
// remove pending notifications
|
// remove pending notifications
|
||||||
$notification = $this->notificationManager->createNotification();
|
$notification = $this->notificationManager->createNotification();
|
||||||
$notification
|
$notification
|
||||||
->setApp('deck')
|
->setApp('deck')
|
||||||
->setObject('card', $entity->getId());
|
->setObject('card', (string)$entity->getId());
|
||||||
$this->notificationManager->markProcessed($notification);
|
$this->notificationManager->markProcessed($notification);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
}
|
}
|
||||||
@@ -131,7 +130,11 @@ class CardMapper extends QBMapper implements IPermissionMapper {
|
|||||||
return $card;
|
return $card;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function findAll($stackId, $limit = null, $offset = null, $since = -1) {
|
/**
|
||||||
|
* @return Card[]
|
||||||
|
* @throws \OCP\DB\Exception
|
||||||
|
*/
|
||||||
|
public function findAll($stackId, ?int $limit = null, int $offset = 0, int $since = -1) {
|
||||||
$qb = $this->db->getQueryBuilder();
|
$qb = $this->db->getQueryBuilder();
|
||||||
$qb->select('*')
|
$qb->select('*')
|
||||||
->from('deck_cards')
|
->from('deck_cards')
|
||||||
@@ -146,6 +149,32 @@ class CardMapper extends QBMapper implements IPermissionMapper {
|
|||||||
return $this->findEntities($qb);
|
return $this->findEntities($qb);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param int[] $stackIds
|
||||||
|
* @return array<int, null|Card[]>
|
||||||
|
* @throws \OCP\DB\Exception
|
||||||
|
*/
|
||||||
|
public function findAllForStacks(array $stackIds, ?int $limit = null, int $offset = 0, int $since = -1): array {
|
||||||
|
$qb = $this->db->getQueryBuilder();
|
||||||
|
$qb->select('*')
|
||||||
|
->from('deck_cards')
|
||||||
|
->where($qb->expr()->in('stack_id', $qb->createNamedParameter($stackIds, IQueryBuilder::PARAM_INT_ARRAY)))
|
||||||
|
->andWhere($qb->expr()->eq('archived', $qb->createNamedParameter(false, IQueryBuilder::PARAM_BOOL)))
|
||||||
|
->andWhere($qb->expr()->eq('deleted_at', $qb->createNamedParameter(0, IQueryBuilder::PARAM_INT)))
|
||||||
|
->andWhere($qb->expr()->gt('last_modified', $qb->createNamedParameter($since, IQueryBuilder::PARAM_INT)))
|
||||||
|
->setMaxResults($limit)
|
||||||
|
->setFirstResult($offset)
|
||||||
|
->orderBy('order')
|
||||||
|
->addOrderBy('id');
|
||||||
|
|
||||||
|
$rawCards = $this->findEntities($qb);
|
||||||
|
$cards = array_fill_keys($stackIds, null);
|
||||||
|
foreach ($rawCards as $card) {
|
||||||
|
$cards[$card->getStackId()][] = $card;
|
||||||
|
}
|
||||||
|
return $cards;
|
||||||
|
}
|
||||||
|
|
||||||
public function queryCardsByBoard(int $boardId): IQueryBuilder {
|
public function queryCardsByBoard(int $boardId): IQueryBuilder {
|
||||||
$qb = $this->db->getQueryBuilder();
|
$qb = $this->db->getQueryBuilder();
|
||||||
$qb->select('c.*')
|
$qb->select('c.*')
|
||||||
@@ -164,7 +193,10 @@ class CardMapper extends QBMapper implements IPermissionMapper {
|
|||||||
return $qb;
|
return $qb;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function findToDelete($timeLimit, $limit = null) {
|
/**
|
||||||
|
* @return Card[]
|
||||||
|
*/
|
||||||
|
public function findToDelete(int $timeLimit, ?int $limit = null): array {
|
||||||
$qb = $this->db->getQueryBuilder();
|
$qb = $this->db->getQueryBuilder();
|
||||||
$qb->select('id', 'title', 'owner', 'archived', 'deleted_at', 'last_modified')
|
$qb->select('id', 'title', 'owner', 'archived', 'deleted_at', 'last_modified')
|
||||||
->from('deck_cards')
|
->from('deck_cards')
|
||||||
@@ -175,7 +207,10 @@ class CardMapper extends QBMapper implements IPermissionMapper {
|
|||||||
return $this->findEntities($qb);
|
return $this->findEntities($qb);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function findDeleted($boardId, $limit = null, $offset = null) {
|
/**
|
||||||
|
* @return Card[]
|
||||||
|
*/
|
||||||
|
public function findDeleted(int $boardId, ?int $limit = null, int $offset = 0): array {
|
||||||
$qb = $this->queryCardsByBoard($boardId);
|
$qb = $this->queryCardsByBoard($boardId);
|
||||||
$qb->andWhere($qb->expr()->neq('c.deleted_at', $qb->createNamedParameter(0, IQueryBuilder::PARAM_INT)))
|
$qb->andWhere($qb->expr()->neq('c.deleted_at', $qb->createNamedParameter(0, IQueryBuilder::PARAM_INT)))
|
||||||
->setMaxResults($limit)
|
->setMaxResults($limit)
|
||||||
@@ -185,7 +220,10 @@ class CardMapper extends QBMapper implements IPermissionMapper {
|
|||||||
return $this->findEntities($qb);
|
return $this->findEntities($qb);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function findCalendarEntries($boardId, $limit = null, $offset = null) {
|
/**
|
||||||
|
* @return Card[]
|
||||||
|
*/
|
||||||
|
public function findCalendarEntries(int $boardId, ?int $limit = null, $offset = 0): array {
|
||||||
$qb = $this->db->getQueryBuilder();
|
$qb = $this->db->getQueryBuilder();
|
||||||
$qb->select('c.*')
|
$qb->select('c.*')
|
||||||
->from('deck_cards', 'c')
|
->from('deck_cards', 'c')
|
||||||
@@ -240,7 +278,11 @@ class CardMapper extends QBMapper implements IPermissionMapper {
|
|||||||
return $this->findEntities($qb);
|
return $this->findEntities($qb);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function findAllWithDue(array $boardIds) {
|
/**
|
||||||
|
* @param int[] $boardIds
|
||||||
|
* @return Card[]
|
||||||
|
*/
|
||||||
|
public function findAllWithDue(array $boardIds): array {
|
||||||
$qb = $this->db->getQueryBuilder();
|
$qb = $this->db->getQueryBuilder();
|
||||||
$qb->select('c.*')
|
$qb->select('c.*')
|
||||||
->from('deck_cards', 'c')
|
->from('deck_cards', 'c')
|
||||||
@@ -257,7 +299,11 @@ class CardMapper extends QBMapper implements IPermissionMapper {
|
|||||||
return $this->findEntities($qb);
|
return $this->findEntities($qb);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function findToMeOrNotAssignedCards(array $boardIds, string $username) {
|
/**
|
||||||
|
* @param int[] $boardIds
|
||||||
|
* @return Card[]
|
||||||
|
*/
|
||||||
|
public function findToMeOrNotAssignedCards(array $boardIds, string $username): array {
|
||||||
$qb = $this->db->getQueryBuilder();
|
$qb = $this->db->getQueryBuilder();
|
||||||
$qb->select('c.*')
|
$qb->select('c.*')
|
||||||
->from('deck_cards', 'c')
|
->from('deck_cards', 'c')
|
||||||
@@ -279,7 +325,10 @@ class CardMapper extends QBMapper implements IPermissionMapper {
|
|||||||
return $this->findEntities($qb);
|
return $this->findEntities($qb);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function findOverdue() {
|
/**
|
||||||
|
* @return Card[]
|
||||||
|
*/
|
||||||
|
public function findOverdue(): array {
|
||||||
$qb = $this->db->getQueryBuilder();
|
$qb = $this->db->getQueryBuilder();
|
||||||
$qb->select('id', 'title', 'duedate', 'notified')
|
$qb->select('id', 'title', 'duedate', 'notified')
|
||||||
->from('deck_cards')
|
->from('deck_cards')
|
||||||
@@ -291,6 +340,9 @@ class CardMapper extends QBMapper implements IPermissionMapper {
|
|||||||
return $this->findEntities($qb);
|
return $this->findEntities($qb);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Card[]
|
||||||
|
*/
|
||||||
public function findUnexposedDescriptionChances() {
|
public function findUnexposedDescriptionChances() {
|
||||||
$qb = $this->db->getQueryBuilder();
|
$qb = $this->db->getQueryBuilder();
|
||||||
$qb->select('id', 'title', 'duedate', 'notified', 'description_prev', 'last_editor', 'description')
|
$qb->select('id', 'title', 'duedate', 'notified', 'description_prev', 'last_editor', 'description')
|
||||||
@@ -299,6 +351,9 @@ class CardMapper extends QBMapper implements IPermissionMapper {
|
|||||||
return $this->findEntities($qb);
|
return $this->findEntities($qb);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Card[]
|
||||||
|
*/
|
||||||
public function search(array $boardIds, SearchQuery $query, ?int $limit = null, ?int $offset = null): array {
|
public function search(array $boardIds, SearchQuery $query, ?int $limit = null, ?int $offset = null): array {
|
||||||
$qb = $this->queryCardsByBoards($boardIds);
|
$qb = $this->queryCardsByBoards($boardIds);
|
||||||
$this->extendQueryByFilter($qb, $query);
|
$this->extendQueryByFilter($qb, $query);
|
||||||
@@ -333,7 +388,7 @@ class CardMapper extends QBMapper implements IPermissionMapper {
|
|||||||
$qb->andWhere($qb->expr()->lt('c.last_modified', $qb->createNamedParameter($offset, IQueryBuilder::PARAM_INT)));
|
$qb->andWhere($qb->expr()->lt('c.last_modified', $qb->createNamedParameter($offset, IQueryBuilder::PARAM_INT)));
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $qb->execute();
|
$result = $qb->executeQuery();
|
||||||
$entities = [];
|
$entities = [];
|
||||||
while ($row = $result->fetch()) {
|
while ($row = $result->fetch()) {
|
||||||
$entities[] = Card::fromRow($row);
|
$entities[] = Card::fromRow($row);
|
||||||
@@ -376,7 +431,7 @@ class CardMapper extends QBMapper implements IPermissionMapper {
|
|||||||
$qb->andWhere($qb->expr()->lt('comments.id', $qb->createNamedParameter($offset, IQueryBuilder::PARAM_INT)));
|
$qb->andWhere($qb->expr()->lt('comments.id', $qb->createNamedParameter($offset, IQueryBuilder::PARAM_INT)));
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $qb->execute();
|
$result = $qb->executeQuery();
|
||||||
$entities = $result->fetchAll();
|
$entities = $result->fetchAll();
|
||||||
$result->closeCursor();
|
$result->closeCursor();
|
||||||
return $entities;
|
return $entities;
|
||||||
@@ -472,7 +527,7 @@ class CardMapper extends QBMapper implements IPermissionMapper {
|
|||||||
});
|
});
|
||||||
$groups = $this->groupManager->search($assignment->getValue());
|
$groups = $this->groupManager->search($assignment->getValue());
|
||||||
foreach ($searchUsers as $user) {
|
foreach ($searchUsers as $user) {
|
||||||
$groups = array_merge($groups, $this->groupManager->getUserIdGroups($user->getUID()));
|
$groups = array_merge($groups, $this->groupManager->getUserGroups($user));
|
||||||
}
|
}
|
||||||
|
|
||||||
$assignmentSearches = [];
|
$assignmentSearches = [];
|
||||||
@@ -525,7 +580,7 @@ class CardMapper extends QBMapper implements IPermissionMapper {
|
|||||||
if ($offset !== null) {
|
if ($offset !== null) {
|
||||||
$qb->setFirstResult($offset);
|
$qb->setFirstResult($offset);
|
||||||
}
|
}
|
||||||
$result = $qb->execute();
|
$result = $qb->executeQuery();
|
||||||
$all = $result->fetchAll();
|
$all = $result->fetchAll();
|
||||||
$result->closeCursor();
|
$result->closeCursor();
|
||||||
return $all;
|
return $all;
|
||||||
@@ -537,32 +592,32 @@ class CardMapper extends QBMapper implements IPermissionMapper {
|
|||||||
return parent::delete($entity);
|
return parent::delete($entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function deleteByStack($stackId) {
|
public function deleteByStack($stackId): void {
|
||||||
$cards = $this->findAllByStack($stackId);
|
$cards = $this->findAllByStack($stackId);
|
||||||
foreach ($cards as $card) {
|
foreach ($cards as $card) {
|
||||||
$this->delete($card);
|
$this->delete($card);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function assignLabel($card, $label) {
|
public function assignLabel(int $card, int $label): void {
|
||||||
$qb = $this->db->getQueryBuilder();
|
$qb = $this->db->getQueryBuilder();
|
||||||
$qb->insert('deck_assigned_labels')
|
$qb->insert('deck_assigned_labels')
|
||||||
->values([
|
->values([
|
||||||
'label_id' => $qb->createNamedParameter($label, IQueryBuilder::PARAM_INT),
|
'label_id' => $qb->createNamedParameter($label, IQueryBuilder::PARAM_INT),
|
||||||
'card_id' => $qb->createNamedParameter($card, IQueryBuilder::PARAM_INT),
|
'card_id' => $qb->createNamedParameter($card, IQueryBuilder::PARAM_INT),
|
||||||
]);
|
]);
|
||||||
$qb->execute();
|
$qb->executeStatement();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function removeLabel($card, $label) {
|
public function removeLabel(int $card, int $label): void {
|
||||||
$qb = $this->db->getQueryBuilder();
|
$qb = $this->db->getQueryBuilder();
|
||||||
$qb->delete('deck_assigned_labels')
|
$qb->delete('deck_assigned_labels')
|
||||||
->where($qb->expr()->eq('card_id', $qb->createNamedParameter($card, IQueryBuilder::PARAM_INT)))
|
->where($qb->expr()->eq('card_id', $qb->createNamedParameter($card, IQueryBuilder::PARAM_INT)))
|
||||||
->andWhere($qb->expr()->eq('label_id', $qb->createNamedParameter($label, IQueryBuilder::PARAM_INT)));
|
->andWhere($qb->expr()->eq('label_id', $qb->createNamedParameter($label, IQueryBuilder::PARAM_INT)));
|
||||||
$qb->execute();
|
$qb->executeStatement();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isOwner($userId, $id): bool {
|
public function isOwner(string $userId, int $id): bool {
|
||||||
$qb = $this->db->getQueryBuilder();
|
$qb = $this->db->getQueryBuilder();
|
||||||
$qb->select('c.id')
|
$qb->select('c.id')
|
||||||
->from($this->getTableName(), 'c')
|
->from($this->getTableName(), 'c')
|
||||||
@@ -574,7 +629,7 @@ class CardMapper extends QBMapper implements IPermissionMapper {
|
|||||||
return count($qb->executeQuery()->fetchAll()) > 0;
|
return count($qb->executeQuery()->fetchAll()) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function findBoardId($id): ?int {
|
public function findBoardId(int $id): ?int {
|
||||||
$result = $this->cache->get('findBoardId:' . $id);
|
$result = $this->cache->get('findBoardId:' . $id);
|
||||||
if ($result === null) {
|
if ($result === null) {
|
||||||
try {
|
try {
|
||||||
@@ -604,13 +659,11 @@ class CardMapper extends QBMapper implements IPermissionMapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function transferOwnership(string $ownerId, string $newOwnerId, ?int $boardId = null): void {
|
public function transferOwnership(string $ownerId, string $newOwnerId, ?int $boardId = null): void {
|
||||||
$params = [
|
$qb = $this->db->getQueryBuilder();
|
||||||
'owner' => $ownerId,
|
$qb->update($this->getTableName())
|
||||||
'newOwner' => $newOwnerId
|
->set('owner', $qb->createNamedParameter($newOwnerId, IQueryBuilder::PARAM_STR))
|
||||||
];
|
->where('owner', $qb->createNamedParameter($ownerId, IQueryBuilder::PARAM_STR))
|
||||||
$sql = "UPDATE `*PREFIX*{$this->tableName}` SET `owner` = :newOwner WHERE `owner` = :owner";
|
->executeStatement();
|
||||||
$stmt = $this->db->executeQuery($sql, $params);
|
|
||||||
$stmt->closeCursor();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function remapCardOwner(int $boardId, string $userId, string $newUserId): void {
|
public function remapCardOwner(int $boardId, string $userId, string $newUserId): void {
|
||||||
|
|||||||
@@ -19,12 +19,11 @@ use OCP\DB\QueryBuilder\IQueryBuilder;
|
|||||||
abstract class DeckMapper extends QBMapper {
|
abstract class DeckMapper extends QBMapper {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $id
|
|
||||||
* @return T
|
* @return T
|
||||||
* @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException
|
* @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException
|
||||||
* @throws \OCP\AppFramework\Db\DoesNotExistException
|
* @throws \OCP\AppFramework\Db\DoesNotExistException
|
||||||
*/
|
*/
|
||||||
public function find($id) {
|
public function find(int $id): Entity {
|
||||||
$qb = $this->db->getQueryBuilder();
|
$qb = $this->db->getQueryBuilder();
|
||||||
$qb->select('*')
|
$qb->select('*')
|
||||||
->from($this->getTableName())
|
->from($this->getTableName())
|
||||||
@@ -37,7 +36,7 @@ abstract class DeckMapper extends QBMapper {
|
|||||||
* Helper function to split passed array into chunks of 1000 elements and
|
* Helper function to split passed array into chunks of 1000 elements and
|
||||||
* call a given callback for fetching query results
|
* call a given callback for fetching query results
|
||||||
*
|
*
|
||||||
* Can be useful to limit to 1000 results per query for oracle compatiblity
|
* Can be useful to limit to 1000 results per query for oracle compatibility
|
||||||
* but still iterate over all results
|
* but still iterate over all results
|
||||||
*/
|
*/
|
||||||
public function chunkQuery(array $ids, callable $callback): Generator {
|
public function chunkQuery(array $ids, callable $callback): Generator {
|
||||||
|
|||||||
@@ -8,22 +8,25 @@
|
|||||||
|
|
||||||
namespace OCA\Deck\Db;
|
namespace OCA\Deck\Db;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
interface IPermissionMapper {
|
interface IPermissionMapper {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if $userId is owner of Entity with $id
|
* Check if $userId is owner of Entity with $id
|
||||||
*
|
*
|
||||||
* @param $userId string userId
|
* @param $userId string userId
|
||||||
* @param $id int|string unique entity identifier
|
* @param $id int unique entity identifier
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function isOwner($userId, $id): bool;
|
public function isOwner(string $userId, int $id): bool;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Query boardId for Entity of given $id
|
* Query boardId for Entity of given $id
|
||||||
*
|
*
|
||||||
* @param $id int|string unique entity identifier
|
* @param $id int unique entity identifier
|
||||||
* @return int|null id of Board
|
* @return ?int id of Board
|
||||||
*/
|
*/
|
||||||
public function findBoardId($id): ?int;
|
public function findBoardId(int $id): ?int;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,16 @@
|
|||||||
namespace OCA\Deck\Db;
|
namespace OCA\Deck\Db;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @method getTitle(): string
|
* @method string getTitle()
|
||||||
|
* @method void setTitle(string $title)
|
||||||
|
* @method string getColor()
|
||||||
|
* @method void setColor(string $color)
|
||||||
|
* @method int getBoardId()
|
||||||
|
* @method void setBoardId(int $boardId)
|
||||||
|
* @method int getCardId()
|
||||||
|
* @method void setCardId(int $cardId)
|
||||||
|
* @method int getLastModified()
|
||||||
|
* @method void setLastModified(int $lastModified)
|
||||||
*/
|
*/
|
||||||
class Label extends RelationalEntity {
|
class Label extends RelationalEntity {
|
||||||
protected $title;
|
protected $title;
|
||||||
@@ -24,7 +33,7 @@ class Label extends RelationalEntity {
|
|||||||
$this->addType('lastModified', 'integer');
|
$this->addType('lastModified', 'integer');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getETag() {
|
public function getETag(): string {
|
||||||
return md5((string)$this->getLastModified());
|
return md5((string)$this->getLastModified());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,13 +20,10 @@ class LabelMapper extends DeckMapper implements IPermissionMapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param numeric $boardId
|
|
||||||
* @param int|null $limit
|
|
||||||
* @param int|null $offset
|
|
||||||
* @return Label[]
|
* @return Label[]
|
||||||
* @throws \OCP\DB\Exception
|
* @throws \OCP\DB\Exception
|
||||||
*/
|
*/
|
||||||
public function findAll($boardId, $limit = null, $offset = null): array {
|
public function findAll(int $boardId, ?int $limit = null, int $offset = 0): array {
|
||||||
$qb = $this->db->getQueryBuilder();
|
$qb = $this->db->getQueryBuilder();
|
||||||
$qb->select('*')
|
$qb->select('*')
|
||||||
->from($this->getTableName())
|
->from($this->getTableName())
|
||||||
@@ -44,13 +41,10 @@ class LabelMapper extends DeckMapper implements IPermissionMapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param numeric $cardId
|
|
||||||
* @param int|null $limit
|
|
||||||
* @param int|null $offset
|
|
||||||
* @return Label[]
|
* @return Label[]
|
||||||
* @throws \OCP\DB\Exception
|
* @throws \OCP\DB\Exception
|
||||||
*/
|
*/
|
||||||
public function findAssignedLabelsForCard($cardId, $limit = null, $offset = null): array {
|
public function findAssignedLabelsForCard(int $cardId, ?int $limit = null, int $offset = 0): array {
|
||||||
$qb = $this->db->getQueryBuilder();
|
$qb = $this->db->getQueryBuilder();
|
||||||
$qb->select('l.*', 'card_id')
|
$qb->select('l.*', 'card_id')
|
||||||
->from($this->getTableName(), 'l')
|
->from($this->getTableName(), 'l')
|
||||||
@@ -63,7 +57,7 @@ class LabelMapper extends DeckMapper implements IPermissionMapper {
|
|||||||
return $this->findEntities($qb);
|
return $this->findEntities($qb);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function findAssignedLabelsForCards($cardIds, $limit = null, $offset = null): array {
|
public function findAssignedLabelsForCards(array $cardIds, ?int $limit = null, int $offset = 0): array {
|
||||||
$qb = $this->db->getQueryBuilder();
|
$qb = $this->db->getQueryBuilder();
|
||||||
$qb->select('l.*', 'card_id')
|
$qb->select('l.*', 'card_id')
|
||||||
->from($this->getTableName(), 'l')
|
->from($this->getTableName(), 'l')
|
||||||
@@ -77,13 +71,10 @@ class LabelMapper extends DeckMapper implements IPermissionMapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param numeric $boardId
|
|
||||||
* @param int|null $limit
|
|
||||||
* @param int|null $offset
|
|
||||||
* @return Label[]
|
* @return Label[]
|
||||||
* @throws \OCP\DB\Exception
|
* @throws \OCP\DB\Exception
|
||||||
*/
|
*/
|
||||||
public function findAssignedLabelsForBoard($boardId, $limit = null, $offset = null): array {
|
public function findAssignedLabelsForBoard(int $boardId, ?int $limit = null, int $offset = 0): array {
|
||||||
$qb = $this->db->getQueryBuilder();
|
$qb = $this->db->getQueryBuilder();
|
||||||
$qb->select('l.id as id', 'l.title as title', 'l.color as color')
|
$qb->select('l.id as id', 'l.title as title', 'l.color as color')
|
||||||
->selectAlias('c.id', 'card_id')
|
->selectAlias('c.id', 'card_id')
|
||||||
@@ -113,11 +104,10 @@ class LabelMapper extends DeckMapper implements IPermissionMapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param numeric $boardId
|
* @return array<int, list<Label>>
|
||||||
* @return array
|
|
||||||
* @throws \OCP\DB\Exception
|
* @throws \OCP\DB\Exception
|
||||||
*/
|
*/
|
||||||
public function getAssignedLabelsForBoard($boardId) {
|
public function getAssignedLabelsForBoard(int $boardId): array {
|
||||||
$labels = $this->findAssignedLabelsForBoard($boardId);
|
$labels = $this->findAssignedLabelsForBoard($boardId);
|
||||||
$result = [];
|
$result = [];
|
||||||
foreach ($labels as $label) {
|
foreach ($labels as $label) {
|
||||||
@@ -130,11 +120,9 @@ class LabelMapper extends DeckMapper implements IPermissionMapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param numeric $labelId
|
|
||||||
* @return void
|
|
||||||
* @throws \OCP\DB\Exception
|
* @throws \OCP\DB\Exception
|
||||||
*/
|
*/
|
||||||
public function deleteLabelAssignments($labelId) {
|
public function deleteLabelAssignments(int $labelId): void {
|
||||||
$qb = $this->db->getQueryBuilder();
|
$qb = $this->db->getQueryBuilder();
|
||||||
$qb->delete('deck_assigned_labels')
|
$qb->delete('deck_assigned_labels')
|
||||||
->where($qb->expr()->eq('label_id', $qb->createNamedParameter($labelId, IQueryBuilder::PARAM_INT)));
|
->where($qb->expr()->eq('label_id', $qb->createNamedParameter($labelId, IQueryBuilder::PARAM_INT)));
|
||||||
@@ -142,11 +130,9 @@ class LabelMapper extends DeckMapper implements IPermissionMapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param numeric $cardId
|
|
||||||
* @return void
|
|
||||||
* @throws \OCP\DB\Exception
|
* @throws \OCP\DB\Exception
|
||||||
*/
|
*/
|
||||||
public function deleteLabelAssignmentsForCard($cardId) {
|
public function deleteLabelAssignmentsForCard(int $cardId): void {
|
||||||
$qb = $this->db->getQueryBuilder();
|
$qb = $this->db->getQueryBuilder();
|
||||||
$qb->delete('deck_assigned_labels')
|
$qb->delete('deck_assigned_labels')
|
||||||
->where($qb->expr()->eq('card_id', $qb->createNamedParameter($cardId, IQueryBuilder::PARAM_INT)));
|
->where($qb->expr()->eq('card_id', $qb->createNamedParameter($cardId, IQueryBuilder::PARAM_INT)));
|
||||||
@@ -154,33 +140,25 @@ class LabelMapper extends DeckMapper implements IPermissionMapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $userId
|
|
||||||
* @param numeric $labelId
|
|
||||||
* @return bool
|
|
||||||
* @throws \OCP\DB\Exception
|
* @throws \OCP\DB\Exception
|
||||||
*/
|
*/
|
||||||
public function isOwner($userId, $labelId): bool {
|
public function isOwner(string $userId, int $id): bool {
|
||||||
$qb = $this->db->getQueryBuilder();
|
$qb = $this->db->getQueryBuilder();
|
||||||
$qb->select('l.id')
|
$qb->select('l.id')
|
||||||
->from($this->getTableName(), 'l')
|
->from($this->getTableName(), 'l')
|
||||||
->innerJoin('l', 'deck_boards', 'b', 'l.board_id = b.id')
|
->innerJoin('l', 'deck_boards', 'b', 'l.board_id = b.id')
|
||||||
->where($qb->expr()->eq('l.id', $qb->createNamedParameter($labelId, IQueryBuilder::PARAM_INT)))
|
->where($qb->expr()->eq('l.id', $qb->createNamedParameter($id, IQueryBuilder::PARAM_INT)))
|
||||||
->andWhere($qb->expr()->eq('b.owner', $qb->createNamedParameter($userId, IQueryBuilder::PARAM_STR)));
|
->andWhere($qb->expr()->eq('b.owner', $qb->createNamedParameter($userId, IQueryBuilder::PARAM_STR)));
|
||||||
|
|
||||||
return count($qb->executeQuery()->fetchAll()) > 0;
|
return count($qb->executeQuery()->fetchAll()) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function findBoardId(int $id): ?int {
|
||||||
* @param numeric $id
|
|
||||||
* @return int|null
|
|
||||||
*/
|
|
||||||
public function findBoardId($id): ?int {
|
|
||||||
try {
|
try {
|
||||||
$entity = $this->find($id);
|
$entity = $this->find($id);
|
||||||
return $entity->getBoardId();
|
return $entity->getBoardId();
|
||||||
} catch (DoesNotExistException $e) {
|
} catch (DoesNotExistException|MultipleObjectsReturnedException) {
|
||||||
} catch (MultipleObjectsReturnedException $e) {
|
return null;
|
||||||
}
|
}
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,10 +11,17 @@ use Sabre\VObject\Component\VCalendar;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @method int getId()
|
* @method int getId()
|
||||||
|
* @method string getTitle()
|
||||||
|
* @method void setTitle(string $title)
|
||||||
* @method int getBoardId()
|
* @method int getBoardId()
|
||||||
|
* @method void setBoardId(int $boardId)
|
||||||
* @method int getDeletedAt()
|
* @method int getDeletedAt()
|
||||||
|
* @method void setDeletedAt(int $deletedAt)
|
||||||
* @method int getLastModified()
|
* @method int getLastModified()
|
||||||
* @method int getOrder()
|
* @method void setLastModified(int $lastModified)
|
||||||
|
* @method \int getOrder()
|
||||||
|
* @method void setOrder(int $order)
|
||||||
|
* @method Card[] getCards()
|
||||||
*/
|
*/
|
||||||
class Stack extends RelationalEntity {
|
class Stack extends RelationalEntity {
|
||||||
protected $title;
|
protected $title;
|
||||||
|
|||||||
@@ -35,13 +35,11 @@ class StackMapper extends DeckMapper implements IPermissionMapper {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param numeric $id
|
|
||||||
* @return Stack
|
|
||||||
* @throws DoesNotExistException
|
* @throws DoesNotExistException
|
||||||
* @throws MultipleObjectsReturnedException
|
* @throws MultipleObjectsReturnedException
|
||||||
* @throws \OCP\DB\Exception
|
* @throws \OCP\DB\Exception
|
||||||
*/
|
*/
|
||||||
public function find($id): Stack {
|
public function find(int $id): Stack {
|
||||||
if (isset($this->stackCache[(string)$id])) {
|
if (isset($this->stackCache[(string)$id])) {
|
||||||
return $this->stackCache[(string)$id];
|
return $this->stackCache[(string)$id];
|
||||||
}
|
}
|
||||||
@@ -56,11 +54,9 @@ class StackMapper extends DeckMapper implements IPermissionMapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $cardId
|
|
||||||
* @return Stack|null
|
|
||||||
* @throws \OCP\DB\Exception
|
* @throws \OCP\DB\Exception
|
||||||
*/
|
*/
|
||||||
public function findStackFromCardId($cardId): ?Stack {
|
public function findStackFromCardId(int $cardId): ?Stack {
|
||||||
$qb = $this->db->getQueryBuilder();
|
$qb = $this->db->getQueryBuilder();
|
||||||
$qb->select('s.*')
|
$qb->select('s.*')
|
||||||
->from($this->getTableName(), 's')
|
->from($this->getTableName(), 's')
|
||||||
@@ -76,13 +72,10 @@ class StackMapper extends DeckMapper implements IPermissionMapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param numeric $boardId
|
|
||||||
* @param int|null $limit
|
|
||||||
* @param int|null $offset
|
|
||||||
* @return Stack[]
|
* @return Stack[]
|
||||||
* @throws \OCP\DB\Exception
|
* @throws \OCP\DB\Exception
|
||||||
*/
|
*/
|
||||||
public function findAll($boardId, $limit = null, $offset = null): array {
|
public function findAll(int $boardId, ?int $limit = null, int $offset = 0): array {
|
||||||
$qb = $this->db->getQueryBuilder();
|
$qb = $this->db->getQueryBuilder();
|
||||||
$qb->select('*')
|
$qb->select('*')
|
||||||
->from($this->getTableName())
|
->from($this->getTableName())
|
||||||
@@ -95,13 +88,9 @@ class StackMapper extends DeckMapper implements IPermissionMapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param numeric $boardId
|
|
||||||
* @param int|null $limit
|
|
||||||
* @param int|null $offset
|
|
||||||
* @return Stack[]
|
|
||||||
* @throws \OCP\DB\Exception
|
* @throws \OCP\DB\Exception
|
||||||
*/
|
*/
|
||||||
public function findDeleted($boardId, $limit = null, $offset = null) {
|
public function findDeleted(int $boardId, ?int $limit = null, int $offset = 0): array {
|
||||||
$qb = $this->db->getQueryBuilder();
|
$qb = $this->db->getQueryBuilder();
|
||||||
$qb->select('*')
|
$qb->select('*')
|
||||||
->from($this->getTableName())
|
->from($this->getTableName())
|
||||||
@@ -127,12 +116,9 @@ class StackMapper extends DeckMapper implements IPermissionMapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param numeric $userId
|
|
||||||
* @param numeric $stackId
|
|
||||||
* @return bool
|
|
||||||
* @throws \OCP\DB\Exception
|
* @throws \OCP\DB\Exception
|
||||||
*/
|
*/
|
||||||
public function isOwner($userId, $id): bool {
|
public function isOwner(string $userId, int $id): bool {
|
||||||
$qb = $this->db->getQueryBuilder();
|
$qb = $this->db->getQueryBuilder();
|
||||||
$qb->select('s.id')
|
$qb->select('s.id')
|
||||||
->from($this->getTableName(), 's')
|
->from($this->getTableName(), 's')
|
||||||
@@ -144,11 +130,9 @@ class StackMapper extends DeckMapper implements IPermissionMapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param numeric $id
|
|
||||||
* @return int|null
|
|
||||||
* @throws \OCP\DB\Exception
|
* @throws \OCP\DB\Exception
|
||||||
*/
|
*/
|
||||||
public function findBoardId($id): ?int {
|
public function findBoardId(int $id): ?int {
|
||||||
$result = $this->cache->get('findBoardId:' . $id);
|
$result = $this->cache->get('findBoardId:' . $id);
|
||||||
if ($result !== null) {
|
if ($result !== null) {
|
||||||
return $result !== false ? $result : null;
|
return $result !== false ? $result : null;
|
||||||
@@ -165,6 +149,10 @@ class StackMapper extends DeckMapper implements IPermissionMapper {
|
|||||||
return $result !== false ? $result : null;
|
return $result !== false ? $result : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array<Stack>
|
||||||
|
* @throws \OCP\DB\Exception
|
||||||
|
*/
|
||||||
public function findToDelete(): array {
|
public function findToDelete(): array {
|
||||||
// add buffer of 5 min
|
// add buffer of 5 min
|
||||||
$timeLimit = time() - (60 * 5);
|
$timeLimit = time() - (60 * 5);
|
||||||
|
|||||||
@@ -35,6 +35,10 @@ class BeforeTemplateRenderedListener implements IEventListener {
|
|||||||
Util::addStyle('deck', 'deck');
|
Util::addStyle('deck', 'deck');
|
||||||
|
|
||||||
$pathInfo = $this->request->getPathInfo();
|
$pathInfo = $this->request->getPathInfo();
|
||||||
|
if (!$pathInfo) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (str_starts_with($pathInfo, '/apps/calendar')) {
|
if (str_starts_with($pathInfo, '/apps/calendar')) {
|
||||||
Util::addScript('deck', 'deck-calendar');
|
Util::addScript('deck', 'deck-calendar');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,14 +18,10 @@ use OCP\EventDispatcher\IEventListener;
|
|||||||
/** @template-implements IEventListener<Event|AclDeletedEvent|AclCreatedEvent> */
|
/** @template-implements IEventListener<Event|AclDeletedEvent|AclCreatedEvent> */
|
||||||
class ResourceListener implements IEventListener {
|
class ResourceListener implements IEventListener {
|
||||||
|
|
||||||
/** @var IManager */
|
public function __construct(
|
||||||
private $resourceManager;
|
private readonly IManager $resourceManager,
|
||||||
/** @var ResourceProviderCard */
|
private readonly ResourceProviderCard $resourceProviderCard,
|
||||||
private $resourceProviderCard;
|
) {
|
||||||
|
|
||||||
public function __construct(IManager $resourceManager, ResourceProviderCard $resourceProviderCard) {
|
|
||||||
$this->resourceManager = $resourceManager;
|
|
||||||
$this->resourceProviderCard = $resourceProviderCard;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function handle(Event $event): void {
|
public function handle(Event $event): void {
|
||||||
@@ -38,10 +34,10 @@ class ResourceListener implements IEventListener {
|
|||||||
$this->resourceManager->invalidateAccessCacheForProvider($this->resourceProviderCard);
|
$this->resourceManager->invalidateAccessCacheForProvider($this->resourceProviderCard);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$resource = $this->resourceManager->getResourceForUser(ResourceProvider::RESOURCE_TYPE, $boardId, null);
|
$resource = $this->resourceManager->getResourceForUser(ResourceProvider::RESOURCE_TYPE, (string)$boardId, null);
|
||||||
$this->resourceManager->invalidateAccessCacheForResource($resource);
|
$this->resourceManager->invalidateAccessCacheForResource($resource);
|
||||||
} catch (ResourceException $e) {
|
} catch (ResourceException $e) {
|
||||||
// If there is no resource we don't need to invalidate anything, but this should not happen anyways
|
// If there is no resource we don't need to invalidate anything, but this should not happen anyway
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ use OCA\Deck\Db\Board;
|
|||||||
class BoardSummary extends Board {
|
class BoardSummary extends Board {
|
||||||
private Board $board;
|
private Board $board;
|
||||||
|
|
||||||
|
/** @psalm-suppress ConstructorSignatureMismatch */
|
||||||
public function __construct(Board $board) {
|
public function __construct(Board $board) {
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
$this->board = $board;
|
$this->board = $board;
|
||||||
@@ -27,7 +28,7 @@ class BoardSummary extends Board {
|
|||||||
return $this->board->getter($name);
|
return $this->board->getter($name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function __call($name, $arguments) {
|
public function __call($methodName, $args) {
|
||||||
return $this->board->__call($name, $arguments);
|
return $this->board->__call($methodName, $args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ class CardDetails extends Card {
|
|||||||
private ?Board $board;
|
private ?Board $board;
|
||||||
private ?Reference $referenceData = null;
|
private ?Reference $referenceData = null;
|
||||||
|
|
||||||
|
/** @psalm-suppress ConstructorSignatureMismatch */
|
||||||
public function __construct(Card $card, ?Board $board = null) {
|
public function __construct(Card $card, ?Board $board = null) {
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
$this->card = $card;
|
$this->card = $card;
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ class NotificationHelper {
|
|||||||
|
|
||||||
$shouldNotify = $notificationSetting === ConfigService::SETTING_BOARD_NOTIFICATION_DUE_ALL;
|
$shouldNotify = $notificationSetting === ConfigService::SETTING_BOARD_NOTIFICATION_DUE_ALL;
|
||||||
|
|
||||||
if ($user->getUID() === $board->getOwner() && count($board->getAcl()) === 0) {
|
if ($user->getUID() === $board->getOwner() && count($board->getAcl() ?? []) === 0) {
|
||||||
// Notify if all or assigned is configured for unshared boards
|
// Notify if all or assigned is configured for unshared boards
|
||||||
$shouldNotify = true;
|
$shouldNotify = true;
|
||||||
} elseif ($notificationSetting === ConfigService::SETTING_BOARD_NOTIFICATION_DUE_ASSIGNED && $this->assignmentMapper->isUserAssigned($card->getId(), $user->getUID())) {
|
} elseif ($notificationSetting === ConfigService::SETTING_BOARD_NOTIFICATION_DUE_ASSIGNED && $this->assignmentMapper->isUserAssigned($card->getId(), $user->getUID())) {
|
||||||
|
|||||||
@@ -64,6 +64,7 @@ class BoardReferenceProvider implements IReferenceProvider {
|
|||||||
$reference = new Reference($referenceText);
|
$reference = new Reference($referenceText);
|
||||||
$reference->setTitle($this->l10n->t('Deck board') . ': ' . $board['title']);
|
$reference->setTitle($this->l10n->t('Deck board') . ': ' . $board['title']);
|
||||||
$ownerDisplayName = $board['owner']['displayname'] ?? $board['owner']['uid'] ?? '???';
|
$ownerDisplayName = $board['owner']['displayname'] ?? $board['owner']['uid'] ?? '???';
|
||||||
|
// TRANSLATORS Owned by {boardOwnerName}
|
||||||
$reference->setDescription($this->l10n->t('Owned by %1$s', [$ownerDisplayName]));
|
$reference->setDescription($this->l10n->t('Owned by %1$s', [$ownerDisplayName]));
|
||||||
$imageUrl = $this->urlGenerator->getAbsoluteURL(
|
$imageUrl = $this->urlGenerator->getAbsoluteURL(
|
||||||
$this->urlGenerator->imagePath(Application::APP_ID, 'deck-dark.svg')
|
$this->urlGenerator->imagePath(Application::APP_ID, 'deck-dark.svg')
|
||||||
|
|||||||
@@ -90,6 +90,7 @@ class CommentReferenceProvider implements IReferenceProvider {
|
|||||||
$reference->setTitle($comment['message']);
|
$reference->setTitle($comment['message']);
|
||||||
$boardOwnerDisplayName = $board['owner']['displayname'] ?? $board['owner']['uid'] ?? '???';
|
$boardOwnerDisplayName = $board['owner']['displayname'] ?? $board['owner']['uid'] ?? '???';
|
||||||
$reference->setDescription(
|
$reference->setDescription(
|
||||||
|
// TRANSLATORS From {userName}, in {boardTitle}/{stackTitle}, owned by {boardOwnerName}
|
||||||
$this->l10n->t('From %1$s, in %2$s/%3$s, owned by %4$s', [
|
$this->l10n->t('From %1$s, in %2$s/%3$s, owned by %4$s', [
|
||||||
$comment['actorDisplayName'],
|
$comment['actorDisplayName'],
|
||||||
$board['title'],
|
$board['title'],
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ use OCA\Deck\NotFoundException;
|
|||||||
use OCA\Deck\Notification\NotificationHelper;
|
use OCA\Deck\Notification\NotificationHelper;
|
||||||
use OCA\Deck\Validators\AssignmentServiceValidator;
|
use OCA\Deck\Validators\AssignmentServiceValidator;
|
||||||
use OCP\AppFramework\Db\DoesNotExistException;
|
use OCP\AppFramework\Db\DoesNotExistException;
|
||||||
use OCP\AppFramework\Db\Entity;
|
|
||||||
use OCP\AppFramework\Db\MultipleObjectsReturnedException;
|
use OCP\AppFramework\Db\MultipleObjectsReturnedException;
|
||||||
use OCP\EventDispatcher\IEventDispatcher;
|
use OCP\EventDispatcher\IEventDispatcher;
|
||||||
|
|
||||||
@@ -92,15 +91,12 @@ class AssignmentService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $cardId
|
|
||||||
* @param $userId
|
|
||||||
* @return bool|null|Entity
|
|
||||||
* @throws BadRequestException
|
* @throws BadRequestException
|
||||||
* @throws NoPermissionException
|
* @throws NoPermissionException
|
||||||
* @throws MultipleObjectsReturnedException
|
* @throws MultipleObjectsReturnedException
|
||||||
* @throws DoesNotExistException
|
* @throws DoesNotExistException
|
||||||
*/
|
*/
|
||||||
public function assignUser($cardId, $userId, int $type = Assignment::TYPE_USER) {
|
public function assignUser(int $cardId, string $userId, int $type = Assignment::TYPE_USER): Assignment {
|
||||||
$this->assignmentServiceValidator->check(compact('cardId', 'userId'));
|
$this->assignmentServiceValidator->check(compact('cardId', 'userId'));
|
||||||
|
|
||||||
if ($type !== Assignment::TYPE_USER && $type !== Assignment::TYPE_GROUP) {
|
if ($type !== Assignment::TYPE_USER && $type !== Assignment::TYPE_GROUP) {
|
||||||
@@ -144,16 +140,13 @@ class AssignmentService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $cardId
|
|
||||||
* @param $userId
|
|
||||||
* @return Entity
|
|
||||||
* @throws BadRequestException
|
* @throws BadRequestException
|
||||||
* @throws NotFoundException
|
* @throws NotFoundException
|
||||||
* @throws NoPermissionException
|
* @throws NoPermissionException
|
||||||
* @throws DoesNotExistException
|
* @throws DoesNotExistException
|
||||||
* @throws MultipleObjectsReturnedException
|
* @throws MultipleObjectsReturnedException
|
||||||
*/
|
*/
|
||||||
public function unassignUser($cardId, $userId, $type = 0) {
|
public function unassignUser(int $cardId, string $userId, int $type = 0): Assignment {
|
||||||
$this->assignmentServiceValidator->check(compact('cardId', 'userId'));
|
$this->assignmentServiceValidator->check(compact('cardId', 'userId'));
|
||||||
$this->permissionService->checkPermission($this->cardMapper, $cardId, Acl::PERMISSION_EDIT);
|
$this->permissionService->checkPermission($this->cardMapper, $cardId, Acl::PERMISSION_EDIT);
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ use OCP\AppFramework\Db\IMapperException;
|
|||||||
use OCP\AppFramework\Http\Response;
|
use OCP\AppFramework\Http\Response;
|
||||||
use OCP\IL10N;
|
use OCP\IL10N;
|
||||||
use OCP\IUserManager;
|
use OCP\IUserManager;
|
||||||
|
use Psr\Container\ContainerExceptionInterface;
|
||||||
|
|
||||||
class AttachmentService {
|
class AttachmentService {
|
||||||
private $attachmentMapper;
|
private $attachmentMapper;
|
||||||
@@ -80,20 +81,16 @@ class AttachmentService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $type
|
* @throws ContainerExceptionInterface
|
||||||
* @param string $class
|
|
||||||
* @throws \OCP\AppFramework\QueryException
|
|
||||||
*/
|
*/
|
||||||
public function registerAttachmentService($type, $class) {
|
public function registerAttachmentService(string $type, string $class): void {
|
||||||
$this->services[$type] = $this->application->getContainer()->query($class);
|
$this->services[$type] = $this->application->getContainer()->get($class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $type
|
|
||||||
* @return IAttachmentService
|
|
||||||
* @throws InvalidAttachmentType
|
* @throws InvalidAttachmentType
|
||||||
*/
|
*/
|
||||||
public function getService($type) {
|
public function getService(string $type): IAttachmentService {
|
||||||
if (isset($this->services[$type])) {
|
if (isset($this->services[$type])) {
|
||||||
return $this->services[$type];
|
return $this->services[$type];
|
||||||
}
|
}
|
||||||
@@ -101,16 +98,11 @@ class AttachmentService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $cardId
|
* @return Attachment[]
|
||||||
* @return array
|
|
||||||
* @throws \OCA\Deck\NoPermissionException
|
* @throws \OCA\Deck\NoPermissionException
|
||||||
* @throws BadRequestException
|
* @throws BadRequestException
|
||||||
*/
|
*/
|
||||||
public function findAll($cardId, $withDeleted = false) {
|
public function findAll(int $cardId, bool $withDeleted = false): array {
|
||||||
if (is_numeric($cardId) === false) {
|
|
||||||
throw new BadRequestException('card id must be a number');
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->permissionService->checkPermission($this->cardMapper, $cardId, Acl::PERMISSION_READ);
|
$this->permissionService->checkPermission($this->cardMapper, $cardId, Acl::PERMISSION_READ);
|
||||||
|
|
||||||
$attachments = $this->attachmentMapper->findAll($cardId);
|
$attachments = $this->attachmentMapper->findAll($cardId);
|
||||||
@@ -122,7 +114,7 @@ class AttachmentService {
|
|||||||
/** @var IAttachmentService $service */
|
/** @var IAttachmentService $service */
|
||||||
$service = $this->getService($attachmentType);
|
$service = $this->getService($attachmentType);
|
||||||
if ($service instanceof ICustomAttachmentService) {
|
if ($service instanceof ICustomAttachmentService) {
|
||||||
$attachments = array_merge($attachments, $service->listAttachments((int)$cardId));
|
$attachments = array_merge($attachments, $service->listAttachments($cardId));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -140,49 +132,40 @@ class AttachmentService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $cardId
|
|
||||||
* @return int|mixed
|
|
||||||
* @throws BadRequestException
|
* @throws BadRequestException
|
||||||
* @throws InvalidAttachmentType
|
* @throws InvalidAttachmentType
|
||||||
* @throws \OCP\DB\Exception
|
* @throws \OCP\DB\Exception
|
||||||
*/
|
*/
|
||||||
public function count($cardId) {
|
public function count(int $cardId): int {
|
||||||
if (is_numeric($cardId) === false) {
|
$count = $this->attachmentCacheHelper->getAttachmentCount($cardId);
|
||||||
throw new BadRequestException('card id must be a number');
|
|
||||||
}
|
|
||||||
|
|
||||||
$count = $this->attachmentCacheHelper->getAttachmentCount((int)$cardId);
|
|
||||||
if ($count === null) {
|
if ($count === null) {
|
||||||
$count = count($this->attachmentMapper->findAll($cardId));
|
$count = count($this->attachmentMapper->findAll($cardId));
|
||||||
|
|
||||||
foreach (array_keys($this->services) as $attachmentType) {
|
foreach (array_keys($this->services) as $attachmentType) {
|
||||||
$service = $this->getService($attachmentType);
|
$service = $this->getService($attachmentType);
|
||||||
if ($service instanceof ICustomAttachmentService) {
|
if ($service instanceof ICustomAttachmentService) {
|
||||||
$count += $service->getAttachmentCount((int)$cardId);
|
$count += $service->getAttachmentCount($cardId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->attachmentCacheHelper->setAttachmentCount((int)$cardId, $count);
|
$this->attachmentCacheHelper->setAttachmentCount($cardId, $count);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $count;
|
return $count;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $cardId
|
|
||||||
* @param $type
|
|
||||||
* @param $data
|
|
||||||
* @return Attachment|\OCP\AppFramework\Db\Entity
|
* @return Attachment|\OCP\AppFramework\Db\Entity
|
||||||
* @throws NoPermissionException
|
* @throws NoPermissionException
|
||||||
* @throws StatusException
|
* @throws StatusException
|
||||||
* @throws BadRequestException
|
* @throws BadRequestException
|
||||||
*/
|
*/
|
||||||
public function create($cardId, $type, $data) {
|
public function create(int $cardId, string $type, string $data) {
|
||||||
$this->attachmentServiceValidator->check(compact('cardId', 'type'));
|
$this->attachmentServiceValidator->check(compact('cardId', 'type'));
|
||||||
|
|
||||||
$this->permissionService->checkPermission($this->cardMapper, $cardId, Acl::PERMISSION_EDIT);
|
$this->permissionService->checkPermission($this->cardMapper, $cardId, Acl::PERMISSION_EDIT);
|
||||||
|
|
||||||
$this->attachmentCacheHelper->clearAttachmentCount((int)$cardId);
|
$this->attachmentCacheHelper->clearAttachmentCount($cardId);
|
||||||
$attachment = new Attachment();
|
$attachment = new Attachment();
|
||||||
$attachment->setCardId($cardId);
|
$attachment->setCardId($cardId);
|
||||||
$attachment->setType($type);
|
$attachment->setType($type);
|
||||||
@@ -218,12 +201,10 @@ class AttachmentService {
|
|||||||
/**
|
/**
|
||||||
* Display the attachment
|
* Display the attachment
|
||||||
*
|
*
|
||||||
* @param $attachmentId
|
|
||||||
* @return Response
|
|
||||||
* @throws NoPermissionException
|
* @throws NoPermissionException
|
||||||
* @throws NotFoundException
|
* @throws NotFoundException
|
||||||
*/
|
*/
|
||||||
public function display($cardId, $attachmentId, $type = 'deck_file') {
|
public function display(int $cardId, int $attachmentId, string $type = 'deck_file'): Response {
|
||||||
try {
|
try {
|
||||||
$service = $this->getService($type);
|
$service = $this->getService($type);
|
||||||
} catch (InvalidAttachmentType $e) {
|
} catch (InvalidAttachmentType $e) {
|
||||||
@@ -257,13 +238,10 @@ class AttachmentService {
|
|||||||
/**
|
/**
|
||||||
* Update an attachment with custom data
|
* Update an attachment with custom data
|
||||||
*
|
*
|
||||||
* @param $attachmentId
|
|
||||||
* @param $data
|
|
||||||
* @return mixed
|
|
||||||
* @throws BadRequestException
|
* @throws BadRequestException
|
||||||
* @throws NoPermissionException
|
* @throws NoPermissionException
|
||||||
*/
|
*/
|
||||||
public function update($cardId, $attachmentId, $data, $type = 'deck_file') {
|
public function update(int $cardId, int $attachmentId, string $data, string $type = 'deck_file'): Attachment {
|
||||||
$this->attachmentServiceValidator->check(compact('cardId', 'type', 'data'));
|
$this->attachmentServiceValidator->check(compact('cardId', 'type', 'data'));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -384,8 +362,6 @@ class AttachmentService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Attachment $attachment
|
|
||||||
* @return Attachment
|
|
||||||
* @throws \ReflectionException
|
* @throws \ReflectionException
|
||||||
*/
|
*/
|
||||||
private function addCreator(Attachment $attachment): Attachment {
|
private function addCreator(Attachment $attachment): Attachment {
|
||||||
|
|||||||
@@ -75,8 +75,6 @@ class BoardService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set a different user than the current one, e.g. when no user is available in occ
|
* Set a different user than the current one, e.g. when no user is available in occ
|
||||||
*
|
|
||||||
* @param string $userId
|
|
||||||
*/
|
*/
|
||||||
public function setUserId(string $userId): void {
|
public function setUserId(string $userId): void {
|
||||||
$this->userId = $userId;
|
$this->userId = $userId;
|
||||||
@@ -117,22 +115,18 @@ class BoardService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$this->permissionService->checkPermission($this->boardMapper, $boardId, Acl::PERMISSION_READ);
|
$this->permissionService->checkPermission($this->boardMapper, $boardId, Acl::PERMISSION_READ);
|
||||||
/** @var Board $board */
|
|
||||||
$board = $this->boardMapper->find($boardId, true, true, $allowDeleted);
|
$board = $this->boardMapper->find($boardId, true, true, $allowDeleted);
|
||||||
[$board] = $this->enrichBoards([$board], $fullDetails);
|
[$board] = $this->enrichBoards([$board], $fullDetails);
|
||||||
return $board;
|
return $board;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $mapper
|
|
||||||
* @param $id
|
|
||||||
* @return bool
|
|
||||||
* @throws DoesNotExistException
|
* @throws DoesNotExistException
|
||||||
* @throws NoPermissionException
|
* @throws NoPermissionException
|
||||||
* @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException
|
* @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException
|
||||||
* @throws BadRequestException
|
* @throws BadRequestException
|
||||||
*/
|
*/
|
||||||
public function isArchived($mapper, $id) {
|
public function isArchived($mapper, int $id): bool {
|
||||||
$this->boardServiceValidator->check(compact('id'));
|
$this->boardServiceValidator->check(compact('id'));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -151,15 +145,12 @@ class BoardService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $mapper
|
|
||||||
* @param $id
|
|
||||||
* @return bool
|
|
||||||
* @throws DoesNotExistException
|
* @throws DoesNotExistException
|
||||||
* @throws NoPermissionException
|
* @throws NoPermissionException
|
||||||
* @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException
|
* @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException
|
||||||
* @throws BadRequestException
|
* @throws BadRequestException
|
||||||
*/
|
*/
|
||||||
public function isDeleted($mapper, $id) {
|
public function isDeleted($mapper, int $id): bool {
|
||||||
$this->boardServiceValidator->check(compact('mapper', 'id'));
|
$this->boardServiceValidator->check(compact('mapper', 'id'));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -179,13 +170,9 @@ class BoardService {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $title
|
|
||||||
* @param $userId
|
|
||||||
* @param $color
|
|
||||||
* @return \OCP\AppFramework\Db\Entity
|
|
||||||
* @throws BadRequestException
|
* @throws BadRequestException
|
||||||
*/
|
*/
|
||||||
public function create($title, $userId, $color) {
|
public function create(string $title, string $userId, string $color): Board {
|
||||||
$this->boardServiceValidator->check(compact('title', 'userId', 'color'));
|
$this->boardServiceValidator->check(compact('title', 'userId', 'color'));
|
||||||
|
|
||||||
if (!$this->permissionService->canCreate()) {
|
if (!$this->permissionService->canCreate()) {
|
||||||
@@ -196,7 +183,8 @@ class BoardService {
|
|||||||
$board->setTitle($title);
|
$board->setTitle($title);
|
||||||
$board->setOwner($userId);
|
$board->setOwner($userId);
|
||||||
$board->setColor($color);
|
$board->setColor($color);
|
||||||
$new_board = $this->boardMapper->insert($board);
|
/** @var Board $board */
|
||||||
|
$board = $this->boardMapper->insert($board);
|
||||||
|
|
||||||
// create new labels
|
// create new labels
|
||||||
$default_labels = [
|
$default_labels = [
|
||||||
@@ -210,33 +198,31 @@ class BoardService {
|
|||||||
$label = new Label();
|
$label = new Label();
|
||||||
$label->setColor($labelColor);
|
$label->setColor($labelColor);
|
||||||
$label->setTitle($labelTitle);
|
$label->setTitle($labelTitle);
|
||||||
$label->setBoardId($new_board->getId());
|
$label->setBoardId($board->getId());
|
||||||
$labels[] = $this->labelMapper->insert($label);
|
$labels[] = $this->labelMapper->insert($label);
|
||||||
}
|
}
|
||||||
$new_board->setLabels($labels);
|
$board->setLabels($labels);
|
||||||
$this->boardMapper->mapOwner($new_board);
|
$this->boardMapper->mapOwner($board);
|
||||||
$permissions = $this->permissionService->matchPermissions($new_board);
|
$permissions = $this->permissionService->matchPermissions($board);
|
||||||
$new_board->setPermissions([
|
$board->setPermissions([
|
||||||
'PERMISSION_READ' => $permissions[Acl::PERMISSION_READ] ?? false,
|
'PERMISSION_READ' => $permissions[Acl::PERMISSION_READ] ?? false,
|
||||||
'PERMISSION_EDIT' => $permissions[Acl::PERMISSION_EDIT] ?? false,
|
'PERMISSION_EDIT' => $permissions[Acl::PERMISSION_EDIT] ?? false,
|
||||||
'PERMISSION_MANAGE' => $permissions[Acl::PERMISSION_MANAGE] ?? false,
|
'PERMISSION_MANAGE' => $permissions[Acl::PERMISSION_MANAGE] ?? false,
|
||||||
'PERMISSION_SHARE' => $permissions[Acl::PERMISSION_SHARE] ?? false
|
'PERMISSION_SHARE' => $permissions[Acl::PERMISSION_SHARE] ?? false
|
||||||
]);
|
]);
|
||||||
$this->activityManager->triggerEvent(ActivityManager::DECK_OBJECT_BOARD, $new_board, ActivityManager::SUBJECT_BOARD_CREATE, [], $userId);
|
$this->activityManager->triggerEvent(ActivityManager::DECK_OBJECT_BOARD, $board, ActivityManager::SUBJECT_BOARD_CREATE, [], $userId);
|
||||||
$this->changeHelper->boardChanged($new_board->getId());
|
$this->changeHelper->boardChanged($board->getId());
|
||||||
|
|
||||||
return $new_board;
|
return $board;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $id
|
|
||||||
* @return Board
|
|
||||||
* @throws DoesNotExistException
|
* @throws DoesNotExistException
|
||||||
* @throws NoPermissionException
|
* @throws NoPermissionException
|
||||||
* @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException
|
* @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException
|
||||||
* @throws BadRequestException
|
* @throws BadRequestException
|
||||||
*/
|
*/
|
||||||
public function delete($id) {
|
public function delete(int $id): Board {
|
||||||
$this->boardServiceValidator->check(compact('id'));
|
$this->boardServiceValidator->check(compact('id'));
|
||||||
|
|
||||||
$this->permissionService->checkPermission($this->boardMapper, $id, Acl::PERMISSION_MANAGE);
|
$this->permissionService->checkPermission($this->boardMapper, $id, Acl::PERMISSION_MANAGE);
|
||||||
@@ -253,13 +239,11 @@ class BoardService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $id
|
|
||||||
* @return \OCP\AppFramework\Db\Entity
|
|
||||||
* @throws DoesNotExistException
|
* @throws DoesNotExistException
|
||||||
* @throws NoPermissionException
|
* @throws NoPermissionException
|
||||||
* @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException
|
* @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException
|
||||||
*/
|
*/
|
||||||
public function deleteUndo($id) {
|
public function deleteUndo(int $id): Board {
|
||||||
$this->boardServiceValidator->check(compact('id'));
|
$this->boardServiceValidator->check(compact('id'));
|
||||||
|
|
||||||
$this->permissionService->checkPermission($this->boardMapper, $id, Acl::PERMISSION_MANAGE);
|
$this->permissionService->checkPermission($this->boardMapper, $id, Acl::PERMISSION_MANAGE);
|
||||||
@@ -273,14 +257,12 @@ class BoardService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $id
|
|
||||||
* @return \OCP\AppFramework\Db\Entity
|
|
||||||
* @throws DoesNotExistException
|
* @throws DoesNotExistException
|
||||||
* @throws NoPermissionException
|
* @throws NoPermissionException
|
||||||
* @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException
|
* @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException
|
||||||
* @throws BadRequestException
|
* @throws BadRequestException
|
||||||
*/
|
*/
|
||||||
public function deleteForce($id) {
|
public function deleteForce(int $id): Board {
|
||||||
$this->boardServiceValidator->check(compact('id'));
|
$this->boardServiceValidator->check(compact('id'));
|
||||||
|
|
||||||
$this->permissionService->checkPermission($this->boardMapper, $id, Acl::PERMISSION_MANAGE);
|
$this->permissionService->checkPermission($this->boardMapper, $id, Acl::PERMISSION_MANAGE);
|
||||||
@@ -291,17 +273,12 @@ class BoardService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $id
|
|
||||||
* @param $title
|
|
||||||
* @param $color
|
|
||||||
* @param $archived
|
|
||||||
* @return \OCP\AppFramework\Db\Entity
|
|
||||||
* @throws DoesNotExistException
|
* @throws DoesNotExistException
|
||||||
* @throws NoPermissionException
|
* @throws NoPermissionException
|
||||||
* @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException
|
* @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException
|
||||||
* @throws BadRequestException
|
* @throws BadRequestException
|
||||||
*/
|
*/
|
||||||
public function update($id, $title, $color, $archived) {
|
public function update(int $id, string $title, string $color, bool $archived): Board {
|
||||||
$this->boardServiceValidator->check(compact('id', 'title', 'color', 'archived'));
|
$this->boardServiceValidator->check(compact('id', 'title', 'color', 'archived'));
|
||||||
|
|
||||||
$this->permissionService->checkPermission($this->boardMapper, $id, Acl::PERMISSION_MANAGE);
|
$this->permissionService->checkPermission($this->boardMapper, $id, Acl::PERMISSION_MANAGE);
|
||||||
@@ -320,7 +297,7 @@ class BoardService {
|
|||||||
return $board;
|
return $board;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function applyPermissions($boardId, $edit, $share, $manage, $oldAcl = null) {
|
private function applyPermissions(int $boardId, bool $edit, bool $share, bool $manage, ?Acl $oldAcl = null): array {
|
||||||
try {
|
try {
|
||||||
$this->permissionService->checkPermission($this->boardMapper, $boardId, Acl::PERMISSION_MANAGE);
|
$this->permissionService->checkPermission($this->boardMapper, $boardId, Acl::PERMISSION_MANAGE);
|
||||||
} catch (NoPermissionException $e) {
|
} catch (NoPermissionException $e) {
|
||||||
@@ -332,7 +309,7 @@ class BoardService {
|
|||||||
return [$edit, $share, $manage];
|
return [$edit, $share, $manage];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function enrichWithBoardSettings(Board $board) {
|
public function enrichWithBoardSettings(Board $board): void {
|
||||||
$globalCalendarConfig = (bool)$this->config->getUserValue($this->userId, Application::APP_ID, 'calendar', true);
|
$globalCalendarConfig = (bool)$this->config->getUserValue($this->userId, Application::APP_ID, 'calendar', true);
|
||||||
$settings = [
|
$settings = [
|
||||||
'notify-due' => $this->config->getUserValue($this->userId, Application::APP_ID, 'board:' . $board->getId() . ':notify-due', ConfigService::SETTING_BOARD_NOTIFICATION_DUE_ASSIGNED),
|
'notify-due' => $this->config->getUserValue($this->userId, Application::APP_ID, 'board:' . $board->getId() . ':notify-due', ConfigService::SETTING_BOARD_NOTIFICATION_DUE_ASSIGNED),
|
||||||
@@ -341,7 +318,7 @@ class BoardService {
|
|||||||
$board->setSettings($settings);
|
$board->setSettings($settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function enrichWithActiveSessions(Board $board) {
|
public function enrichWithActiveSessions(Board $board): void {
|
||||||
$sessions = $this->sessionMapper->findAllActive($board->getId());
|
$sessions = $this->sessionMapper->findAllActive($board->getId());
|
||||||
|
|
||||||
$board->setActiveSessions(array_values(
|
$board->setActiveSessions(array_values(
|
||||||
@@ -354,17 +331,11 @@ class BoardService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $boardId
|
* @param Acl::PERMISSION_TYPE_* $type
|
||||||
* @param $type
|
|
||||||
* @param $participant
|
|
||||||
* @param $edit
|
|
||||||
* @param $share
|
|
||||||
* @param $manage
|
|
||||||
* @return \OCP\AppFramework\Db\Entity
|
|
||||||
* @throws BadRequestException
|
* @throws BadRequestException
|
||||||
* @throws NoPermissionException
|
* @throws NoPermissionException
|
||||||
*/
|
*/
|
||||||
public function addAcl($boardId, $type, $participant, $edit, $share, $manage) {
|
public function addAcl(int $boardId, int $type, $participant, bool $edit, bool $share, bool $manage): Acl {
|
||||||
$this->boardServiceValidator->check(compact('boardId', 'type', 'participant', 'edit', 'share', 'manage'));
|
$this->boardServiceValidator->check(compact('boardId', 'type', 'participant', 'edit', 'share', 'manage'));
|
||||||
|
|
||||||
$this->permissionService->checkPermission($this->boardMapper, $boardId, Acl::PERMISSION_SHARE);
|
$this->permissionService->checkPermission($this->boardMapper, $boardId, Acl::PERMISSION_SHARE);
|
||||||
@@ -400,17 +371,12 @@ class BoardService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $id
|
|
||||||
* @param $edit
|
|
||||||
* @param $share
|
|
||||||
* @param $manage
|
|
||||||
* @return \OCP\AppFramework\Db\Entity
|
|
||||||
* @throws DoesNotExistException
|
* @throws DoesNotExistException
|
||||||
* @throws NoPermissionException
|
* @throws NoPermissionException
|
||||||
* @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException
|
* @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException
|
||||||
* @throws BadRequestException
|
* @throws BadRequestException
|
||||||
*/
|
*/
|
||||||
public function updateAcl($id, $edit, $share, $manage) {
|
public function updateAcl(int $id, bool $edit, bool $share, bool $manage): Acl {
|
||||||
$this->boardServiceValidator->check(compact('id', 'edit', 'share', 'manage'));
|
$this->boardServiceValidator->check(compact('id', 'edit', 'share', 'manage'));
|
||||||
|
|
||||||
$this->permissionService->checkPermission($this->aclMapper, $id, Acl::PERMISSION_SHARE);
|
$this->permissionService->checkPermission($this->aclMapper, $id, Acl::PERMISSION_SHARE);
|
||||||
@@ -422,12 +388,12 @@ class BoardService {
|
|||||||
$acl->setPermissionShare($share);
|
$acl->setPermissionShare($share);
|
||||||
$acl->setPermissionManage($manage);
|
$acl->setPermissionManage($manage);
|
||||||
$this->boardMapper->mapAcl($acl);
|
$this->boardMapper->mapAcl($acl);
|
||||||
$board = $this->aclMapper->update($acl);
|
$acl = $this->aclMapper->update($acl);
|
||||||
$this->changeHelper->boardChanged($acl->getBoardId());
|
$this->changeHelper->boardChanged($acl->getBoardId());
|
||||||
|
|
||||||
$this->eventDispatcher->dispatchTyped(new AclUpdatedEvent($acl));
|
$this->eventDispatcher->dispatchTyped(new AclUpdatedEvent($acl));
|
||||||
|
|
||||||
return $board;
|
return $acl;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -579,27 +545,23 @@ class BoardService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $id
|
|
||||||
* @return Board
|
|
||||||
* @throws DoesNotExistException
|
* @throws DoesNotExistException
|
||||||
* @throws NoPermissionException
|
* @throws NoPermissionException
|
||||||
* @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException
|
* @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException
|
||||||
* @throws BadRequestException
|
|
||||||
*/
|
*/
|
||||||
public function export($id) : Board {
|
public function export(int $id): Board {
|
||||||
if (is_numeric($id) === false) {
|
|
||||||
throw new BadRequestException('board id must be a number');
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->permissionService->checkPermission($this->boardMapper, $id, Acl::PERMISSION_READ);
|
$this->permissionService->checkPermission($this->boardMapper, $id, Acl::PERMISSION_READ);
|
||||||
$board = $this->boardMapper->find((int)$id);
|
$board = $this->boardMapper->find($id);
|
||||||
$this->enrichWithCards($board);
|
$this->enrichWithCards($board);
|
||||||
$this->enrichWithLabels($board);
|
$this->enrichWithLabels($board);
|
||||||
|
|
||||||
return $board;
|
return $board;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @param Board[] $boards */
|
/**
|
||||||
|
* @param Board[] $boards
|
||||||
|
* @return Board[]
|
||||||
|
*/
|
||||||
private function enrichBoards(array $boards, bool $fullDetails = true): array {
|
private function enrichBoards(array $boards, bool $fullDetails = true): array {
|
||||||
$result = [];
|
$result = [];
|
||||||
foreach ($boards as $board) {
|
foreach ($boards as $board) {
|
||||||
@@ -715,8 +677,8 @@ class BoardService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function enrichWithStacks($board, $since = -1) {
|
private function enrichWithStacks(Board $board): void {
|
||||||
$stacks = $this->stackMapper->findAll($board->getId(), null, null, $since);
|
$stacks = $this->stackMapper->findAll($board->getId());
|
||||||
|
|
||||||
if (\count($stacks) === 0) {
|
if (\count($stacks) === 0) {
|
||||||
return;
|
return;
|
||||||
@@ -725,8 +687,8 @@ class BoardService {
|
|||||||
$board->setStacks($stacks);
|
$board->setStacks($stacks);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function enrichWithLabels($board, $since = -1) {
|
private function enrichWithLabels(Board $board): void {
|
||||||
$labels = $this->labelMapper->findAll($board->getId(), null, null, $since);
|
$labels = $this->labelMapper->findAll($board->getId());
|
||||||
|
|
||||||
if (\count($labels) === 0) {
|
if (\count($labels) === 0) {
|
||||||
return;
|
return;
|
||||||
@@ -735,7 +697,7 @@ class BoardService {
|
|||||||
$board->setLabels($labels);
|
$board->setLabels($labels);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function enrichWithUsers($board, $since = -1) {
|
private function enrichWithUsers(Board $board): void {
|
||||||
$boardUsers = $this->permissionService->findUsers($board->getId());
|
$boardUsers = $this->permissionService->findUsers($board->getId());
|
||||||
if ($boardUsers === null || \count($boardUsers) === 0) {
|
if ($boardUsers === null || \count($boardUsers) === 0) {
|
||||||
return;
|
return;
|
||||||
@@ -746,7 +708,7 @@ class BoardService {
|
|||||||
/**
|
/**
|
||||||
* Clean a given board data from the Cache
|
* Clean a given board data from the Cache
|
||||||
*/
|
*/
|
||||||
private function clearBoardFromCache(Board $board) {
|
private function clearBoardFromCache(Board $board): void {
|
||||||
$boardId = $board->getId();
|
$boardId = $board->getId();
|
||||||
$boardOwnerId = $board->getOwner();
|
$boardOwnerId = $board->getOwner();
|
||||||
|
|
||||||
@@ -755,7 +717,7 @@ class BoardService {
|
|||||||
unset($this->boardsCachePartial[$boardId]);
|
unset($this->boardsCachePartial[$boardId]);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function enrichWithCards($board) {
|
private function enrichWithCards(Board $board): void {
|
||||||
$stacks = $this->stackMapper->findAll($board->getId());
|
$stacks = $this->stackMapper->findAll($board->getId());
|
||||||
foreach ($stacks as $stack) {
|
foreach ($stacks as $stack) {
|
||||||
$cards = $this->cardMapper->findAllByStack($stack->getId());
|
$cards = $this->cardMapper->findAllByStack($stack->getId());
|
||||||
|
|||||||
@@ -64,10 +64,14 @@ class CardService {
|
|||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function enrichCards($cards) {
|
/**
|
||||||
|
* @param Card[] $cards
|
||||||
|
* @return CardDetails[]
|
||||||
|
*/
|
||||||
|
public function enrichCards(array $cards): array {
|
||||||
$user = $this->userManager->get($this->userId);
|
$user = $this->userManager->get($this->userId);
|
||||||
|
|
||||||
$cardIds = array_map(function (Card $card) use ($user) {
|
$cardIds = array_map(function (Card $card) use ($user): int {
|
||||||
// Everything done in here might be heavy as it is executed for every card
|
// Everything done in here might be heavy as it is executed for every card
|
||||||
$cardId = $card->getId();
|
$cardId = $card->getId();
|
||||||
$this->cardMapper->mapOwner($card);
|
$this->cardMapper->mapOwner($card);
|
||||||
@@ -120,7 +124,8 @@ class CardService {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function fetchDeleted($boardId) {
|
/** @return Card[] */
|
||||||
|
public function fetchDeleted($boardId): array {
|
||||||
$this->cardServiceValidator->check(compact('boardId'));
|
$this->cardServiceValidator->check(compact('boardId'));
|
||||||
$this->permissionService->checkPermission($this->boardMapper, $boardId, Acl::PERMISSION_READ);
|
$this->permissionService->checkPermission($this->boardMapper, $boardId, Acl::PERMISSION_READ);
|
||||||
$cards = $this->cardMapper->findDeleted($boardId);
|
$cards = $this->cardMapper->findDeleted($boardId);
|
||||||
@@ -129,13 +134,12 @@ class CardService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return \OCA\Deck\Db\RelationalEntity
|
|
||||||
* @throws \OCA\Deck\NoPermissionException
|
* @throws \OCA\Deck\NoPermissionException
|
||||||
* @throws \OCP\AppFramework\Db\DoesNotExistException
|
* @throws \OCP\AppFramework\Db\DoesNotExistException
|
||||||
* @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException
|
* @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException
|
||||||
* @throws BadRequestException
|
* @throws BadRequestException
|
||||||
*/
|
*/
|
||||||
public function find(int $cardId) {
|
public function find(int $cardId): Card {
|
||||||
$this->permissionService->checkPermission($this->cardMapper, $cardId, Acl::PERMISSION_READ);
|
$this->permissionService->checkPermission($this->cardMapper, $cardId, Acl::PERMISSION_READ);
|
||||||
$card = $this->cardMapper->find($cardId);
|
$card = $this->cardMapper->find($cardId);
|
||||||
[$card] = $this->enrichCards([$card]);
|
[$card] = $this->enrichCards([$card]);
|
||||||
@@ -152,7 +156,10 @@ class CardService {
|
|||||||
return $card;
|
return $card;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function findCalendarEntries($boardId) {
|
/**
|
||||||
|
* @return Card[]
|
||||||
|
*/
|
||||||
|
public function findCalendarEntries(int $boardId): array {
|
||||||
try {
|
try {
|
||||||
$this->permissionService->checkPermission($this->boardMapper, $boardId, Acl::PERMISSION_READ);
|
$this->permissionService->checkPermission($this->boardMapper, $boardId, Acl::PERMISSION_READ);
|
||||||
} catch (NoPermissionException $e) {
|
} catch (NoPermissionException $e) {
|
||||||
@@ -163,20 +170,13 @@ class CardService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $title
|
|
||||||
* @param $stackId
|
|
||||||
* @param $type
|
|
||||||
* @param integer $order
|
|
||||||
* @param $description
|
|
||||||
* @param $owner
|
|
||||||
* @return \OCP\AppFramework\Db\Entity
|
|
||||||
* @throws StatusException
|
* @throws StatusException
|
||||||
* @throws \OCA\Deck\NoPermissionException
|
* @throws \OCA\Deck\NoPermissionException
|
||||||
* @throws \OCP\AppFramework\Db\DoesNotExistException
|
* @throws \OCP\AppFramework\Db\DoesNotExistException
|
||||||
* @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException
|
* @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException
|
||||||
* @throws BadrequestException
|
* @throws BadrequestException
|
||||||
*/
|
*/
|
||||||
public function create($title, $stackId, $type, $order, $owner, $description = '', $duedate = null) {
|
public function create(string $title, int $stackId, string $type, int $order, string $owner, string $description = '', $duedate = null): Card {
|
||||||
$this->cardServiceValidator->check(compact('title', 'stackId', 'type', 'order', 'owner'));
|
$this->cardServiceValidator->check(compact('title', 'stackId', 'type', 'order', 'owner'));
|
||||||
|
|
||||||
$this->permissionService->checkPermission($this->stackMapper, $stackId, Acl::PERMISSION_EDIT);
|
$this->permissionService->checkPermission($this->stackMapper, $stackId, Acl::PERMISSION_EDIT);
|
||||||
@@ -203,19 +203,13 @@ class CardService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $id
|
|
||||||
* @return \OCP\AppFramework\Db\Entity
|
|
||||||
* @throws StatusException
|
* @throws StatusException
|
||||||
* @throws \OCA\Deck\NoPermissionException
|
* @throws \OCA\Deck\NoPermissionException
|
||||||
* @throws \OCP\AppFramework\Db\DoesNotExistException
|
* @throws \OCP\AppFramework\Db\DoesNotExistException
|
||||||
* @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException
|
* @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException
|
||||||
* @throws BadRequestException
|
* @throws BadRequestException
|
||||||
*/
|
*/
|
||||||
public function delete($id) {
|
public function delete(int $id): Card {
|
||||||
if (is_numeric($id) === false) {
|
|
||||||
throw new BadRequestException('card id must be a number');
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->permissionService->checkPermission($this->cardMapper, $id, Acl::PERMISSION_EDIT);
|
$this->permissionService->checkPermission($this->cardMapper, $id, Acl::PERMISSION_EDIT);
|
||||||
if ($this->boardService->isArchived($this->cardMapper, $id)) {
|
if ($this->boardService->isArchived($this->cardMapper, $id)) {
|
||||||
throw new StatusException('Operation not allowed. This board is archived.');
|
throw new StatusException('Operation not allowed. This board is archived.');
|
||||||
@@ -233,25 +227,13 @@ class CardService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $id
|
|
||||||
* @param $title
|
|
||||||
* @param $stackId
|
|
||||||
* @param $type
|
|
||||||
* @param $owner
|
|
||||||
* @param $description
|
|
||||||
* @param $order
|
|
||||||
* @param $duedate
|
|
||||||
* @param $deletedAt
|
|
||||||
* @param $archived
|
|
||||||
* @param $done
|
|
||||||
* @return \OCP\AppFramework\Db\Entity
|
|
||||||
* @throws StatusException
|
* @throws StatusException
|
||||||
* @throws \OCA\Deck\NoPermissionException
|
* @throws \OCA\Deck\NoPermissionException
|
||||||
* @throws \OCP\AppFramework\Db\DoesNotExistException
|
* @throws \OCP\AppFramework\Db\DoesNotExistException
|
||||||
* @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException
|
* @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException
|
||||||
* @throws BadRequestException
|
* @throws BadRequestException
|
||||||
*/
|
*/
|
||||||
public function update($id, $title, $stackId, $type, $owner, $description = '', $order = 0, $duedate = null, $deletedAt = null, $archived = null, ?OptionalNullableValue $done = null) {
|
public function update(int $id, string $title, int $stackId, string $type, string $owner, string $description = '', int $order = 0, ?string $duedate = null, ?int $deletedAt = null, ?bool $archived = null, ?OptionalNullableValue $done = null): Card {
|
||||||
$this->cardServiceValidator->check(compact('id', 'title', 'stackId', 'type', 'owner', 'order'));
|
$this->cardServiceValidator->check(compact('id', 'title', 'stackId', 'type', 'owner', 'order'));
|
||||||
|
|
||||||
$this->permissionService->checkPermission($this->cardMapper, $id, Acl::PERMISSION_EDIT, allowDeletedCard: true);
|
$this->permissionService->checkPermission($this->cardMapper, $id, Acl::PERMISSION_EDIT, allowDeletedCard: true);
|
||||||
@@ -398,16 +380,13 @@ class CardService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $id
|
|
||||||
* @param $title
|
|
||||||
* @return \OCP\AppFramework\Db\Entity
|
|
||||||
* @throws StatusException
|
* @throws StatusException
|
||||||
* @throws \OCA\Deck\NoPermissionException
|
* @throws \OCA\Deck\NoPermissionException
|
||||||
* @throws \OCP\AppFramework\Db\DoesNotExistException
|
* @throws \OCP\AppFramework\Db\DoesNotExistException
|
||||||
* @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException
|
* @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException
|
||||||
* @throws BadRequestException
|
* @throws BadRequestException
|
||||||
*/
|
*/
|
||||||
public function rename($id, $title) {
|
public function rename(int $id, string $title): Card {
|
||||||
$this->cardServiceValidator->check(compact('id', 'title'));
|
$this->cardServiceValidator->check(compact('id', 'title'));
|
||||||
|
|
||||||
$this->permissionService->checkPermission($this->cardMapper, $id, Acl::PERMISSION_EDIT);
|
$this->permissionService->checkPermission($this->cardMapper, $id, Acl::PERMISSION_EDIT);
|
||||||
@@ -429,17 +408,14 @@ class CardService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $id
|
* @return list<Card>
|
||||||
* @param $stackId
|
|
||||||
* @param $order
|
|
||||||
* @return array
|
|
||||||
* @throws StatusException
|
* @throws StatusException
|
||||||
* @throws \OCA\Deck\NoPermissionException
|
* @throws \OCA\Deck\NoPermissionException
|
||||||
* @throws \OCP\AppFramework\Db\DoesNotExistException
|
* @throws \OCP\AppFramework\Db\DoesNotExistException
|
||||||
* @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException
|
* @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException
|
||||||
* @throws BadRequestException
|
* @throws BadRequestException
|
||||||
*/
|
*/
|
||||||
public function reorder(int $id, int $stackId, int $order) {
|
public function reorder(int $id, int $stackId, int $order): array {
|
||||||
$this->cardServiceValidator->check(compact('id', 'stackId', 'order'));
|
$this->cardServiceValidator->check(compact('id', 'stackId', 'order'));
|
||||||
|
|
||||||
$this->permissionService->checkPermission($this->cardMapper, $id, Acl::PERMISSION_EDIT);
|
$this->permissionService->checkPermission($this->cardMapper, $id, Acl::PERMISSION_EDIT);
|
||||||
@@ -488,15 +464,13 @@ class CardService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $id
|
|
||||||
* @return \OCP\AppFramework\Db\Entity
|
|
||||||
* @throws StatusException
|
* @throws StatusException
|
||||||
* @throws \OCA\Deck\NoPermissionException
|
* @throws \OCA\Deck\NoPermissionException
|
||||||
* @throws \OCP\AppFramework\Db\DoesNotExistException
|
* @throws \OCP\AppFramework\Db\DoesNotExistException
|
||||||
* @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException
|
* @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException
|
||||||
* @throws BadRequestException
|
* @throws BadRequestException
|
||||||
*/
|
*/
|
||||||
public function archive($id) {
|
public function archive(int $id): Card {
|
||||||
$this->cardServiceValidator->check(compact('id'));
|
$this->cardServiceValidator->check(compact('id'));
|
||||||
|
|
||||||
$this->permissionService->checkPermission($this->cardMapper, $id, Acl::PERMISSION_EDIT);
|
$this->permissionService->checkPermission($this->cardMapper, $id, Acl::PERMISSION_EDIT);
|
||||||
@@ -517,15 +491,13 @@ class CardService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $id
|
|
||||||
* @return \OCP\AppFramework\Db\Entity
|
|
||||||
* @throws StatusException
|
* @throws StatusException
|
||||||
* @throws \OCA\Deck\NoPermissionException
|
* @throws \OCA\Deck\NoPermissionException
|
||||||
* @throws \OCP\AppFramework\Db\DoesNotExistException
|
* @throws \OCP\AppFramework\Db\DoesNotExistException
|
||||||
* @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException
|
* @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException
|
||||||
* @throws BadRequestException
|
* @throws BadRequestException
|
||||||
*/
|
*/
|
||||||
public function unarchive($id) {
|
public function unarchive(int $id): Card {
|
||||||
$this->cardServiceValidator->check(compact('id'));
|
$this->cardServiceValidator->check(compact('id'));
|
||||||
|
|
||||||
|
|
||||||
@@ -546,8 +518,6 @@ class CardService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $id
|
|
||||||
* @return \OCA\Deck\Db\Card
|
|
||||||
* @throws StatusException
|
* @throws StatusException
|
||||||
* @throws \OCA\Deck\NoPermissionException
|
* @throws \OCA\Deck\NoPermissionException
|
||||||
* @throws \OCP\AppFramework\Db\DoesNotExistException
|
* @throws \OCP\AppFramework\Db\DoesNotExistException
|
||||||
@@ -599,15 +569,13 @@ class CardService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $cardId
|
|
||||||
* @param $labelId
|
|
||||||
* @throws StatusException
|
* @throws StatusException
|
||||||
* @throws \OCA\Deck\NoPermissionException
|
* @throws \OCA\Deck\NoPermissionException
|
||||||
* @throws \OCP\AppFramework\Db\DoesNotExistException
|
* @throws \OCP\AppFramework\Db\DoesNotExistException
|
||||||
* @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException
|
* @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException
|
||||||
* @throws BadRequestException
|
* @throws BadRequestException
|
||||||
*/
|
*/
|
||||||
public function assignLabel($cardId, $labelId) {
|
public function assignLabel(int $cardId, int $labelId): Card {
|
||||||
$this->cardServiceValidator->check(compact('cardId', 'labelId'));
|
$this->cardServiceValidator->check(compact('cardId', 'labelId'));
|
||||||
|
|
||||||
$this->permissionService->checkPermission($this->cardMapper, $cardId, Acl::PERMISSION_EDIT);
|
$this->permissionService->checkPermission($this->cardMapper, $cardId, Acl::PERMISSION_EDIT);
|
||||||
@@ -629,18 +597,16 @@ class CardService {
|
|||||||
$this->activityManager->triggerEvent(ActivityManager::DECK_OBJECT_CARD, $card, ActivityManager::SUBJECT_LABEL_ASSIGN, ['label' => $label]);
|
$this->activityManager->triggerEvent(ActivityManager::DECK_OBJECT_CARD, $card, ActivityManager::SUBJECT_LABEL_ASSIGN, ['label' => $label]);
|
||||||
|
|
||||||
$this->eventDispatcher->dispatchTyped(new CardUpdatedEvent($card));
|
$this->eventDispatcher->dispatchTyped(new CardUpdatedEvent($card));
|
||||||
|
return $card;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $cardId
|
|
||||||
* @param $labelId
|
|
||||||
* @throws StatusException
|
|
||||||
* @throws \OCA\Deck\NoPermissionException
|
* @throws \OCA\Deck\NoPermissionException
|
||||||
* @throws \OCP\AppFramework\Db\DoesNotExistException
|
* @throws \OCP\AppFramework\Db\DoesNotExistException
|
||||||
* @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException
|
* @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException
|
||||||
* @throws BadRequestException
|
* @throws BadRequestException
|
||||||
*/
|
*/
|
||||||
public function removeLabel($cardId, $labelId) {
|
public function removeLabel(int $cardId, int $labelId): Card {
|
||||||
$this->cardServiceValidator->check(compact('cardId', 'labelId'));
|
$this->cardServiceValidator->check(compact('cardId', 'labelId'));
|
||||||
|
|
||||||
|
|
||||||
@@ -660,6 +626,7 @@ class CardService {
|
|||||||
$this->activityManager->triggerEvent(ActivityManager::DECK_OBJECT_CARD, $card, ActivityManager::SUBJECT_LABEL_UNASSING, ['label' => $label]);
|
$this->activityManager->triggerEvent(ActivityManager::DECK_OBJECT_CARD, $card, ActivityManager::SUBJECT_LABEL_UNASSING, ['label' => $label]);
|
||||||
|
|
||||||
$this->eventDispatcher->dispatchTyped(new CardUpdatedEvent($card));
|
$this->eventDispatcher->dispatchTyped(new CardUpdatedEvent($card));
|
||||||
|
return $card;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getCardUrl(int $cardId): string {
|
public function getCardUrl(int $cardId): string {
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ class CirclesService {
|
|||||||
$circlesManager->startSession($federatedUser);
|
$circlesManager->startSession($federatedUser);
|
||||||
$circle = $circlesManager->getCircle($circleId);
|
$circle = $circlesManager->getCircle($circleId);
|
||||||
$member = $circle->getInitiator();
|
$member = $circle->getInitiator();
|
||||||
$isUserInCircle = $member !== null && $member->getLevel() >= Member::LEVEL_MEMBER;
|
$isUserInCircle = $member->getLevel() >= Member::LEVEL_MEMBER;
|
||||||
|
|
||||||
if (!isset($this->userCircleCache[$circleId])) {
|
if (!isset($this->userCircleCache[$circleId])) {
|
||||||
$this->userCircleCache[$circleId] = [];
|
$this->userCircleCache[$circleId] = [];
|
||||||
|
|||||||
@@ -22,8 +22,6 @@ use OCP\IUserManager;
|
|||||||
use OutOfBoundsException;
|
use OutOfBoundsException;
|
||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
|
|
||||||
use function is_numeric;
|
|
||||||
|
|
||||||
class CommentService {
|
class CommentService {
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
@@ -36,12 +34,9 @@ class CommentService {
|
|||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function list(string $cardId, int $limit = 20, int $offset = 0): DataResponse {
|
public function list(int $cardId, int $limit = 20, int $offset = 0): DataResponse {
|
||||||
if (!is_numeric($cardId)) {
|
|
||||||
throw new BadRequestException('A valid card id must be provided');
|
|
||||||
}
|
|
||||||
$this->permissionService->checkPermission($this->cardMapper, $cardId, Acl::PERMISSION_READ);
|
$this->permissionService->checkPermission($this->cardMapper, $cardId, Acl::PERMISSION_READ);
|
||||||
$comments = $this->commentsManager->getForObject(Application::COMMENT_ENTITY_TYPE, $cardId, $limit, $offset);
|
$comments = $this->commentsManager->getForObject(Application::COMMENT_ENTITY_TYPE, (string)$cardId, $limit, $offset);
|
||||||
$result = [];
|
$result = [];
|
||||||
foreach ($comments as $comment) {
|
foreach ($comments as $comment) {
|
||||||
$formattedComment = $this->formatComment($comment);
|
$formattedComment = $this->formatComment($comment);
|
||||||
@@ -96,13 +91,13 @@ class CommentService {
|
|||||||
* @throws BadRequestException
|
* @throws BadRequestException
|
||||||
* @throws NotFoundException|NoPermissionException
|
* @throws NotFoundException|NoPermissionException
|
||||||
*/
|
*/
|
||||||
public function create(int $cardId, string $message, string $replyTo = '0'): DataResponse {
|
public function create(int $cardId, string $message, int $replyTo = 0): DataResponse {
|
||||||
$this->permissionService->checkPermission($this->cardMapper, $cardId, Acl::PERMISSION_READ);
|
$this->permissionService->checkPermission($this->cardMapper, $cardId, Acl::PERMISSION_READ);
|
||||||
|
|
||||||
// Check if parent is a comment on the same card
|
// Check if parent is a comment on the same card
|
||||||
if ($replyTo !== '0') {
|
if ($replyTo !== 0) {
|
||||||
try {
|
try {
|
||||||
$comment = $this->commentsManager->get($replyTo);
|
$comment = $this->commentsManager->get((string)$replyTo);
|
||||||
if ($comment->getObjectType() !== Application::COMMENT_ENTITY_TYPE || (int)$comment->getObjectId() !== $cardId) {
|
if ($comment->getObjectType() !== Application::COMMENT_ENTITY_TYPE || (int)$comment->getObjectId() !== $cardId) {
|
||||||
throw new CommentNotFoundException();
|
throw new CommentNotFoundException();
|
||||||
}
|
}
|
||||||
@@ -115,7 +110,7 @@ class CommentService {
|
|||||||
$comment = $this->commentsManager->create('users', $this->userId, Application::COMMENT_ENTITY_TYPE, (string)$cardId);
|
$comment = $this->commentsManager->create('users', $this->userId, Application::COMMENT_ENTITY_TYPE, (string)$cardId);
|
||||||
$comment->setMessage($message);
|
$comment->setMessage($message);
|
||||||
$comment->setVerb('comment');
|
$comment->setVerb('comment');
|
||||||
$comment->setParentId($replyTo);
|
$comment->setParentId((string)$replyTo);
|
||||||
$this->commentsManager->save($comment);
|
$this->commentsManager->save($comment);
|
||||||
return new DataResponse($this->formatComment($comment, true));
|
return new DataResponse($this->formatComment($comment, true));
|
||||||
} catch (\InvalidArgumentException $e) {
|
} catch (\InvalidArgumentException $e) {
|
||||||
@@ -128,14 +123,8 @@ class CommentService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function update(string $cardId, string $commentId, string $message): DataResponse {
|
public function update(int $cardId, int $commentId, string $message): DataResponse {
|
||||||
if (!is_numeric($cardId)) {
|
$comment = $this->get($cardId, $commentId);
|
||||||
throw new BadRequestException('A valid card id must be provided');
|
|
||||||
}
|
|
||||||
if (!is_numeric($commentId)) {
|
|
||||||
throw new BadRequestException('A valid comment id must be provided');
|
|
||||||
}
|
|
||||||
$comment = $this->get((int)$cardId, (int)$commentId);
|
|
||||||
if ($comment->getActorType() !== 'users' || $comment->getActorId() !== $this->userId) {
|
if ($comment->getActorType() !== 'users' || $comment->getActorId() !== $this->userId) {
|
||||||
throw new NoPermissionException('Only authors are allowed to edit their comment.');
|
throw new NoPermissionException('Only authors are allowed to edit their comment.');
|
||||||
}
|
}
|
||||||
@@ -145,18 +134,12 @@ class CommentService {
|
|||||||
return new DataResponse($this->formatComment($comment));
|
return new DataResponse($this->formatComment($comment));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function delete(string $cardId, string $commentId): DataResponse {
|
public function delete(int $cardId, int $commentId): DataResponse {
|
||||||
if (!is_numeric($cardId)) {
|
|
||||||
throw new BadRequestException('A valid card id must be provided');
|
|
||||||
}
|
|
||||||
if (!is_numeric($commentId)) {
|
|
||||||
throw new BadRequestException('A valid comment id must be provided');
|
|
||||||
}
|
|
||||||
$this->permissionService->checkPermission($this->cardMapper, $cardId, Acl::PERMISSION_READ);
|
$this->permissionService->checkPermission($this->cardMapper, $cardId, Acl::PERMISSION_READ);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$comment = $this->commentsManager->get($commentId);
|
$comment = $this->commentsManager->get((string)$commentId);
|
||||||
if ($comment->getObjectType() !== Application::COMMENT_ENTITY_TYPE || $comment->getObjectId() !== $cardId) {
|
if ($comment->getObjectType() !== Application::COMMENT_ENTITY_TYPE || (int)$comment->getObjectId() !== $cardId) {
|
||||||
throw new CommentNotFoundException();
|
throw new CommentNotFoundException();
|
||||||
}
|
}
|
||||||
} catch (CommentNotFoundException $e) {
|
} catch (CommentNotFoundException $e) {
|
||||||
@@ -165,11 +148,11 @@ class CommentService {
|
|||||||
if ($comment->getActorType() !== 'users' || $comment->getActorId() !== $this->userId) {
|
if ($comment->getActorType() !== 'users' || $comment->getActorId() !== $this->userId) {
|
||||||
throw new NoPermissionException('Only authors are allowed to edit their comment.');
|
throw new NoPermissionException('Only authors are allowed to edit their comment.');
|
||||||
}
|
}
|
||||||
$this->commentsManager->delete($commentId);
|
$this->commentsManager->delete((string)$commentId);
|
||||||
return new DataResponse([]);
|
return new DataResponse([]);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function formatComment(IComment $comment, $addReplyTo = false): array {
|
private function formatComment(IComment $comment, bool $addReplyTo = false): array {
|
||||||
$actorDisplayName = $this->userManager->getDisplayName($comment->getActorId()) ?? $comment->getActorId();
|
$actorDisplayName = $this->userManager->getDisplayName($comment->getActorId()) ?? $comment->getActorId();
|
||||||
|
|
||||||
$formattedComment = [
|
$formattedComment = [
|
||||||
|
|||||||
@@ -48,7 +48,8 @@ class ConfigService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function getAll(): array {
|
public function getAll(): array {
|
||||||
if ($this->getUserId() === null) {
|
$userId = $this->getUserId();
|
||||||
|
if ($userId === null) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -57,7 +58,7 @@ class ConfigService {
|
|||||||
'cardDetailsInModal' => $this->isCardDetailsInModal(),
|
'cardDetailsInModal' => $this->isCardDetailsInModal(),
|
||||||
'cardIdBadge' => $this->isCardIdBadgeEnabled()
|
'cardIdBadge' => $this->isCardIdBadgeEnabled()
|
||||||
];
|
];
|
||||||
if ($this->groupManager->isAdmin($this->getUserId())) {
|
if ($this->groupManager->isAdmin($userId)) {
|
||||||
$data['groupLimit'] = $this->get('groupLimit');
|
$data['groupLimit'] = $this->get('groupLimit');
|
||||||
}
|
}
|
||||||
return $data;
|
return $data;
|
||||||
@@ -95,44 +96,48 @@ class ConfigService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function isCalendarEnabled(?int $boardId = null): bool {
|
public function isCalendarEnabled(?int $boardId = null): bool {
|
||||||
if ($this->getUserId() === null) {
|
$userId = $this->getUserId();
|
||||||
|
if ($userId === null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$appConfigState = $this->config->getAppValue(Application::APP_ID, 'calendar', 'yes') === 'yes';
|
$appConfigState = $this->config->getAppValue(Application::APP_ID, 'calendar', 'yes') === 'yes';
|
||||||
$defaultState = (bool)$this->config->getUserValue($this->getUserId(), Application::APP_ID, 'calendar', $appConfigState);
|
$defaultState = (bool)$this->config->getUserValue($userId, Application::APP_ID, 'calendar', $appConfigState);
|
||||||
if ($boardId === null) {
|
if ($boardId === null) {
|
||||||
return $defaultState;
|
return $defaultState;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (bool)$this->config->getUserValue($this->getUserId(), Application::APP_ID, 'board:' . $boardId . ':calendar', $defaultState);
|
return (bool)$this->config->getUserValue($userId, Application::APP_ID, 'board:' . $boardId . ':calendar', $defaultState);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isCardDetailsInModal(?int $boardId = null): bool {
|
public function isCardDetailsInModal(?int $boardId = null): bool {
|
||||||
if ($this->getUserId() === null) {
|
$userId = $this->getUserId();
|
||||||
|
if ($userId === null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$defaultState = (bool)$this->config->getUserValue($this->getUserId(), Application::APP_ID, 'cardDetailsInModal', true);
|
$defaultState = (bool)$this->config->getUserValue($userId, Application::APP_ID, 'cardDetailsInModal', true);
|
||||||
if ($boardId === null) {
|
if ($boardId === null) {
|
||||||
return $defaultState;
|
return $defaultState;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (bool)$this->config->getUserValue($this->getUserId(), Application::APP_ID, 'board:' . $boardId . ':cardDetailsInModal', $defaultState);
|
return (bool)$this->config->getUserValue($userId, Application::APP_ID, 'board:' . $boardId . ':cardDetailsInModal', $defaultState);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isCardIdBadgeEnabled(): bool {
|
public function isCardIdBadgeEnabled(): bool {
|
||||||
if ($this->getUserId() === null) {
|
$userId = $this->getUserId();
|
||||||
|
if ($userId === null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$appConfigState = $this->config->getAppValue(Application::APP_ID, 'cardIdBadge', 'yes') === 'no';
|
$appConfigState = $this->config->getAppValue(Application::APP_ID, 'cardIdBadge', 'yes') === 'no';
|
||||||
$defaultState = (bool)$this->config->getUserValue($this->getUserId(), Application::APP_ID, 'cardIdBadge', $appConfigState);
|
$defaultState = (bool)$this->config->getUserValue($userId, Application::APP_ID, 'cardIdBadge', $appConfigState);
|
||||||
|
|
||||||
return (bool)$this->config->getUserValue($this->getUserId(), Application::APP_ID, 'cardIdBadge', $defaultState);
|
return (bool)$this->config->getUserValue($userId, Application::APP_ID, 'cardIdBadge', $defaultState);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function set($key, $value) {
|
public function set($key, $value) {
|
||||||
if ($this->getUserId() === null) {
|
$userId = $this->getUserId();
|
||||||
|
if ($userId === null) {
|
||||||
throw new NoPermissionException('Must be logged in to set user config');
|
throw new NoPermissionException('Must be logged in to set user config');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -140,21 +145,21 @@ class ConfigService {
|
|||||||
[$scope] = explode(':', $key, 2);
|
[$scope] = explode(':', $key, 2);
|
||||||
switch ($scope) {
|
switch ($scope) {
|
||||||
case 'groupLimit':
|
case 'groupLimit':
|
||||||
if (!$this->groupManager->isAdmin($this->getUserId())) {
|
if (!$this->groupManager->isAdmin($userId)) {
|
||||||
throw new NoPermissionException('You must be admin to set the group limit');
|
throw new NoPermissionException('You must be admin to set the group limit');
|
||||||
}
|
}
|
||||||
$result = $this->setGroupLimit($value);
|
$result = $this->setGroupLimit($value);
|
||||||
break;
|
break;
|
||||||
case 'calendar':
|
case 'calendar':
|
||||||
$this->config->setUserValue($this->getUserId(), Application::APP_ID, 'calendar', (string)$value);
|
$this->config->setUserValue($userId, Application::APP_ID, 'calendar', (string)$value);
|
||||||
$result = $value;
|
$result = $value;
|
||||||
break;
|
break;
|
||||||
case 'cardDetailsInModal':
|
case 'cardDetailsInModal':
|
||||||
$this->config->setUserValue($this->getUserId(), Application::APP_ID, 'cardDetailsInModal', (string)$value);
|
$this->config->setUserValue($userId, Application::APP_ID, 'cardDetailsInModal', (string)$value);
|
||||||
$result = $value;
|
$result = $value;
|
||||||
break;
|
break;
|
||||||
case 'cardIdBadge':
|
case 'cardIdBadge':
|
||||||
$this->config->setUserValue($this->getUserId(), Application::APP_ID, 'cardIdBadge', (string)$value);
|
$this->config->setUserValue($userId, Application::APP_ID, 'cardIdBadge', (string)$value);
|
||||||
$result = $value;
|
$result = $value;
|
||||||
break;
|
break;
|
||||||
case 'board':
|
case 'board':
|
||||||
@@ -162,7 +167,7 @@ class ConfigService {
|
|||||||
if ($boardConfigKey === 'notify-due' && !in_array($value, [self::SETTING_BOARD_NOTIFICATION_DUE_ALL, self::SETTING_BOARD_NOTIFICATION_DUE_ASSIGNED, self::SETTING_BOARD_NOTIFICATION_DUE_OFF], true)) {
|
if ($boardConfigKey === 'notify-due' && !in_array($value, [self::SETTING_BOARD_NOTIFICATION_DUE_ALL, self::SETTING_BOARD_NOTIFICATION_DUE_ASSIGNED, self::SETTING_BOARD_NOTIFICATION_DUE_OFF], true)) {
|
||||||
throw new BadRequestException('Board notification option must be one of: off, assigned, all');
|
throw new BadRequestException('Board notification option must be one of: off, assigned, all');
|
||||||
}
|
}
|
||||||
$this->config->setUserValue($this->getUserId(), Application::APP_ID, $key, (string)$value);
|
$this->config->setUserValue($userId, Application::APP_ID, $key, (string)$value);
|
||||||
$result = $value;
|
$result = $value;
|
||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
|
|||||||
@@ -124,18 +124,15 @@ class FullTextSearchService {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param int $cardId
|
|
||||||
*
|
|
||||||
* @return Board
|
|
||||||
* @throws DoesNotExistException
|
* @throws DoesNotExistException
|
||||||
* @throws MultipleObjectsReturnedException
|
* @throws MultipleObjectsReturnedException
|
||||||
*/
|
*/
|
||||||
public function getBoardFromCardId(int $cardId): Board {
|
public function getBoardFromCardId(int $cardId): Board {
|
||||||
$boardId = (int)$this->cardMapper->findBoardId($cardId);
|
$boardId = $this->cardMapper->findBoardId($cardId);
|
||||||
/** @var Board $board */
|
if ($boardId === null) {
|
||||||
$board = $this->boardMapper->find($boardId);
|
throw new DoesNotExistException("Board '$cardId' does not exist");
|
||||||
|
}
|
||||||
return $board;
|
return $this->boardMapper->find($boardId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -145,7 +142,7 @@ class FullTextSearchService {
|
|||||||
* @return Card[]
|
* @return Card[]
|
||||||
*/
|
*/
|
||||||
private function getCardsFromStack(int $stackId): array {
|
private function getCardsFromStack(int $stackId): array {
|
||||||
return $this->cardMapper->findAll($stackId, null, null);
|
return $this->cardMapper->findAll($stackId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -155,7 +152,7 @@ class FullTextSearchService {
|
|||||||
* @return Stack[]
|
* @return Stack[]
|
||||||
*/
|
*/
|
||||||
private function getStacksFromBoard(int $boardId): array {
|
private function getStacksFromBoard(int $boardId): array {
|
||||||
return $this->stackMapper->findAll($boardId, null, null);
|
return $this->stackMapper->findAll($boardId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -165,6 +162,6 @@ class FullTextSearchService {
|
|||||||
* @return Board[]
|
* @return Board[]
|
||||||
*/
|
*/
|
||||||
private function getBoardsFromUser(string $userId): array {
|
private function getBoardsFromUser(string $userId): array {
|
||||||
return $this->boardMapper->findAllByUser($userId, null, null, null);
|
return $this->boardMapper->findAllByUser($userId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,29 +19,25 @@ use OCP\Comments\IComment;
|
|||||||
abstract class ABoardImportService {
|
abstract class ABoardImportService {
|
||||||
/** @var string */
|
/** @var string */
|
||||||
public static $name = '';
|
public static $name = '';
|
||||||
/** @var BoardImportService */
|
private BoardImportService $boardImportService;
|
||||||
private $boardImportService;
|
protected bool $needValidateData = true;
|
||||||
/** @var bool */
|
|
||||||
protected $needValidateData = true;
|
|
||||||
/** @var Stack[] */
|
/** @var Stack[] */
|
||||||
protected $stacks = [];
|
protected array $stacks = [];
|
||||||
/** @var Label[] */
|
/** @var Label[] */
|
||||||
protected $labels = [];
|
protected array $labels = [];
|
||||||
/** @var Card[] */
|
/** @var Card[] */
|
||||||
protected $cards = [];
|
protected array $cards = [];
|
||||||
/** @var Acl[] */
|
/** @var Acl[] */
|
||||||
protected $acls = [];
|
protected array $acls = [];
|
||||||
/** @var IComment[][] */
|
/** @var IComment[][] */
|
||||||
protected $comments = [];
|
protected array $comments = [];
|
||||||
/** @var Assignment[] */
|
/** @var Assignment[] */
|
||||||
protected $assignments = [];
|
protected array $assignments = [];
|
||||||
/** @var string[][] */
|
/** @var int[][] */
|
||||||
protected $labelCardAssignments = [];
|
protected array $labelCardAssignments = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configure import service
|
* Configure import service
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
abstract public function bootstrap(): void;
|
abstract public function bootstrap(): void;
|
||||||
|
|
||||||
@@ -68,10 +64,13 @@ abstract class ABoardImportService {
|
|||||||
|
|
||||||
abstract public function getCardAssignments(): array;
|
abstract public function getCardAssignments(): array;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array<int, array<int, int>>
|
||||||
|
*/
|
||||||
abstract public function getCardLabelAssignment(): array;
|
abstract public function getCardLabelAssignment(): array;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return IComment[][]|array
|
* @return array<int, array<string, IComment>>
|
||||||
*/
|
*/
|
||||||
abstract public function getComments(): array;
|
abstract public function getComments(): array;
|
||||||
|
|
||||||
@@ -98,16 +97,16 @@ abstract class ABoardImportService {
|
|||||||
$this->acls[$code] = $acl;
|
$this->acls[$code] = $acl;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function updateComment(string $cardId, string $commentId, IComment $comment): void {
|
public function updateComment(int $cardId, string $commentId, IComment $comment): void {
|
||||||
$this->comments[$cardId][$commentId] = $comment;
|
$this->comments[$cardId][$commentId] = $comment;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function updateCardAssignment(string $cardId, string $assignmentId, Entity $assignment): void {
|
public function updateCardAssignment(int $cardId, int $assignmentId, Entity $assignment): void {
|
||||||
$this->assignments[$cardId][$assignmentId] = $assignment;
|
$this->assignments[$cardId][$assignmentId] = $assignment;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function updateCardLabelsAssignment(string $cardId, string $assignmentId, string $assignment): void {
|
public function updateCardLabelsAssignment(int $cardId, int $assignmentId, int $labelId): void {
|
||||||
$this->labelCardAssignments[$cardId][$assignmentId] = $assignment;
|
$this->labelCardAssignments[$cardId][$assignmentId] = $labelId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setImportService(BoardImportService $service): void {
|
public function setImportService(BoardImportService $service): void {
|
||||||
|
|||||||
@@ -209,14 +209,15 @@ class BoardImportService {
|
|||||||
|
|
||||||
public function importBoard(): void {
|
public function importBoard(): void {
|
||||||
$board = $this->getImportSystem()->getBoard();
|
$board = $this->getImportSystem()->getBoard();
|
||||||
|
if ($board === null) {
|
||||||
|
throw new \LogicException('Import board not found');
|
||||||
|
}
|
||||||
if (!$this->userManager->userExists($board->getOwner())) {
|
if (!$this->userManager->userExists($board->getOwner())) {
|
||||||
throw new \Exception('Target owner ' . $board->getOwner() . ' not found. Please provide a mapping through the import config.');
|
throw new \Exception('Target owner ' . $board->getOwner() . ' not found. Please provide a mapping through the import config.');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($board) {
|
$this->boardMapper->insert($board);
|
||||||
$this->boardMapper->insert($board);
|
$this->board = $board;
|
||||||
$this->board = $board;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getBoard(bool $reset = false): Board {
|
public function getBoard(bool $reset = false): Board {
|
||||||
@@ -292,12 +293,7 @@ class BoardImportService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function assignCardToLabel(int $cardId, int $labelId): self {
|
||||||
* @param mixed $cardId
|
|
||||||
* @param mixed $labelId
|
|
||||||
* @return self
|
|
||||||
*/
|
|
||||||
public function assignCardToLabel($cardId, $labelId): self {
|
|
||||||
$this->cardMapper->assignLabel(
|
$this->cardMapper->assignLabel(
|
||||||
$cardId,
|
$cardId,
|
||||||
$labelId
|
$labelId
|
||||||
@@ -307,14 +303,14 @@ class BoardImportService {
|
|||||||
|
|
||||||
public function assignCardsToLabels(): void {
|
public function assignCardsToLabels(): void {
|
||||||
$data = $this->getImportSystem()->getCardLabelAssignment();
|
$data = $this->getImportSystem()->getCardLabelAssignment();
|
||||||
foreach ($data as $cardId => $assignemnt) {
|
foreach ($data as $cardId => $assignment) {
|
||||||
foreach ($assignemnt as $assignmentId => $labelId) {
|
foreach ($assignment as $assignmentId => $labelId) {
|
||||||
try {
|
try {
|
||||||
$this->assignCardToLabel(
|
$this->assignCardToLabel(
|
||||||
$cardId,
|
(int)$cardId,
|
||||||
$labelId
|
$labelId
|
||||||
);
|
);
|
||||||
$this->getImportSystem()->updateCardLabelsAssignment($cardId, $assignmentId, $labelId);
|
$this->getImportSystem()->updateCardLabelsAssignment((int)$cardId, (int)$assignmentId, $labelId);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$this->addError('Failed to assign label ' . $labelId . ' to ' . $cardId, $e);
|
$this->addError('Failed to assign label ' . $labelId . ' to ' . $cardId, $e);
|
||||||
}
|
}
|
||||||
@@ -326,20 +322,20 @@ class BoardImportService {
|
|||||||
$allComments = $this->getImportSystem()->getComments();
|
$allComments = $this->getImportSystem()->getComments();
|
||||||
foreach ($allComments as $cardId => $comments) {
|
foreach ($allComments as $cardId => $comments) {
|
||||||
foreach ($comments as $commentId => $comment) {
|
foreach ($comments as $commentId => $comment) {
|
||||||
$this->insertComment($cardId, $comment);
|
$this->insertComment((int)$cardId, $comment);
|
||||||
$this->getImportSystem()->updateComment($cardId, $commentId, $comment);
|
$this->getImportSystem()->updateComment((int)$cardId, $commentId, $comment);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function insertComment(string $cardId, IComment $comment): void {
|
private function insertComment(int $cardId, IComment $comment): void {
|
||||||
$comment->setObject('deckCard', $cardId);
|
$comment->setObject('deckCard', (string)$cardId);
|
||||||
$comment->setVerb('comment');
|
$comment->setVerb('comment');
|
||||||
// Check if parent is a comment on the same card
|
// Check if parent is a comment on the same card
|
||||||
if ($comment->getParentId() !== '0') {
|
if ($comment->getParentId() !== '0') {
|
||||||
try {
|
try {
|
||||||
$parent = $this->commentsManager->get($comment->getParentId());
|
$parent = $this->commentsManager->get($comment->getParentId());
|
||||||
if ($parent->getObjectType() !== Application::COMMENT_ENTITY_TYPE || $parent->getObjectId() !== $cardId) {
|
if ($parent->getObjectType() !== Application::COMMENT_ENTITY_TYPE || (int)$parent->getObjectId() !== $cardId) {
|
||||||
throw new CommentNotFoundException();
|
throw new CommentNotFoundException();
|
||||||
}
|
}
|
||||||
} catch (CommentNotFoundException $e) {
|
} catch (CommentNotFoundException $e) {
|
||||||
@@ -362,7 +358,7 @@ class BoardImportService {
|
|||||||
foreach ($assignments as $assignment) {
|
foreach ($assignments as $assignment) {
|
||||||
try {
|
try {
|
||||||
$assignment = $this->assignmentMapper->insert($assignment);
|
$assignment = $this->assignmentMapper->insert($assignment);
|
||||||
$this->getImportSystem()->updateCardAssignment($cardId, (string)$assignment->getId(), $assignment);
|
$this->getImportSystem()->updateCardAssignment((int)$cardId, $assignment->getId(), $assignment);
|
||||||
$this->addOutput('Assignment ' . $assignment->getParticipant() . ' added');
|
$this->addOutput('Assignment ' . $assignment->getParticipant() . ' added');
|
||||||
} catch (NotFoundException $e) {
|
} catch (NotFoundException $e) {
|
||||||
$this->addError('No origin or mapping found for card "' . $cardId . '" and ' . $assignment->getTypeString() . ' assignment "' . $assignment->getParticipant(), $e);
|
$this->addError('No origin or mapping found for card "' . $cardId . '" and ' . $assignment->getTypeString() . ' assignment "' . $assignment->getParticipant(), $e);
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ use OCA\Deck\Db\Card;
|
|||||||
use OCA\Deck\Db\Label;
|
use OCA\Deck\Db\Label;
|
||||||
use OCA\Deck\Db\Stack;
|
use OCA\Deck\Db\Stack;
|
||||||
use OCA\Deck\Service\Importer\ABoardImportService;
|
use OCA\Deck\Service\Importer\ABoardImportService;
|
||||||
|
use OCP\Comments\IComment;
|
||||||
use OCP\IUser;
|
use OCP\IUser;
|
||||||
use OCP\IUserManager;
|
use OCP\IUserManager;
|
||||||
|
|
||||||
@@ -118,6 +119,7 @@ class DeckJsonService extends ABoardImportService {
|
|||||||
$comments[$this->cards[$sourceCard->id]->getId()][$commentOriginal->id] = $comment;
|
$comments[$this->cards[$sourceCard->id]->getId()][$commentOriginal->id] = $comment;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/** @var array<int, array<string, IComment>> */
|
||||||
return $comments;
|
return $comments;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ use Psr\Log\LoggerInterface;
|
|||||||
class TrelloApiService extends TrelloJsonService {
|
class TrelloApiService extends TrelloJsonService {
|
||||||
/** @var string */
|
/** @var string */
|
||||||
public static $name = 'Trello API';
|
public static $name = 'Trello API';
|
||||||
protected $needValidateData = false;
|
protected bool $needValidateData = false;
|
||||||
/** @var IClient */
|
/** @var IClient */
|
||||||
private $httpClient;
|
private $httpClient;
|
||||||
/** @var LoggerInterface */
|
/** @var LoggerInterface */
|
||||||
@@ -176,7 +176,7 @@ class TrelloApiService extends TrelloJsonService {
|
|||||||
if (empty($queryString['limit'])) {
|
if (empty($queryString['limit'])) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
if (count($data) < $queryString['limit']) {
|
if ((count($data) < $queryString['limit']) || (count($data) === 0)) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
$queryString['before'] = end($data)->id;
|
$queryString['before'] = end($data)->id;
|
||||||
|
|||||||
@@ -159,6 +159,7 @@ class TrelloJsonService extends ABoardImportService {
|
|||||||
$comments[$cardId][$commentId] = $comment;
|
$comments[$cardId][$commentId] = $comment;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/** @var array<int, array<string, IComment>> */
|
||||||
return $comments;
|
return $comments;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -43,33 +43,24 @@ class LabelService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $labelId
|
|
||||||
* @return \OCP\AppFramework\Db\Entity
|
|
||||||
* @throws \OCA\Deck\NoPermissionException
|
* @throws \OCA\Deck\NoPermissionException
|
||||||
* @throws \OCP\AppFramework\Db\DoesNotExistException
|
* @throws \OCP\AppFramework\Db\DoesNotExistException
|
||||||
* @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException
|
* @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException
|
||||||
* @throws BadRequestException
|
* @throws BadRequestException
|
||||||
*/
|
*/
|
||||||
public function find($labelId) {
|
public function find(int $labelId): Label {
|
||||||
if (is_numeric($labelId) === false) {
|
|
||||||
throw new BadRequestException('label id must be a number');
|
|
||||||
}
|
|
||||||
$this->permissionService->checkPermission($this->labelMapper, $labelId, Acl::PERMISSION_READ);
|
$this->permissionService->checkPermission($this->labelMapper, $labelId, Acl::PERMISSION_READ);
|
||||||
return $this->labelMapper->find($labelId);
|
return $this->labelMapper->find($labelId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $title
|
|
||||||
* @param $color
|
|
||||||
* @param $boardId
|
|
||||||
* @return \OCP\AppFramework\Db\Entity
|
|
||||||
* @throws StatusException
|
* @throws StatusException
|
||||||
* @throws \OCA\Deck\NoPermissionException
|
* @throws \OCA\Deck\NoPermissionException
|
||||||
* @throws \OCP\AppFramework\Db\DoesNotExistException
|
* @throws \OCP\AppFramework\Db\DoesNotExistException
|
||||||
* @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException
|
* @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException
|
||||||
* @throws BadRequestException
|
* @throws BadRequestException
|
||||||
*/
|
*/
|
||||||
public function create($title, $color, $boardId) {
|
public function create(string $title, string $color, int $boardId): Label {
|
||||||
$this->labelServiceValidator->check(compact('title', 'color', 'boardId'));
|
$this->labelServiceValidator->check(compact('title', 'color', 'boardId'));
|
||||||
|
|
||||||
$this->permissionService->checkPermission(null, $boardId, Acl::PERMISSION_MANAGE);
|
$this->permissionService->checkPermission(null, $boardId, Acl::PERMISSION_MANAGE);
|
||||||
@@ -106,15 +97,13 @@ class LabelService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $id
|
|
||||||
* @return \OCP\AppFramework\Db\Entity
|
|
||||||
* @throws StatusException
|
* @throws StatusException
|
||||||
* @throws \OCA\Deck\NoPermissionException
|
* @throws \OCA\Deck\NoPermissionException
|
||||||
* @throws \OCP\AppFramework\Db\DoesNotExistException
|
* @throws \OCP\AppFramework\Db\DoesNotExistException
|
||||||
* @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException
|
* @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException
|
||||||
* @throws BadRequestException
|
* @throws BadRequestException
|
||||||
*/
|
*/
|
||||||
public function delete($id) {
|
public function delete(int $id): Label {
|
||||||
$this->labelServiceValidator->check(compact('id'));
|
$this->labelServiceValidator->check(compact('id'));
|
||||||
|
|
||||||
$this->permissionService->checkPermission($this->labelMapper, $id, Acl::PERMISSION_MANAGE);
|
$this->permissionService->checkPermission($this->labelMapper, $id, Acl::PERMISSION_MANAGE);
|
||||||
@@ -127,17 +116,13 @@ class LabelService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $id
|
|
||||||
* @param $title
|
|
||||||
* @param $color
|
|
||||||
* @return \OCP\AppFramework\Db\Entity
|
|
||||||
* @throws StatusException
|
* @throws StatusException
|
||||||
* @throws \OCA\Deck\NoPermissionException
|
* @throws \OCA\Deck\NoPermissionException
|
||||||
* @throws \OCP\AppFramework\Db\DoesNotExistException
|
* @throws \OCP\AppFramework\Db\DoesNotExistException
|
||||||
* @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException
|
* @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException
|
||||||
* @throws BadRequestException
|
* @throws BadRequestException
|
||||||
*/
|
*/
|
||||||
public function update($id, $title, $color) {
|
public function update(int $id, string $title, string $color): Label {
|
||||||
$this->labelServiceValidator->check(compact('title', 'color', 'id'));
|
$this->labelServiceValidator->check(compact('title', 'color', 'id'));
|
||||||
|
|
||||||
$this->permissionService->checkPermission($this->labelMapper, $id, Acl::PERMISSION_MANAGE);
|
$this->permissionService->checkPermission($this->labelMapper, $id, Acl::PERMISSION_MANAGE);
|
||||||
|
|||||||
@@ -9,53 +9,28 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace OCA\Deck\Service;
|
namespace OCA\Deck\Service;
|
||||||
|
|
||||||
use OCA\Deck\Db\AssignmentMapper;
|
|
||||||
use OCA\Deck\Db\Board;
|
use OCA\Deck\Db\Board;
|
||||||
use OCA\Deck\Db\BoardMapper;
|
use OCA\Deck\Db\BoardMapper;
|
||||||
use OCA\Deck\Db\CardMapper;
|
use OCA\Deck\Db\CardMapper;
|
||||||
use OCA\Deck\Db\LabelMapper;
|
|
||||||
use OCA\Deck\Model\CardDetails;
|
use OCA\Deck\Model\CardDetails;
|
||||||
use OCP\Comments\ICommentsManager;
|
|
||||||
use OCP\IUserManager;
|
|
||||||
|
|
||||||
class OverviewService {
|
class OverviewService {
|
||||||
private CardService $cardService;
|
|
||||||
private BoardMapper $boardMapper;
|
|
||||||
private LabelMapper $labelMapper;
|
|
||||||
private CardMapper $cardMapper;
|
|
||||||
private AssignmentMapper $assignedUsersMapper;
|
|
||||||
private IUserManager $userManager;
|
|
||||||
private ICommentsManager $commentsManager;
|
|
||||||
private AttachmentService $attachmentService;
|
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
CardService $cardService,
|
private readonly CardService $cardService,
|
||||||
BoardMapper $boardMapper,
|
private readonly BoardMapper $boardMapper,
|
||||||
LabelMapper $labelMapper,
|
private readonly CardMapper $cardMapper,
|
||||||
CardMapper $cardMapper,
|
|
||||||
AssignmentMapper $assignedUsersMapper,
|
|
||||||
IUserManager $userManager,
|
|
||||||
ICommentsManager $commentsManager,
|
|
||||||
AttachmentService $attachmentService,
|
|
||||||
) {
|
) {
|
||||||
$this->cardService = $cardService;
|
|
||||||
$this->boardMapper = $boardMapper;
|
|
||||||
$this->labelMapper = $labelMapper;
|
|
||||||
$this->cardMapper = $cardMapper;
|
|
||||||
$this->assignedUsersMapper = $assignedUsersMapper;
|
|
||||||
$this->userManager = $userManager;
|
|
||||||
$this->commentsManager = $commentsManager;
|
|
||||||
$this->attachmentService = $attachmentService;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function findUpcomingCards(string $userId): array {
|
public function findUpcomingCards(string $userId): array {
|
||||||
$userBoards = $this->boardMapper->findAllForUser($userId);
|
$userBoards = $this->boardMapper->findAllForUser($userId);
|
||||||
|
|
||||||
$boardOwnerIds = array_filter(array_map(function (Board $board) {
|
$boardOwnerIds = array_filter(array_map(function (Board $board) {
|
||||||
return count($board->getAcl()) === 0 ? $board->getId() : null;
|
return count($board->getAcl() ?? []) === 0 ? $board->getId() : null;
|
||||||
}, $userBoards));
|
}, $userBoards));
|
||||||
$boardSharedIds = array_filter(array_map(function (Board $board) {
|
$boardSharedIds = array_filter(array_map(function (Board $board) {
|
||||||
return count($board->getAcl()) > 0 ? $board->getId() : null;
|
return count($board->getAcl() ?? []) > 0 ? $board->getId() : null;
|
||||||
}, $userBoards));
|
}, $userBoards));
|
||||||
|
|
||||||
$foundCards = array_merge(
|
$foundCards = array_merge(
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ class PermissionService {
|
|||||||
private array $users = [];
|
private array $users = [];
|
||||||
|
|
||||||
private CappedMemoryCache $boardCache;
|
private CappedMemoryCache $boardCache;
|
||||||
|
/** @var CappedMemoryCache<array<Acl::PERMISSION_*, bool>> */
|
||||||
private CappedMemoryCache $permissionCache;
|
private CappedMemoryCache $permissionCache;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
@@ -49,15 +50,16 @@ class PermissionService {
|
|||||||
/**
|
/**
|
||||||
* Get current user permissions for a board by id
|
* Get current user permissions for a board by id
|
||||||
*
|
*
|
||||||
* @return bool|array
|
* @return array<Acl::PERMISSION_*, bool>
|
||||||
*/
|
*/
|
||||||
public function getPermissions(int $boardId, ?string $userId = null) {
|
public function getPermissions(int $boardId, ?string $userId = null): array {
|
||||||
if ($userId === null) {
|
if ($userId === null) {
|
||||||
$userId = $this->userId;
|
$userId = $this->userId;
|
||||||
}
|
}
|
||||||
|
|
||||||
$cacheKey = $boardId . '-' . $userId;
|
$cacheKey = $boardId . '-' . $userId;
|
||||||
if ($cached = $this->permissionCache->get($cacheKey)) {
|
if ($cached = $this->permissionCache->get($cacheKey)) {
|
||||||
|
/** @var array<Acl::PERMISSION_*, bool> $cached */
|
||||||
return $cached;
|
return $cached;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -75,35 +75,31 @@ class StackService {
|
|||||||
$this->stackServiceValidator = $stackServiceValidator;
|
$this->stackServiceValidator = $stackServiceValidator;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function enrichStackWithCards($stack, $since = -1) {
|
/** @param Stack[] $stacks */
|
||||||
$cards = $this->cardMapper->findAll($stack->getId(), null, null, $since);
|
private function enrichStacksWithCards(array $stacks, $since = -1): void {
|
||||||
|
$cardsByStackId = $this->cardMapper->findAllForStacks(array_map(fn (Stack $stack) => $stack->getId(), $stacks), null, 0, $since);
|
||||||
|
|
||||||
if (\count($cards) === 0) {
|
foreach ($cardsByStackId as $stackId => $cards) {
|
||||||
return;
|
if (!$cards) {
|
||||||
}
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
$stack->setCards($this->cardService->enrichCards($cards));
|
|
||||||
}
|
|
||||||
|
|
||||||
private function enrichStacksWithCards($stacks, $since = -1) {
|
foreach ($stacks as $stack) {
|
||||||
foreach ($stacks as $stack) {
|
if ($stack->getId() === $stackId) {
|
||||||
$this->enrichStackWithCards($stack, $since);
|
$stack->setCards($this->cardService->enrichCards($cards));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $stackId
|
|
||||||
*
|
|
||||||
* @return \OCP\AppFramework\Db\Entity
|
|
||||||
* @throws \OCP\AppFramework\Db\DoesNotExistException
|
* @throws \OCP\AppFramework\Db\DoesNotExistException
|
||||||
* @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException
|
* @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException
|
||||||
* @throws BadRequestException
|
* @throws BadRequestException
|
||||||
*/
|
*/
|
||||||
public function find($stackId) {
|
public function find(int $stackId): Stack {
|
||||||
if (is_numeric($stackId) === false) {
|
|
||||||
throw new BadRequestException('stack id must be a number');
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->permissionService->checkPermission($this->stackMapper, $stackId, Acl::PERMISSION_READ);
|
$this->permissionService->checkPermission($this->stackMapper, $stackId, Acl::PERMISSION_READ);
|
||||||
$stack = $this->stackMapper->find($stackId);
|
$stack = $this->stackMapper->find($stackId);
|
||||||
|
|
||||||
@@ -124,17 +120,11 @@ class StackService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $boardId
|
* @return Stack[]
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
* @throws \OCA\Deck\NoPermissionException
|
* @throws \OCA\Deck\NoPermissionException
|
||||||
* @throws BadRequestException
|
* @throws BadRequestException
|
||||||
*/
|
*/
|
||||||
public function findAll($boardId, $since = -1) {
|
public function findAll(int $boardId, int $since = -1): array {
|
||||||
if (is_numeric($boardId) === false) {
|
|
||||||
throw new BadRequestException('boardId must be a number');
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->permissionService->checkPermission(null, $boardId, Acl::PERMISSION_READ);
|
$this->permissionService->checkPermission(null, $boardId, Acl::PERMISSION_READ);
|
||||||
$stacks = $this->stackMapper->findAll($boardId);
|
$stacks = $this->stackMapper->findAll($boardId);
|
||||||
$this->enrichStacksWithCards($stacks, $since);
|
$this->enrichStacksWithCards($stacks, $since);
|
||||||
@@ -142,7 +132,11 @@ class StackService {
|
|||||||
return $stacks;
|
return $stacks;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function findCalendarEntries($boardId) {
|
/**
|
||||||
|
* @return Stack[]
|
||||||
|
* @throws \OCP\DB\Exception
|
||||||
|
*/
|
||||||
|
public function findCalendarEntries(int $boardId): array {
|
||||||
try {
|
try {
|
||||||
$this->permissionService->checkPermission(null, $boardId, Acl::PERMISSION_READ);
|
$this->permissionService->checkPermission(null, $boardId, Acl::PERMISSION_READ);
|
||||||
} catch (NoPermissionException $e) {
|
} catch (NoPermissionException $e) {
|
||||||
@@ -152,7 +146,11 @@ class StackService {
|
|||||||
return $this->stackMapper->findAll($boardId);
|
return $this->stackMapper->findAll($boardId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function fetchDeleted($boardId) {
|
/**
|
||||||
|
* @return Stack[]
|
||||||
|
* @throws \OCP\DB\Exception
|
||||||
|
*/
|
||||||
|
public function fetchDeleted(int $boardId): array {
|
||||||
$this->permissionService->checkPermission($this->boardMapper, $boardId, Acl::PERMISSION_READ);
|
$this->permissionService->checkPermission($this->boardMapper, $boardId, Acl::PERMISSION_READ);
|
||||||
$stacks = $this->stackMapper->findDeleted($boardId);
|
$stacks = $this->stackMapper->findDeleted($boardId);
|
||||||
$this->enrichStacksWithCards($stacks);
|
$this->enrichStacksWithCards($stacks);
|
||||||
@@ -161,17 +159,11 @@ class StackService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $boardId
|
* @return Stack[]
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
* @throws \OCA\Deck\NoPermissionException
|
* @throws \OCA\Deck\NoPermissionException
|
||||||
* @throws BadRequestException
|
* @throws BadRequestException
|
||||||
*/
|
*/
|
||||||
public function findAllArchived($boardId) {
|
public function findAllArchived(int $boardId): array {
|
||||||
if (is_numeric($boardId) === false) {
|
|
||||||
throw new BadRequestException('board id must be a number');
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->permissionService->checkPermission(null, $boardId, Acl::PERMISSION_READ);
|
$this->permissionService->checkPermission(null, $boardId, Acl::PERMISSION_READ);
|
||||||
$stacks = $this->stackMapper->findAll($boardId);
|
$stacks = $this->stackMapper->findAll($boardId);
|
||||||
$labels = $this->labelMapper->getAssignedLabelsForBoard($boardId);
|
$labels = $this->labelMapper->getAssignedLabelsForBoard($boardId);
|
||||||
@@ -186,22 +178,18 @@ class StackService {
|
|||||||
$stacks[$stackIndex]->setCards($cards);
|
$stacks[$stackIndex]->setCards($cards);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @var Stack[] $stacks */
|
||||||
return $stacks;
|
return $stacks;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $title
|
|
||||||
* @param $boardId
|
|
||||||
* @param integer $order
|
|
||||||
*
|
|
||||||
* @return \OCP\AppFramework\Db\Entity
|
|
||||||
* @throws StatusException
|
* @throws StatusException
|
||||||
* @throws \OCA\Deck\NoPermissionException
|
* @throws \OCA\Deck\NoPermissionException
|
||||||
* @throws \OCP\AppFramework\Db\DoesNotExistException
|
* @throws \OCP\AppFramework\Db\DoesNotExistException
|
||||||
* @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException
|
* @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException
|
||||||
* @throws BadRequestException
|
* @throws BadRequestException
|
||||||
*/
|
*/
|
||||||
public function create($title, $boardId, $order) {
|
public function create(string $title, int $boardId, int $order): Stack {
|
||||||
$this->stackServiceValidator->check(compact('title', 'boardId', 'order'));
|
$this->stackServiceValidator->check(compact('title', 'boardId', 'order'));
|
||||||
|
|
||||||
$this->permissionService->checkPermission(null, $boardId, Acl::PERMISSION_MANAGE);
|
$this->permissionService->checkPermission(null, $boardId, Acl::PERMISSION_MANAGE);
|
||||||
@@ -223,19 +211,13 @@ class StackService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $id
|
* @return Stack The deleted stack.
|
||||||
*
|
|
||||||
* @return \OCP\AppFramework\Db\Entity
|
|
||||||
* @throws \OCA\Deck\NoPermissionException
|
* @throws \OCA\Deck\NoPermissionException
|
||||||
* @throws \OCP\AppFramework\Db\DoesNotExistException
|
* @throws \OCP\AppFramework\Db\DoesNotExistException
|
||||||
* @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException
|
* @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException
|
||||||
* @throws BadRequestException
|
* @throws BadRequestException
|
||||||
*/
|
*/
|
||||||
public function delete($id) {
|
public function delete(int $id): Stack {
|
||||||
if (is_numeric($id) === false) {
|
|
||||||
throw new BadRequestException('stack id must be a number');
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->permissionService->checkPermission($this->stackMapper, $id, Acl::PERMISSION_MANAGE);
|
$this->permissionService->checkPermission($this->stackMapper, $id, Acl::PERMISSION_MANAGE);
|
||||||
|
|
||||||
$stack = $this->stackMapper->find($id);
|
$stack = $this->stackMapper->find($id);
|
||||||
@@ -247,26 +229,19 @@ class StackService {
|
|||||||
);
|
);
|
||||||
$this->changeHelper->boardChanged($stack->getBoardId());
|
$this->changeHelper->boardChanged($stack->getBoardId());
|
||||||
$this->eventDispatcher->dispatchTyped(new BoardUpdatedEvent($stack->getBoardId()));
|
$this->eventDispatcher->dispatchTyped(new BoardUpdatedEvent($stack->getBoardId()));
|
||||||
$this->enrichStackWithCards($stack);
|
$this->enrichStacksWithCards([$stack]);
|
||||||
|
|
||||||
return $stack;
|
return $stack;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $id
|
|
||||||
* @param $title
|
|
||||||
* @param $boardId
|
|
||||||
* @param $order
|
|
||||||
* @param $deletedAt
|
|
||||||
*
|
|
||||||
* @return \OCP\AppFramework\Db\Entity
|
|
||||||
* @throws StatusException
|
* @throws StatusException
|
||||||
* @throws \OCA\Deck\NoPermissionException
|
* @throws \OCA\Deck\NoPermissionException
|
||||||
* @throws \OCP\AppFramework\Db\DoesNotExistException
|
* @throws \OCP\AppFramework\Db\DoesNotExistException
|
||||||
* @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException
|
* @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException
|
||||||
* @throws BadRequestException
|
* @throws BadRequestException
|
||||||
*/
|
*/
|
||||||
public function update($id, $title, $boardId, $order, $deletedAt) {
|
public function update(int $id, string $title, int $boardId, int $order, ?int $deletedAt): Stack {
|
||||||
$this->stackServiceValidator->check(compact('id', 'title', 'boardId', 'order'));
|
$this->stackServiceValidator->check(compact('id', 'title', 'boardId', 'order'));
|
||||||
|
|
||||||
$this->permissionService->checkPermission($this->stackMapper, $id, Acl::PERMISSION_MANAGE);
|
$this->permissionService->checkPermission($this->stackMapper, $id, Acl::PERMISSION_MANAGE);
|
||||||
@@ -294,16 +269,13 @@ class StackService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $id
|
* @return array<int, Stack> The stacks in the correct order.
|
||||||
* @param $order
|
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
* @throws \OCA\Deck\NoPermissionException
|
* @throws \OCA\Deck\NoPermissionException
|
||||||
* @throws \OCP\AppFramework\Db\DoesNotExistException
|
* @throws \OCP\AppFramework\Db\DoesNotExistException
|
||||||
* @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException
|
* @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException
|
||||||
* @throws BadRequestException
|
* @throws BadRequestException
|
||||||
*/
|
*/
|
||||||
public function reorder($id, $order) {
|
public function reorder(int $id, int $order): array {
|
||||||
$this->stackServiceValidator->check(compact('id', 'order'));
|
$this->stackServiceValidator->check(compact('id', 'order'));
|
||||||
|
|
||||||
$this->permissionService->checkPermission($this->stackMapper, $id, Acl::PERMISSION_MANAGE);
|
$this->permissionService->checkPermission($this->stackMapper, $id, Acl::PERMISSION_MANAGE);
|
||||||
@@ -324,7 +296,7 @@ class StackService {
|
|||||||
if ($stack->id !== $id) {
|
if ($stack->id !== $id) {
|
||||||
$stack->setOrder($i++);
|
$stack->setOrder($i++);
|
||||||
}
|
}
|
||||||
$this->stackMapper->update($stack);
|
$stack = $this->stackMapper->update($stack);
|
||||||
$result[$stack->getOrder()] = $stack;
|
$result[$stack->getOrder()] = $stack;
|
||||||
}
|
}
|
||||||
$this->changeHelper->boardChanged($stackToSort->getBoardId());
|
$this->changeHelper->boardChanged($stackToSort->getBoardId());
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ namespace OCA\Deck\Sharing;
|
|||||||
use OC\Files\Cache\Cache;
|
use OC\Files\Cache\Cache;
|
||||||
use OCA\Deck\Cache\AttachmentCacheHelper;
|
use OCA\Deck\Cache\AttachmentCacheHelper;
|
||||||
use OCA\Deck\Db\Acl;
|
use OCA\Deck\Db\Acl;
|
||||||
use OCA\Deck\Db\Board;
|
|
||||||
use OCA\Deck\Db\BoardMapper;
|
use OCA\Deck\Db\BoardMapper;
|
||||||
use OCA\Deck\Db\CardMapper;
|
use OCA\Deck\Db\CardMapper;
|
||||||
use OCA\Deck\Db\User;
|
use OCA\Deck\Db\User;
|
||||||
@@ -99,9 +98,13 @@ class DeckShareProvider implements \OCP\Share\IShareProvider {
|
|||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public function create(IShare $share) {
|
public function create(IShare $share) {
|
||||||
$cardId = $share->getSharedWith();
|
$cardId = (int)$share->getSharedWith();
|
||||||
$boardId = $this->cardMapper->findBoardId($cardId);
|
$boardId = $this->cardMapper->findBoardId($cardId);
|
||||||
$valid = $boardId !== null;
|
$valid = $boardId !== null;
|
||||||
|
if (!$valid) {
|
||||||
|
throw new GenericShareException('Card not found', $this->l->t('Card not found'), 404);
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$this->permissionService->checkPermission(null, $boardId, Acl::PERMISSION_EDIT);
|
$this->permissionService->checkPermission(null, $boardId, Acl::PERMISSION_EDIT);
|
||||||
} catch (NoPermissionException $e) {
|
} catch (NoPermissionException $e) {
|
||||||
@@ -147,7 +150,7 @@ class DeckShareProvider implements \OCP\Share\IShareProvider {
|
|||||||
);
|
);
|
||||||
$data = $this->getRawShare($shareId);
|
$data = $this->getRawShare($shareId);
|
||||||
|
|
||||||
$this->attachmentCacheHelper->clearAttachmentCount((int)$cardId);
|
$this->attachmentCacheHelper->clearAttachmentCount($cardId);
|
||||||
|
|
||||||
return $this->createShareObject($data);
|
return $this->createShareObject($data);
|
||||||
}
|
}
|
||||||
@@ -213,7 +216,7 @@ class DeckShareProvider implements \OCP\Share\IShareProvider {
|
|||||||
->from('share')
|
->from('share')
|
||||||
->where($qb->expr()->eq('id', $qb->createNamedParameter($id)));
|
->where($qb->expr()->eq('id', $qb->createNamedParameter($id)));
|
||||||
|
|
||||||
$cursor = $qb->execute();
|
$cursor = $qb->executeQuery();
|
||||||
$data = $cursor->fetch();
|
$data = $cursor->fetch();
|
||||||
$cursor->closeCursor();
|
$cursor->closeCursor();
|
||||||
|
|
||||||
@@ -297,7 +300,7 @@ class DeckShareProvider implements \OCP\Share\IShareProvider {
|
|||||||
->set('item_source', $qb->createNamedParameter($share->getNode()->getId()))
|
->set('item_source', $qb->createNamedParameter($share->getNode()->getId()))
|
||||||
->set('file_source', $qb->createNamedParameter($share->getNode()->getId()))
|
->set('file_source', $qb->createNamedParameter($share->getNode()->getId()))
|
||||||
->set('expiration', $qb->createNamedParameter($share->getExpirationDate(), IQueryBuilder::PARAM_DATE))
|
->set('expiration', $qb->createNamedParameter($share->getExpirationDate(), IQueryBuilder::PARAM_DATE))
|
||||||
->execute();
|
->executeStatement();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Update all user defined group shares
|
* Update all user defined group shares
|
||||||
@@ -310,7 +313,7 @@ class DeckShareProvider implements \OCP\Share\IShareProvider {
|
|||||||
->set('item_source', $qb->createNamedParameter($share->getNode()->getId()))
|
->set('item_source', $qb->createNamedParameter($share->getNode()->getId()))
|
||||||
->set('file_source', $qb->createNamedParameter($share->getNode()->getId()))
|
->set('file_source', $qb->createNamedParameter($share->getNode()->getId()))
|
||||||
->set('expiration', $qb->createNamedParameter($share->getExpirationDate(), IQueryBuilder::PARAM_DATE))
|
->set('expiration', $qb->createNamedParameter($share->getExpirationDate(), IQueryBuilder::PARAM_DATE))
|
||||||
->execute();
|
->executeStatement();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Now update the permissions for all children that have not set it to 0
|
* Now update the permissions for all children that have not set it to 0
|
||||||
@@ -320,7 +323,7 @@ class DeckShareProvider implements \OCP\Share\IShareProvider {
|
|||||||
->where($qb->expr()->eq('parent', $qb->createNamedParameter($share->getId())))
|
->where($qb->expr()->eq('parent', $qb->createNamedParameter($share->getId())))
|
||||||
->andWhere($qb->expr()->neq('permissions', $qb->createNamedParameter(0)))
|
->andWhere($qb->expr()->neq('permissions', $qb->createNamedParameter(0)))
|
||||||
->set('permissions', $qb->createNamedParameter($share->getPermissions()))
|
->set('permissions', $qb->createNamedParameter($share->getPermissions()))
|
||||||
->execute();
|
->executeStatement();
|
||||||
|
|
||||||
return $share;
|
return $share;
|
||||||
}
|
}
|
||||||
@@ -335,7 +338,7 @@ class DeckShareProvider implements \OCP\Share\IShareProvider {
|
|||||||
|
|
||||||
$qb->orWhere($qb->expr()->eq('parent', $qb->createNamedParameter($share->getId())));
|
$qb->orWhere($qb->expr()->eq('parent', $qb->createNamedParameter($share->getId())));
|
||||||
|
|
||||||
$qb->execute();
|
$qb->executeStatement();
|
||||||
|
|
||||||
$this->attachmentCacheHelper->clearAttachmentCount((int)$share->getSharedWith());
|
$this->attachmentCacheHelper->clearAttachmentCount((int)$share->getSharedWith());
|
||||||
}
|
}
|
||||||
@@ -355,7 +358,7 @@ class DeckShareProvider implements \OCP\Share\IShareProvider {
|
|||||||
$qb->expr()->eq('item_type', $qb->createNamedParameter('file')),
|
$qb->expr()->eq('item_type', $qb->createNamedParameter('file')),
|
||||||
$qb->expr()->eq('item_type', $qb->createNamedParameter('folder'))
|
$qb->expr()->eq('item_type', $qb->createNamedParameter('folder'))
|
||||||
))
|
))
|
||||||
->execute();
|
->executeQuery();
|
||||||
|
|
||||||
$data = $stmt->fetch();
|
$data = $stmt->fetch();
|
||||||
$stmt->closeCursor();
|
$stmt->closeCursor();
|
||||||
@@ -376,14 +379,14 @@ class DeckShareProvider implements \OCP\Share\IShareProvider {
|
|||||||
'file_target' => $qb->createNamedParameter($share->getTarget()),
|
'file_target' => $qb->createNamedParameter($share->getTarget()),
|
||||||
'permissions' => $qb->createNamedParameter(0),
|
'permissions' => $qb->createNamedParameter(0),
|
||||||
'stime' => $qb->createNamedParameter($share->getShareTime()->getTimestamp()),
|
'stime' => $qb->createNamedParameter($share->getShareTime()->getTimestamp()),
|
||||||
])->execute();
|
])->executeStatement();
|
||||||
} elseif ($data['permissions'] !== 0) {
|
} elseif ($data['permissions'] !== 0) {
|
||||||
// Already a userroom share. Update it.
|
// Already a userroom share. Update it.
|
||||||
$qb = $this->dbConnection->getQueryBuilder();
|
$qb = $this->dbConnection->getQueryBuilder();
|
||||||
$qb->update('share')
|
$qb->update('share')
|
||||||
->set('permissions', $qb->createNamedParameter(0))
|
->set('permissions', $qb->createNamedParameter(0))
|
||||||
->where($qb->expr()->eq('id', $qb->createNamedParameter($data['id'])))
|
->where($qb->expr()->eq('id', $qb->createNamedParameter($data['id'])))
|
||||||
->execute();
|
->executeStatement();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -397,7 +400,7 @@ class DeckShareProvider implements \OCP\Share\IShareProvider {
|
|||||||
->where(
|
->where(
|
||||||
$qb->expr()->eq('id', $qb->createNamedParameter($share->getId()))
|
$qb->expr()->eq('id', $qb->createNamedParameter($share->getId()))
|
||||||
);
|
);
|
||||||
$cursor = $qb->execute();
|
$cursor = $qb->executeQuery();
|
||||||
$data = $cursor->fetch();
|
$data = $cursor->fetch();
|
||||||
$cursor->closeCursor();
|
$cursor->closeCursor();
|
||||||
|
|
||||||
@@ -414,7 +417,7 @@ class DeckShareProvider implements \OCP\Share\IShareProvider {
|
|||||||
$qb->expr()->eq('share_with', $qb->createNamedParameter($recipient))
|
$qb->expr()->eq('share_with', $qb->createNamedParameter($recipient))
|
||||||
);
|
);
|
||||||
|
|
||||||
$qb->execute();
|
$qb->executeStatement();
|
||||||
|
|
||||||
return $this->getShareById((int)$share->getId(), $recipient);
|
return $this->getShareById((int)$share->getId(), $recipient);
|
||||||
}
|
}
|
||||||
@@ -435,7 +438,7 @@ class DeckShareProvider implements \OCP\Share\IShareProvider {
|
|||||||
$qb->expr()->eq('item_type', $qb->createNamedParameter('folder'))
|
$qb->expr()->eq('item_type', $qb->createNamedParameter('folder'))
|
||||||
))
|
))
|
||||||
->setMaxResults(1)
|
->setMaxResults(1)
|
||||||
->execute();
|
->executeQuery();
|
||||||
|
|
||||||
$data = $stmt->fetch();
|
$data = $stmt->fetch();
|
||||||
$stmt->closeCursor();
|
$stmt->closeCursor();
|
||||||
@@ -509,7 +512,7 @@ class DeckShareProvider implements \OCP\Share\IShareProvider {
|
|||||||
|
|
||||||
$qb->orderBy('s.id');
|
$qb->orderBy('s.id');
|
||||||
|
|
||||||
$cursor = $qb->execute();
|
$cursor = $qb->executeQuery();
|
||||||
$shares = [];
|
$shares = [];
|
||||||
while ($data = $cursor->fetch()) {
|
while ($data = $cursor->fetch()) {
|
||||||
$shares[$data['fileid']][] = $this->createShareObject($data);
|
$shares[$data['fileid']][] = $this->createShareObject($data);
|
||||||
@@ -554,7 +557,7 @@ class DeckShareProvider implements \OCP\Share\IShareProvider {
|
|||||||
$qb->setFirstResult($offset);
|
$qb->setFirstResult($offset);
|
||||||
$qb->orderBy('id');
|
$qb->orderBy('id');
|
||||||
|
|
||||||
$cursor = $qb->execute();
|
$cursor = $qb->executeQuery();
|
||||||
$shares = [];
|
$shares = [];
|
||||||
while ($data = $cursor->fetch()) {
|
while ($data = $cursor->fetch()) {
|
||||||
$shares[] = $this->createShareObject($data);
|
$shares[] = $this->createShareObject($data);
|
||||||
@@ -582,7 +585,7 @@ class DeckShareProvider implements \OCP\Share\IShareProvider {
|
|||||||
->where($qb->expr()->eq('s.id', $qb->createNamedParameter($id)))
|
->where($qb->expr()->eq('s.id', $qb->createNamedParameter($id)))
|
||||||
->andWhere($qb->expr()->eq('s.share_type', $qb->createNamedParameter(IShare::TYPE_DECK)));
|
->andWhere($qb->expr()->eq('s.share_type', $qb->createNamedParameter(IShare::TYPE_DECK)));
|
||||||
|
|
||||||
$cursor = $qb->execute();
|
$cursor = $qb->executeQuery();
|
||||||
$data = $cursor->fetch();
|
$data = $cursor->fetch();
|
||||||
$cursor->closeCursor();
|
$cursor->closeCursor();
|
||||||
|
|
||||||
@@ -647,7 +650,7 @@ class DeckShareProvider implements \OCP\Share\IShareProvider {
|
|||||||
$qb->expr()->eq('item_type', $qb->createNamedParameter('folder'))
|
$qb->expr()->eq('item_type', $qb->createNamedParameter('folder'))
|
||||||
));
|
));
|
||||||
|
|
||||||
$stmt = $query->execute();
|
$stmt = $query->executeQuery();
|
||||||
|
|
||||||
while ($data = $stmt->fetch()) {
|
while ($data = $stmt->fetch()) {
|
||||||
$this->applyBoardPermission($shareMap[$data['parent']], (int)$data['permissions'], $userId);
|
$this->applyBoardPermission($shareMap[$data['parent']], (int)$data['permissions'], $userId);
|
||||||
@@ -677,7 +680,7 @@ class DeckShareProvider implements \OCP\Share\IShareProvider {
|
|||||||
->from('share')
|
->from('share')
|
||||||
->andWhere($qb->expr()->eq('file_source', $qb->createNamedParameter($path->getId())))
|
->andWhere($qb->expr()->eq('file_source', $qb->createNamedParameter($path->getId())))
|
||||||
->andWhere($qb->expr()->eq('share_type', $qb->createNamedParameter(IShare::TYPE_DECK)))
|
->andWhere($qb->expr()->eq('share_type', $qb->createNamedParameter(IShare::TYPE_DECK)))
|
||||||
->execute();
|
->executeQuery();
|
||||||
|
|
||||||
$shares = [];
|
$shares = [];
|
||||||
while ($data = $cursor->fetch()) {
|
while ($data = $cursor->fetch()) {
|
||||||
@@ -749,7 +752,7 @@ class DeckShareProvider implements \OCP\Share\IShareProvider {
|
|||||||
|
|
||||||
$qb->andWhere($qb->expr()->eq('dc.deleted_at', $qb->createNamedParameter(0, IQueryBuilder::PARAM_INT)));
|
$qb->andWhere($qb->expr()->eq('dc.deleted_at', $qb->createNamedParameter(0, IQueryBuilder::PARAM_INT)));
|
||||||
|
|
||||||
$cursor = $qb->execute();
|
$cursor = $qb->executeQuery();
|
||||||
while ($data = $cursor->fetch()) {
|
while ($data = $cursor->fetch()) {
|
||||||
if (!$this->isAccessibleResult($data)) {
|
if (!$this->isAccessibleResult($data)) {
|
||||||
continue;
|
continue;
|
||||||
@@ -842,6 +845,7 @@ class DeckShareProvider implements \OCP\Share\IShareProvider {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
|
* @psalm-suppress InvalidReturnType Not returning anything
|
||||||
*/
|
*/
|
||||||
public function getShareByToken($token) {
|
public function getShareByToken($token) {
|
||||||
throw new ShareNotFound();
|
throw new ShareNotFound();
|
||||||
@@ -851,7 +855,7 @@ class DeckShareProvider implements \OCP\Share\IShareProvider {
|
|||||||
->from('share')
|
->from('share')
|
||||||
->where($qb->expr()->eq('share_type', $qb->createNamedParameter(IShare::TYPE_ROOM)))
|
->where($qb->expr()->eq('share_type', $qb->createNamedParameter(IShare::TYPE_ROOM)))
|
||||||
->andWhere($qb->expr()->eq('token', $qb->createNamedParameter($token)))
|
->andWhere($qb->expr()->eq('token', $qb->createNamedParameter($token)))
|
||||||
->execute();
|
->executeQuery();
|
||||||
|
|
||||||
$data = $cursor->fetch();
|
$data = $cursor->fetch();
|
||||||
|
|
||||||
@@ -1015,7 +1019,7 @@ class DeckShareProvider implements \OCP\Share\IShareProvider {
|
|||||||
->andWhere($qb->expr()->eq('share_type', $qb->createNamedParameter(IShare::TYPE_DECK)))
|
->andWhere($qb->expr()->eq('share_type', $qb->createNamedParameter(IShare::TYPE_DECK)))
|
||||||
->orderBy('id');
|
->orderBy('id');
|
||||||
|
|
||||||
$cursor = $qb->execute();
|
$cursor = $qb->executeQuery();
|
||||||
while ($data = $cursor->fetch()) {
|
while ($data = $cursor->fetch()) {
|
||||||
$children[] = $this->createShareObject($data);
|
$children[] = $this->createShareObject($data);
|
||||||
}
|
}
|
||||||
@@ -1038,7 +1042,7 @@ class DeckShareProvider implements \OCP\Share\IShareProvider {
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
$cursor = $qb->execute();
|
$cursor = $qb->executeQuery();
|
||||||
while ($data = $cursor->fetch()) {
|
while ($data = $cursor->fetch()) {
|
||||||
$share = $this->createShareObject($data);
|
$share = $this->createShareObject($data);
|
||||||
|
|
||||||
@@ -1055,7 +1059,7 @@ class DeckShareProvider implements \OCP\Share\IShareProvider {
|
|||||||
->where($qb->expr()->eq('s.share_type', $qb->createNamedParameter(IShare::TYPE_DECK)))
|
->where($qb->expr()->eq('s.share_type', $qb->createNamedParameter(IShare::TYPE_DECK)))
|
||||||
->andWhere($qb->expr()->notIn('s.share_with', $qb->createNamedParameter($allCardIds, IQueryBuilder::PARAM_STR_ARRAY)));
|
->andWhere($qb->expr()->notIn('s.share_with', $qb->createNamedParameter($allCardIds, IQueryBuilder::PARAM_STR_ARRAY)));
|
||||||
|
|
||||||
$cursor = $qb->execute();
|
$cursor = $qb->executeQuery();
|
||||||
$shares = [];
|
$shares = [];
|
||||||
while ($data = $cursor->fetch()) {
|
while ($data = $cursor->fetch()) {
|
||||||
$shares[] = $this->createShareObject($data);
|
$shares[] = $this->createShareObject($data);
|
||||||
|
|||||||
2177
package-lock.json
generated
2177
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "deck",
|
"name": "deck",
|
||||||
"description": "",
|
"description": "",
|
||||||
"version": "1.16.0",
|
"version": "2.0.0-dev.0",
|
||||||
"authors": [
|
"authors": [
|
||||||
{
|
{
|
||||||
"name": "Julius Härtl",
|
"name": "Julius Härtl",
|
||||||
@@ -84,6 +84,7 @@
|
|||||||
"@vue/test-utils": "^2.4.6",
|
"@vue/test-utils": "^2.4.6",
|
||||||
"@vue/vue2-jest": "^29.2.6",
|
"@vue/vue2-jest": "^29.2.6",
|
||||||
"cypress": "^13.17.0",
|
"cypress": "^13.17.0",
|
||||||
|
"cypress-split": "^1.24.22",
|
||||||
"eslint-plugin-cypress": "^3.6.0",
|
"eslint-plugin-cypress": "^3.6.0",
|
||||||
"eslint-webpack-plugin": "^5.0.1",
|
"eslint-webpack-plugin": "^5.0.1",
|
||||||
"jest": "^29.7.0",
|
"jest": "^29.7.0",
|
||||||
|
|||||||
10
psalm.xml
10
psalm.xml
@@ -6,6 +6,8 @@
|
|||||||
xmlns="https://getpsalm.org/schema/config"
|
xmlns="https://getpsalm.org/schema/config"
|
||||||
xsi:schemaLocation="https://getpsalm.org/schema/config"
|
xsi:schemaLocation="https://getpsalm.org/schema/config"
|
||||||
errorBaseline="tests/psalm-baseline.xml"
|
errorBaseline="tests/psalm-baseline.xml"
|
||||||
|
findUnusedBaselineEntry="true"
|
||||||
|
findUnusedCode="false"
|
||||||
phpVersion="8.1"
|
phpVersion="8.1"
|
||||||
>
|
>
|
||||||
<stubs>
|
<stubs>
|
||||||
@@ -15,6 +17,7 @@
|
|||||||
<directory name="lib" />
|
<directory name="lib" />
|
||||||
<ignoreFiles>
|
<ignoreFiles>
|
||||||
<directory name="vendor" />
|
<directory name="vendor" />
|
||||||
|
<directory name="vendor-bin" />
|
||||||
</ignoreFiles>
|
</ignoreFiles>
|
||||||
</projectFiles>
|
</projectFiles>
|
||||||
<extraFiles>
|
<extraFiles>
|
||||||
@@ -26,13 +29,6 @@
|
|||||||
<referencedMethod name="/Db\\.*::.*/" />
|
<referencedMethod name="/Db\\.*::.*/" />
|
||||||
</errorLevel>
|
</errorLevel>
|
||||||
</UndefinedMagicMethod>
|
</UndefinedMagicMethod>
|
||||||
<UndefinedInterfaceMethod>
|
|
||||||
<errorLevel type="suppress">
|
|
||||||
<!-- FIXME Deprecated event handling -->
|
|
||||||
<referencedMethod name="OCP\IUserManager::listen" />
|
|
||||||
<referencedMethod name="OCP\IGroupManager::listen" />
|
|
||||||
</errorLevel>
|
|
||||||
</UndefinedInterfaceMethod>
|
|
||||||
<UndefinedClass>
|
<UndefinedClass>
|
||||||
<errorLevel type="suppress">
|
<errorLevel type="suppress">
|
||||||
<referencedClass name="OC\*" />
|
<referencedClass name="OC\*" />
|
||||||
|
|||||||
@@ -276,18 +276,15 @@ export default {
|
|||||||
position: relative;
|
position: relative;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
max-height: calc(100vh - 50px);
|
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
|
|
||||||
.board {
|
.board {
|
||||||
padding-left: $board-spacing;
|
|
||||||
position: relative;
|
position: relative;
|
||||||
max-height: calc(100% - var(--default-clickable-area));
|
|
||||||
overflow: hidden;
|
|
||||||
overflow-x: auto;
|
overflow-x: auto;
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
|
scrollbar-gutter: stable;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -297,11 +294,15 @@ export default {
|
|||||||
.smooth-dnd-container.horizontal {
|
.smooth-dnd-container.horizontal {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: stretch;
|
align-items: stretch;
|
||||||
|
gap: $board-gap;
|
||||||
|
padding: 0 $board-gap;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
|
||||||
&:deep(.stack-draggable-wrapper.smooth-dnd-draggable-wrapper) {
|
&:deep(.stack-draggable-wrapper.smooth-dnd-draggable-wrapper) {
|
||||||
display: flex;
|
display: flex;
|
||||||
height: auto;
|
height: auto;
|
||||||
|
flex: 0 1 $card-max-width;
|
||||||
|
min-width: $card-min-width;
|
||||||
|
|
||||||
.stack {
|
.stack {
|
||||||
display: flex;
|
display: flex;
|
||||||
@@ -309,16 +310,13 @@ export default {
|
|||||||
position: relative;
|
position: relative;
|
||||||
|
|
||||||
.smooth-dnd-container.vertical {
|
.smooth-dnd-container.vertical {
|
||||||
flex-grow: 1;
|
$margin-x: calc($stack-gap * -1);
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
// Margin left instead of padidng to avoid jumps on dropping a card
|
gap: $stack-gap;
|
||||||
margin-left: $stack-spacing;
|
padding: $stack-gap;
|
||||||
padding-right: $stack-spacing;
|
margin: 0 $margin-x;
|
||||||
overflow-x: hidden;
|
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
padding-top: 15px;
|
|
||||||
margin-top: -10px;
|
|
||||||
scrollbar-gutter: stable;
|
scrollbar-gutter: stable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,10 +14,10 @@
|
|||||||
{{ stack.title }}
|
{{ stack.title }}
|
||||||
</h3>
|
</h3>
|
||||||
<h3 v-else-if="!editing"
|
<h3 v-else-if="!editing"
|
||||||
title="stack.title"
|
|
||||||
dir="auto"
|
dir="auto"
|
||||||
tabindex="0"
|
tabindex="0"
|
||||||
:aria-label="stack.title"
|
:aria-label="stack.title"
|
||||||
|
:title="stack.title"
|
||||||
class="stack__title"
|
class="stack__title"
|
||||||
@click="startEditing(stack)"
|
@click="startEditing(stack)"
|
||||||
@keydown.enter="startEditing(stack)">
|
@keydown.enter="startEditing(stack)">
|
||||||
@@ -108,7 +108,7 @@
|
|||||||
</Container>
|
</Container>
|
||||||
|
|
||||||
<transition name="slide-bottom" appear>
|
<transition name="slide-bottom" appear>
|
||||||
<div v-show="showAddCard" class="stack__card-add">
|
<div v-if="showAddCard" class="stack__card-add">
|
||||||
<form :class="{ 'icon-loading-small': stateCardCreating }"
|
<form :class="{ 'icon-loading-small': stateCardCreating }"
|
||||||
@submit.prevent.stop="clickAddCard()">
|
@submit.prevent.stop="clickAddCard()">
|
||||||
<label for="new-stack-input-main" class="hidden-visually">{{ t('deck', 'Add a new card') }}</label>
|
<label for="new-stack-input-main" class="hidden-visually">{{ t('deck', 'Add a new card') }}</label>
|
||||||
@@ -365,37 +365,31 @@ export default {
|
|||||||
@import './../../css/variables';
|
@import './../../css/variables';
|
||||||
|
|
||||||
.stack {
|
.stack {
|
||||||
width: $stack-width + $stack-spacing * 3;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.stack__header {
|
.stack__header {
|
||||||
display: flex;
|
display: flex;
|
||||||
position: sticky;
|
position: sticky;
|
||||||
top: 0;
|
top: 0;
|
||||||
|
height: var(--default-clickable-area);
|
||||||
z-index: 100;
|
z-index: 100;
|
||||||
padding-left: $card-spacing;
|
|
||||||
padding-right: $card-spacing;
|
|
||||||
margin: 6px;
|
|
||||||
margin-top: 0;
|
margin-top: 0;
|
||||||
cursor: grab;
|
cursor: grab;
|
||||||
background-color: var(--color-main-background);
|
background-color: var(--color-main-background);
|
||||||
|
|
||||||
// Smooth fade out of the cards at the top
|
// Smooth fade out of the cards at the top
|
||||||
&:before {
|
&:before {
|
||||||
content: ' ';
|
content: '';
|
||||||
display: block;
|
display: block;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
width: calc(100% - 16px);
|
width: 100%;
|
||||||
height: 20px;
|
height: $stack-gap;
|
||||||
top: 30px;
|
bottom: 0;
|
||||||
left: 0px;
|
|
||||||
z-index: 99;
|
z-index: 99;
|
||||||
transition: top var(--animation-slow);
|
transition: top var(--animation-slow);
|
||||||
|
background-image: linear-gradient(180deg, var(--color-main-background) 0%, transparent 100%);
|
||||||
background-image: linear-gradient(180deg, var(--color-main-background) 3px, rgba(255, 255, 255, 0) 100%);
|
transform: translateY(100%);
|
||||||
body.theme--dark & {
|
|
||||||
background-image: linear-gradient(180deg, var(--color-main-background) 3px, rgba(0, 0, 0, 0) 100%);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
& > * {
|
& > * {
|
||||||
@@ -404,8 +398,10 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
h3, form {
|
h3, form {
|
||||||
flex-grow: 1;
|
flex: 1 1 auto;
|
||||||
|
min-width: 0;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
cursor: inherit;
|
cursor: inherit;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
|
|
||||||
@@ -418,9 +414,8 @@ export default {
|
|||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
max-width: calc($stack-width - 60px);
|
|
||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
padding: 4px 4px;
|
padding: $card-padding;
|
||||||
font-size: var(--default-font-size);
|
font-size: var(--default-font-size);
|
||||||
|
|
||||||
&:focus-visible {
|
&:focus-visible {
|
||||||
@@ -430,7 +425,6 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
form {
|
form {
|
||||||
margin: -4px;
|
|
||||||
input {
|
input {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
padding: 0 6px;
|
padding: 0 6px;
|
||||||
@@ -453,14 +447,25 @@ export default {
|
|||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
z-index: 100;
|
z-index: 100;
|
||||||
display: flex;
|
display: flex;
|
||||||
margin-bottom: 5px;
|
padding-bottom: $stack-gap;
|
||||||
padding-top: var(--default-grid-baseline);
|
|
||||||
background-color: var(--color-main-background);
|
background-color: var(--color-main-background);
|
||||||
|
position: relative;
|
||||||
|
|
||||||
|
// Smooth fade out of the cards at the top
|
||||||
|
&:before {
|
||||||
|
content: '';
|
||||||
|
display: block;
|
||||||
|
position: absolute;
|
||||||
|
width: 100%;
|
||||||
|
height: $stack-gap;
|
||||||
|
z-index: 99;
|
||||||
|
transition: bottom var(--animation-slow);
|
||||||
|
background-image: linear-gradient(0deg, var(--color-main-background) 0%, transparent 100%);
|
||||||
|
transform: translateY(-100%);
|
||||||
|
}
|
||||||
|
|
||||||
form {
|
form {
|
||||||
display: flex;
|
display: flex;
|
||||||
margin-left: $stack-spacing;
|
|
||||||
margin-right: $stack-spacing;
|
|
||||||
width: 100%;
|
width: 100%;
|
||||||
border: 2px solid var(--color-border-maxcontrast);
|
border: 2px solid var(--color-border-maxcontrast);
|
||||||
border-radius: var(--border-radius-large);
|
border-radius: var(--border-radius-large);
|
||||||
@@ -481,7 +486,6 @@ export default {
|
|||||||
input {
|
input {
|
||||||
border: none;
|
border: none;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 4px;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -101,6 +101,8 @@ export default {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
@import './../../css/variables';
|
||||||
|
|
||||||
.badges {
|
.badges {
|
||||||
display: flex;
|
display: flex;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
@@ -111,6 +113,7 @@ export default {
|
|||||||
.icon-badge {
|
.icon-badge {
|
||||||
color: var(--color-text-maxcontrast);
|
color: var(--color-text-maxcontrast);
|
||||||
display: flex;
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
margin-right: 2px;
|
margin-right: 2px;
|
||||||
|
|
||||||
span,
|
span,
|
||||||
@@ -125,6 +128,7 @@ export default {
|
|||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
gap: 3px;
|
gap: 3px;
|
||||||
|
height: var(--default-clickable-area);
|
||||||
}
|
}
|
||||||
|
|
||||||
.badge-left, .badge-right {
|
.badge-left, .badge-right {
|
||||||
|
|||||||
@@ -4,13 +4,10 @@
|
|||||||
-->
|
-->
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div v-if="referencePreview" class="card-cover">
|
<div v-if="cardId && ( attachments.length > 0 )" class="card-cover">
|
||||||
<div class="image-wrapper rounded-left rounded-right" :style="{ backgroundImage: `url(${referencePreview})`}" />
|
<div v-for="attachment in attachments"
|
||||||
</div>
|
|
||||||
<div v-else-if="cardId && ( attachments.length > 0 )" class="card-cover">
|
|
||||||
<div v-for="(attachment, index) in attachments"
|
|
||||||
:key="attachment.id"
|
:key="attachment.id"
|
||||||
:class="['image-wrapper', { 'rounded-left': index === 0 }, { 'rounded-right': index === attachments.length - 1 }]"
|
class="image-wrapper"
|
||||||
:style="{ backgroundImage: `url(${attachmentPreview(attachment)})` }" />
|
:style="{ backgroundImage: `url(${attachmentPreview(attachment)})` }" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -77,9 +74,7 @@ export default {
|
|||||||
.card-cover {
|
.card-cover {
|
||||||
height: 90px;
|
height: 90px;
|
||||||
display: flex;
|
display: flex;
|
||||||
margin-top: -4px;
|
margin: $card-image-margin $card-image-margin 0;
|
||||||
margin-left: -4px;
|
|
||||||
margin-right: -4px;
|
|
||||||
|
|
||||||
.image-wrapper {
|
.image-wrapper {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
@@ -87,12 +82,6 @@ export default {
|
|||||||
background-size: cover;
|
background-size: cover;
|
||||||
background-repeat: no-repeat;
|
background-repeat: no-repeat;
|
||||||
background-position: center center;
|
background-position: center center;
|
||||||
&.rounded-left {
|
|
||||||
border-top-left-radius: calc(var(--border-radius-large) - 1px);
|
|
||||||
}
|
|
||||||
&.rounded-right {
|
|
||||||
border-top-right-radius: calc(var(--border-radius-large) - 1px);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<AttachmentDragAndDrop v-if="card" :card-id="card.id" class="drop-upload--card">
|
<AttachmentDragAndDrop v-if="card" :card-id="card.id" class="drop-upload--card">
|
||||||
<div :ref="`card${card.id}`"
|
<div :ref="`card${card.id}`"
|
||||||
:class="{'compact': compactMode, 'current-card': currentCard, 'has-labels': card.labels && card.labels.length > 0, 'card__editable': canEdit, 'card__archived': card.archived, 'card__highlight': highlight}"
|
:class="{'compact': compactMode, 'current-card': currentCard, 'no-labels': !hasLabels, 'card__editable': canEdit, 'card__archived': card.archived, 'card__highlight': highlight}"
|
||||||
tag="div"
|
tag="div"
|
||||||
:tabindex="0"
|
:tabindex="0"
|
||||||
class="card"
|
class="card"
|
||||||
@@ -331,12 +331,14 @@ export default {
|
|||||||
border-radius: var(--border-radius-large);
|
border-radius: var(--border-radius-large);
|
||||||
font-size: 100%;
|
font-size: 100%;
|
||||||
background-color: var(--color-main-background);
|
background-color: var(--color-main-background);
|
||||||
margin-bottom: $card-spacing;
|
padding: $card-padding;
|
||||||
padding: var(--default-grid-baseline) $card-padding;
|
|
||||||
border: 2px solid var(--color-border-dark);
|
border: 2px solid var(--color-border-dark);
|
||||||
width: 100%;
|
width: 100%;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
gap: $card-gap;
|
||||||
|
overflow: hidden;
|
||||||
|
cursor: pointer;
|
||||||
|
|
||||||
&:deep(*:not(.dragDisabled)) {
|
&:deep(*:not(.dragDisabled)) {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
@@ -359,12 +361,10 @@ export default {
|
|||||||
h4 {
|
h4 {
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: var(--default-grid-baseline);
|
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
font-size: 100%;
|
font-size: 100%;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
word-wrap: break-word;
|
word-wrap: break-word;
|
||||||
padding-left: 4px;
|
|
||||||
align-self: center;
|
align-self: center;
|
||||||
|
|
||||||
:deep(a) {
|
:deep(a) {
|
||||||
@@ -374,9 +374,6 @@ export default {
|
|||||||
&.editable {
|
&.editable {
|
||||||
span {
|
span {
|
||||||
cursor: text;
|
cursor: text;
|
||||||
padding-right: 8px;
|
|
||||||
padding-top: 3px;
|
|
||||||
padding-bottom: 3px;
|
|
||||||
|
|
||||||
&:focus, &:focus-visible {
|
&:focus, &:focus-visible {
|
||||||
outline: none;
|
outline: none;
|
||||||
@@ -385,6 +382,7 @@ export default {
|
|||||||
|
|
||||||
&:focus-within {
|
&:focus-within {
|
||||||
outline: 2px solid var(--color-border-dark);
|
outline: 2px solid var(--color-border-dark);
|
||||||
|
outline-offset: 4px;
|
||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -427,8 +425,6 @@ export default {
|
|||||||
.card-labels {
|
.card-labels {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: end;
|
align-items: end;
|
||||||
padding-left: var(--default-grid-baseline);
|
|
||||||
padding-top: var(--default-grid-baseline);
|
|
||||||
|
|
||||||
.labels {
|
.labels {
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
@@ -444,7 +440,7 @@ export default {
|
|||||||
|
|
||||||
.card-related {
|
.card-related {
|
||||||
display: flex;
|
display: flex;
|
||||||
padding: 12px;
|
padding: 4px;
|
||||||
padding-bottom: 0px;
|
padding-bottom: 0px;
|
||||||
color: var(--color-text-maxcontrast);
|
color: var(--color-text-maxcontrast);
|
||||||
|
|
||||||
@@ -469,8 +465,8 @@ export default {
|
|||||||
height: 32px;
|
height: 32px;
|
||||||
width: 32px;
|
width: 32px;
|
||||||
}
|
}
|
||||||
&.has-labels {
|
&.no-labels {
|
||||||
padding-bottom: $card-padding;
|
padding-bottom: var(--default-grid-baseline);
|
||||||
}
|
}
|
||||||
.labels {
|
.labels {
|
||||||
height: 6px;
|
height: 6px;
|
||||||
|
|||||||
@@ -14,45 +14,25 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-else-if="isValidFilter" class="overview">
|
<div v-else-if="isValidFilter" class="overview">
|
||||||
<div class="dashboard-column">
|
<div v-for="columnProps in columnPropsList" :key="columnProps.title" class="dashboard-column">
|
||||||
<h3>{{ t('deck', 'Overdue') }}</h3>
|
<div class="dashboard-column__header">
|
||||||
<div v-for="card in sortCards('overdue')" :key="card.id">
|
<h3 class="dashboard-column__header-title"
|
||||||
<CardItem :id="card.id" />
|
:title="columnProps.title"
|
||||||
|
:aria-label="columnProps.title">
|
||||||
|
{{ t('deck', columnProps.title) }}
|
||||||
|
</h3>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div class="dashboard-column__list">
|
||||||
|
<template v-if="columnProps.sort === false">
|
||||||
<div class="dashboard-column">
|
<CardItem v-for="card in filterCards(columnProps.filter)"
|
||||||
<h3>{{ t('deck', 'Today') }}</h3>
|
:id="card.id"
|
||||||
<div v-for="card in sortCards('today')" :key="card.id">
|
:key="card.id" />
|
||||||
<CardItem :id="card.id" />
|
</template>
|
||||||
</div>
|
<template v-else>
|
||||||
</div>
|
<CardItem v-for="card in sortCards(filterCards(columnProps.filter))"
|
||||||
|
:id="card.id"
|
||||||
<div class="dashboard-column">
|
:key="card.id" />
|
||||||
<h3>{{ t('deck', 'Tomorrow') }}</h3>
|
</template>
|
||||||
<div v-for="card in sortCards('tomorrow')" :key="card.id">
|
|
||||||
<CardItem :id="card.id" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="dashboard-column">
|
|
||||||
<h3>{{ t('deck', 'Next 7 days') }}</h3>
|
|
||||||
<div v-for="card in sortCards('nextSevenDays')" :key="card.id">
|
|
||||||
<CardItem :id="card.id" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="dashboard-column">
|
|
||||||
<h3>{{ t('deck', 'Later') }}</h3>
|
|
||||||
<div v-for="card in sortCards('later')" :key="card.id">
|
|
||||||
<CardItem :id="card.id" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="dashboard-column">
|
|
||||||
<h3>{{ t('deck', 'No due') }}</h3>
|
|
||||||
<div v-for="card in assignedCardsDashboard.nodue" :key="card.id">
|
|
||||||
<CardItem :id="card.id" />
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -73,6 +53,34 @@ const SUPPORTED_FILTERS = [
|
|||||||
FILTER_UPCOMING,
|
FILTER_UPCOMING,
|
||||||
]
|
]
|
||||||
|
|
||||||
|
const COLUMN_PROPS_LIST = [
|
||||||
|
{
|
||||||
|
title: 'Overdue',
|
||||||
|
filter: 'overdue',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Today',
|
||||||
|
filter: 'today',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Tomorrow',
|
||||||
|
filter: 'tomorrow',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Next 7 days',
|
||||||
|
filter: 'nextSevenDays',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Later',
|
||||||
|
filter: 'later',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'No due',
|
||||||
|
filter: 'nodue',
|
||||||
|
sort: false,
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'Overview',
|
name: 'Overview',
|
||||||
components: {
|
components: {
|
||||||
@@ -89,6 +97,7 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
loading: true,
|
loading: true,
|
||||||
|
columnPropsList: COLUMN_PROPS_LIST,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@@ -125,16 +134,16 @@ export default {
|
|||||||
}
|
}
|
||||||
this.loading = false
|
this.loading = false
|
||||||
},
|
},
|
||||||
sortCards(when) {
|
filterCards(when) {
|
||||||
const cards = this.assignedCardsDashboard[when]
|
return this.assignedCardsDashboard[when]
|
||||||
|
},
|
||||||
|
sortCards(cards) {
|
||||||
if (!cards) {
|
if (!cards) {
|
||||||
return null
|
return null
|
||||||
} else {
|
} else {
|
||||||
return cards.toSorted((current, next) => {
|
return cards.toSorted((current, next) => {
|
||||||
const currentDueDate = new Date(current.duedate)
|
const currentDueDate = new Date(current.duedate)
|
||||||
const nextDueDate = new Date(next.duedate)
|
const nextDueDate = new Date(next.duedate)
|
||||||
|
|
||||||
return currentDueDate - nextDueDate
|
return currentDueDate - nextDueDate
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -151,38 +160,75 @@ export default {
|
|||||||
position: relative;
|
position: relative;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
max-height: calc(100vh - 50px);
|
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
|
|
||||||
.overview {
|
.overview {
|
||||||
position: relative;
|
position: relative;
|
||||||
height: calc(100% - var(--default-clickable-area));
|
overflow-x: auto;
|
||||||
overflow-x: scroll;
|
flex-grow: 1;
|
||||||
|
scrollbar-gutter: stable;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: stretch;
|
align-items: stretch;
|
||||||
padding-left: $board-spacing;
|
gap: $board-gap;
|
||||||
padding-right: $board-spacing;
|
padding: 0 $board-gap;
|
||||||
|
|
||||||
.dashboard-column {
|
.dashboard-column {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
min-width: $stack-width;
|
flex: 0 1 $card-max-width;
|
||||||
width: $stack-width;
|
min-width: $card-min-width;
|
||||||
margin-left: $stack-spacing;
|
|
||||||
margin-right: $stack-spacing;
|
|
||||||
|
|
||||||
h3 {
|
.dashboard-column__header {
|
||||||
font-size: var(--default-font-size);
|
display: flex;
|
||||||
margin: -6px;
|
|
||||||
margin-bottom: 12px;
|
|
||||||
padding: 6px 13px;
|
|
||||||
position: sticky;
|
position: sticky;
|
||||||
top: 0;
|
top: 0;
|
||||||
|
height: var(--default-clickable-area);
|
||||||
z-index: 100;
|
z-index: 100;
|
||||||
|
margin-top: 0;
|
||||||
background-color: var(--color-main-background);
|
background-color: var(--color-main-background);
|
||||||
border: 1px solid var(--color-main-background);
|
|
||||||
|
// Smooth fade out of the cards at the top
|
||||||
|
&:before {
|
||||||
|
content: '';
|
||||||
|
display: block;
|
||||||
|
position: absolute;
|
||||||
|
width: 100%;
|
||||||
|
height: 20px;
|
||||||
|
top: 30px;
|
||||||
|
left: 0px;
|
||||||
|
z-index: 99;
|
||||||
|
transition: top var(--animation-slow);
|
||||||
|
background-image: linear-gradient(180deg, var(--color-main-background) 3px, rgba(255, 255, 255, 0) 100%);
|
||||||
|
|
||||||
|
body.theme--dark & {
|
||||||
|
background-image: linear-gradient(180deg, var(--color-main-background) 3px, rgba(0, 0, 0, 0) 100%);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.dashboard-column__header-title {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
height: var(--default-clickable-area);
|
||||||
|
margin: 0;
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
padding: $card-padding;
|
||||||
|
font-size: var(--default-font-size);
|
||||||
|
}
|
||||||
|
|
||||||
|
.dashboard-column__list {
|
||||||
|
$margin-x: calc($stack-gap * -1);
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: $stack-gap;
|
||||||
|
padding: $stack-gap;
|
||||||
|
margin: 0 $margin-x;
|
||||||
|
overflow-y: auto;
|
||||||
|
scrollbar-gutter: stable;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,16 +4,19 @@
|
|||||||
-->
|
-->
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div v-if="searchQuery!==''" class="global-search">
|
<section v-if="searchQuery!==''" class="global-search">
|
||||||
<h2>
|
<header class="search-header">
|
||||||
<NcRichText :text="t('deck', 'Search for {searchQuery} in all boards')" :arguments="queryStringArgs" />
|
<h2>
|
||||||
<div v-if="loading" class="icon-loading-small" />
|
<NcRichText :text="$route.params.id ? t('deck', 'Search for {searchQuery} in other boards') : t('deck', 'Search for {searchQuery} in all boards')"
|
||||||
</h2>
|
:arguments="queryStringArgs" />
|
||||||
<NcActions>
|
<span v-if="loading" class="icon-loading-small" />
|
||||||
<NcActionButton icon="icon-close" @click="$store.commit('setSearchQuery', '')" />
|
</h2>
|
||||||
</NcActions>
|
<NcActions>
|
||||||
|
<NcActionButton icon="icon-close" @click="$store.commit('setSearchQuery', '')" />
|
||||||
|
</NcActions>
|
||||||
|
</header>
|
||||||
<div class="search-wrapper">
|
<div class="search-wrapper">
|
||||||
<div v-if="loading || filteredResults.length > 0" class="search-results">
|
<template v-if="loading || filteredResults.length > 0">
|
||||||
<CardItem v-for="card in filteredResults"
|
<CardItem v-for="card in filteredResults"
|
||||||
:id="card.id"
|
:id="card.id"
|
||||||
:key="card.id"
|
:key="card.id"
|
||||||
@@ -26,12 +29,12 @@
|
|||||||
{{ t('deck', 'No results found') }}
|
{{ t('deck', 'No results found') }}
|
||||||
</div>
|
</div>
|
||||||
</InfiniteLoading>
|
</InfiniteLoading>
|
||||||
</div>
|
</template>
|
||||||
<div v-else>
|
<template v-else>
|
||||||
<p>{{ t('deck', 'No results found') }}</p>
|
<p>{{ t('deck', 'No results found') }}</p>
|
||||||
</div>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</section>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
@@ -159,7 +162,7 @@ export default {
|
|||||||
|
|
||||||
.global-search {
|
.global-search {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
padding: $board-spacing + $stack-spacing;
|
padding: $board-gap;
|
||||||
padding-bottom: 0;
|
padding-bottom: 0;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
min-height: 35vh;
|
min-height: 35vh;
|
||||||
@@ -169,17 +172,24 @@ export default {
|
|||||||
border-top: 1px solid var(--color-border);
|
border-top: 1px solid var(--color-border);
|
||||||
z-index: 1010;
|
z-index: 1010;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
|
||||||
.action-item.icon-close {
|
.action-item.icon-close {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 10px;
|
top: 10px;
|
||||||
right: 10px;
|
right: 10px;
|
||||||
}
|
}
|
||||||
.search-wrapper {
|
|
||||||
overflow: scroll;
|
.search-header {
|
||||||
height: 100%;
|
display: flex;
|
||||||
position: relative;
|
align-items: flex-start;
|
||||||
padding: 10px;
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
|
||||||
|
h2 {
|
||||||
|
margin: 0;
|
||||||
|
padding: var(--default-grid-baseline) var(--default-grid-baseline) $board-gap;
|
||||||
}
|
}
|
||||||
|
|
||||||
h2 > div {
|
h2 > div {
|
||||||
@@ -189,23 +199,24 @@ export default {
|
|||||||
margin-right: 20px;
|
margin-right: 20px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
h2:deep(span) {
|
h2:deep(span) {
|
||||||
background-color: var(--color-background-dark);
|
background-color: var(--color-background-dark);
|
||||||
padding: 3px;
|
padding: 3px;
|
||||||
border-radius: var(--border-radius);
|
border-radius: var(--border-radius);
|
||||||
}
|
}
|
||||||
|
|
||||||
.search-results {
|
.search-wrapper {
|
||||||
|
overflow: auto;
|
||||||
|
height: 100%;
|
||||||
|
position: relative;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap;
|
gap: $stack-gap;
|
||||||
|
|
||||||
& > div {
|
& > .drop-upload--card {
|
||||||
flex-grow: 0;
|
flex: 0 1 $card-max-width;
|
||||||
|
min-width: $card-min-width;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
&:deep(.card) {
|
|
||||||
width: $stack-width;
|
|
||||||
margin-right: $stack-spacing;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -62,14 +62,13 @@ export default {
|
|||||||
$clickable-area: var(--default-clickable-area);
|
$clickable-area: var(--default-clickable-area);
|
||||||
|
|
||||||
.card--placeholder {
|
.card--placeholder {
|
||||||
width: $stack-width;
|
min-width: $card-min-width;
|
||||||
margin-right: $stack-spacing;
|
max-width: $card-min-width;
|
||||||
padding: $card-padding;
|
padding: $card-padding;
|
||||||
transition: box-shadow 0.1s ease-in-out;
|
transition: box-shadow 0.1s ease-in-out;
|
||||||
box-shadow: 0 0 2px 0 var(--color-box-shadow);
|
box-shadow: 0 0 2px 0 var(--color-box-shadow);
|
||||||
border-radius: var(--border-radius-large);
|
border-radius: var(--border-radius-large);
|
||||||
font-size: 100%;
|
font-size: 100%;
|
||||||
margin-bottom: $card-spacing;
|
|
||||||
height: 100px;
|
height: 100px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,8 +2,10 @@
|
|||||||
* SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors
|
* SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors
|
||||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||||
*/
|
*/
|
||||||
$card-spacing: 8px;
|
$card-min-width: 216px;
|
||||||
$card-padding: 4px;
|
$card-max-width: 300px;
|
||||||
$stack-spacing: 12px;
|
$card-padding: calc(var(--default-grid-baseline) * 2) calc(var(--default-grid-baseline) * 2) var(--default-grid-baseline);
|
||||||
$stack-width: 280px;
|
$card-gap: calc(var(--default-grid-baseline) * 3);
|
||||||
$board-spacing: 16px;
|
$card-image-margin: calc(var(--default-grid-baseline) * -2);
|
||||||
|
$stack-gap: calc(var(--default-grid-baseline) * 3);
|
||||||
|
$board-gap: calc(var(--default-grid-baseline) * 4);
|
||||||
|
|||||||
@@ -189,7 +189,7 @@ export default {
|
|||||||
card.assignedUsers = card.assignedUsers || []
|
card.assignedUsers = card.assignedUsers || []
|
||||||
const existingIndex = state.cards.findIndex(_card => _card.id === card.id)
|
const existingIndex = state.cards.findIndex(_card => _card.id === card.id)
|
||||||
if (existingIndex !== -1) {
|
if (existingIndex !== -1) {
|
||||||
const existingCard = state.cards.find(_card => _card.id === card.id)
|
const existingCard = state.cards[existingIndex]
|
||||||
Vue.set(state.cards, existingIndex, Object.assign({}, existingCard, card))
|
Vue.set(state.cards, existingIndex, Object.assign({}, existingCard, card))
|
||||||
} else {
|
} else {
|
||||||
state.cards.push(card)
|
state.cards.push(card)
|
||||||
|
|||||||
@@ -90,8 +90,8 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"assignedUsers": [],
|
"assignedUsers": [],
|
||||||
"attachments": null,
|
"attachments": [],
|
||||||
"attachmentCount": null,
|
"attachmentCount": 0,
|
||||||
"owner": {
|
"owner": {
|
||||||
"primaryKey": "admin",
|
"primaryKey": "admin",
|
||||||
"uid": "admin",
|
"uid": "admin",
|
||||||
@@ -123,8 +123,8 @@
|
|||||||
"createdAt": 1689667572,
|
"createdAt": 1689667572,
|
||||||
"labels": [],
|
"labels": [],
|
||||||
"assignedUsers": [],
|
"assignedUsers": [],
|
||||||
"attachments": null,
|
"attachments": [],
|
||||||
"attachmentCount": null,
|
"attachmentCount": 0,
|
||||||
"owner": {
|
"owner": {
|
||||||
"primaryKey": "admin",
|
"primaryKey": "admin",
|
||||||
"uid": "admin",
|
"uid": "admin",
|
||||||
@@ -168,8 +168,8 @@
|
|||||||
"type": 0
|
"type": 0
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"attachments": null,
|
"attachments": [],
|
||||||
"attachmentCount": null,
|
"attachmentCount": 0,
|
||||||
"owner": {
|
"owner": {
|
||||||
"primaryKey": "admin",
|
"primaryKey": "admin",
|
||||||
"uid": "admin",
|
"uid": "admin",
|
||||||
@@ -240,8 +240,8 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"assignedUsers": [],
|
"assignedUsers": [],
|
||||||
"attachments": null,
|
"attachments": [],
|
||||||
"attachmentCount": null,
|
"attachmentCount": 0,
|
||||||
"owner": {
|
"owner": {
|
||||||
"primaryKey": "admin",
|
"primaryKey": "admin",
|
||||||
"uid": "admin",
|
"uid": "admin",
|
||||||
@@ -283,8 +283,8 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"assignedUsers": [],
|
"assignedUsers": [],
|
||||||
"attachments": null,
|
"attachments": [],
|
||||||
"attachmentCount": null,
|
"attachmentCount": 0,
|
||||||
"owner": {
|
"owner": {
|
||||||
"primaryKey": "admin",
|
"primaryKey": "admin",
|
||||||
"uid": "admin",
|
"uid": "admin",
|
||||||
@@ -328,8 +328,8 @@
|
|||||||
"type": 0
|
"type": 0
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"attachments": null,
|
"attachments": [],
|
||||||
"attachmentCount": null,
|
"attachmentCount": 0,
|
||||||
"owner": {
|
"owner": {
|
||||||
"primaryKey": "admin",
|
"primaryKey": "admin",
|
||||||
"uid": "admin",
|
"uid": "admin",
|
||||||
@@ -493,8 +493,8 @@
|
|||||||
"createdAt": 1689667483,
|
"createdAt": 1689667483,
|
||||||
"labels": [],
|
"labels": [],
|
||||||
"assignedUsers": [],
|
"assignedUsers": [],
|
||||||
"attachments": null,
|
"attachments": [],
|
||||||
"attachmentCount": null,
|
"attachmentCount": 0,
|
||||||
"owner": {
|
"owner": {
|
||||||
"primaryKey": "admin",
|
"primaryKey": "admin",
|
||||||
"uid": "admin",
|
"uid": "admin",
|
||||||
@@ -526,8 +526,8 @@
|
|||||||
"createdAt": 1689667518,
|
"createdAt": 1689667518,
|
||||||
"labels": [],
|
"labels": [],
|
||||||
"assignedUsers": [],
|
"assignedUsers": [],
|
||||||
"attachments": null,
|
"attachments": [],
|
||||||
"attachmentCount": null,
|
"attachmentCount": 0,
|
||||||
"owner": {
|
"owner": {
|
||||||
"primaryKey": "admin",
|
"primaryKey": "admin",
|
||||||
"uid": "admin",
|
"uid": "admin",
|
||||||
@@ -559,8 +559,8 @@
|
|||||||
"createdAt": 1689667527,
|
"createdAt": 1689667527,
|
||||||
"labels": [],
|
"labels": [],
|
||||||
"assignedUsers": [],
|
"assignedUsers": [],
|
||||||
"attachments": null,
|
"attachments": [],
|
||||||
"attachmentCount": null,
|
"attachmentCount": 0,
|
||||||
"owner": {
|
"owner": {
|
||||||
"primaryKey": "admin",
|
"primaryKey": "admin",
|
||||||
"uid": "admin",
|
"uid": "admin",
|
||||||
@@ -592,8 +592,8 @@
|
|||||||
"createdAt": 1689667537,
|
"createdAt": 1689667537,
|
||||||
"labels": [],
|
"labels": [],
|
||||||
"assignedUsers": [],
|
"assignedUsers": [],
|
||||||
"attachments": null,
|
"attachments": [],
|
||||||
"attachmentCount": null,
|
"attachmentCount": 0,
|
||||||
"owner": {
|
"owner": {
|
||||||
"primaryKey": "admin",
|
"primaryKey": "admin",
|
||||||
"uid": "admin",
|
"uid": "admin",
|
||||||
@@ -636,8 +636,8 @@
|
|||||||
"createdAt": 1689667488,
|
"createdAt": 1689667488,
|
||||||
"labels": [],
|
"labels": [],
|
||||||
"assignedUsers": [],
|
"assignedUsers": [],
|
||||||
"attachments": null,
|
"attachments": [],
|
||||||
"attachmentCount": null,
|
"attachmentCount": 0,
|
||||||
"owner": {
|
"owner": {
|
||||||
"primaryKey": "admin",
|
"primaryKey": "admin",
|
||||||
"uid": "admin",
|
"uid": "admin",
|
||||||
@@ -680,8 +680,8 @@
|
|||||||
"createdAt": 1689667493,
|
"createdAt": 1689667493,
|
||||||
"labels": [],
|
"labels": [],
|
||||||
"assignedUsers": [],
|
"assignedUsers": [],
|
||||||
"attachments": null,
|
"attachments": [],
|
||||||
"attachmentCount": null,
|
"attachmentCount": 0,
|
||||||
"owner": {
|
"owner": {
|
||||||
"primaryKey": "admin",
|
"primaryKey": "admin",
|
||||||
"uid": "admin",
|
"uid": "admin",
|
||||||
@@ -713,8 +713,8 @@
|
|||||||
"createdAt": 1689667502,
|
"createdAt": 1689667502,
|
||||||
"labels": [],
|
"labels": [],
|
||||||
"assignedUsers": [],
|
"assignedUsers": [],
|
||||||
"attachments": null,
|
"attachments": [],
|
||||||
"attachmentCount": null,
|
"attachmentCount": 0,
|
||||||
"owner": {
|
"owner": {
|
||||||
"primaryKey": "admin",
|
"primaryKey": "admin",
|
||||||
"uid": "admin",
|
"uid": "admin",
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
82773
|
82774
|
||||||
|
|||||||
@@ -1,152 +1,78 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<files psalm-version="5.6.0@e784128902dfe01d489c4123d69918a9f3c1eac5">
|
<files psalm-version="6.5.0@38fc8444edf0cebc9205296ee6e30e906ade783b">
|
||||||
<file src="lib/Activity/Filter.php">
|
<file src="lib/Activity/Filter.php">
|
||||||
<MethodSignatureMismatch>
|
<MethodSignatureMismatch>
|
||||||
<code>$types</code>
|
<code><![CDATA[$types]]></code>
|
||||||
</MethodSignatureMismatch>
|
</MethodSignatureMismatch>
|
||||||
</file>
|
</file>
|
||||||
<file src="lib/Command/UserExport.php">
|
|
||||||
<ImplementedReturnTypeMismatch>
|
|
||||||
<code>void</code>
|
|
||||||
</ImplementedReturnTypeMismatch>
|
|
||||||
<UndefinedThisPropertyAssignment>
|
|
||||||
<code>$this->boardMapper</code>
|
|
||||||
<code>$this->stackMapper</code>
|
|
||||||
</UndefinedThisPropertyAssignment>
|
|
||||||
<UndefinedThisPropertyFetch>
|
|
||||||
<code>$this->boardMapper</code>
|
|
||||||
<code>$this->stackMapper</code>
|
|
||||||
</UndefinedThisPropertyFetch>
|
|
||||||
</file>
|
|
||||||
<file src="lib/Controller/BoardApiController.php">
|
<file src="lib/Controller/BoardApiController.php">
|
||||||
<TypeDoesNotContainNull>
|
<UndefinedFunction>
|
||||||
<code>$modified === null</code>
|
<code><![CDATA[parseDate($modified)]]></code>
|
||||||
<code>$modified === null</code>
|
</UndefinedFunction>
|
||||||
</TypeDoesNotContainNull>
|
|
||||||
<UndefinedClass>
|
|
||||||
<code>Util</code>
|
|
||||||
</UndefinedClass>
|
|
||||||
<UndefinedThisPropertyAssignment>
|
|
||||||
<code>$this->userId</code>
|
|
||||||
</UndefinedThisPropertyAssignment>
|
|
||||||
<UndefinedThisPropertyFetch>
|
|
||||||
<code>$this->userId</code>
|
|
||||||
</UndefinedThisPropertyFetch>
|
|
||||||
</file>
|
|
||||||
<file src="lib/Controller/CommentsApiController.php">
|
|
||||||
<InvalidScalarArgument>
|
|
||||||
<code>$cardId</code>
|
|
||||||
<code>$cardId</code>
|
|
||||||
<code>$cardId</code>
|
|
||||||
<code>$commentId</code>
|
|
||||||
<code>$commentId</code>
|
|
||||||
<code>$parentId</code>
|
|
||||||
</InvalidScalarArgument>
|
|
||||||
</file>
|
</file>
|
||||||
<file src="lib/Controller/PageController.php">
|
<file src="lib/Controller/PageController.php">
|
||||||
<UndefinedClass>
|
<UndefinedClass>
|
||||||
<code>LoadSidebar</code>
|
<code><![CDATA[LoadSidebar]]></code>
|
||||||
</UndefinedClass>
|
</UndefinedClass>
|
||||||
</file>
|
</file>
|
||||||
<file src="lib/Controller/StackApiController.php">
|
<file src="lib/Controller/StackApiController.php">
|
||||||
<RedundantCondition>
|
<UndefinedFunction>
|
||||||
<code>$modified !== null</code>
|
<code><![CDATA[parseDate($modified)]]></code>
|
||||||
</RedundantCondition>
|
</UndefinedFunction>
|
||||||
<UndefinedClass>
|
|
||||||
<code>Util</code>
|
|
||||||
</UndefinedClass>
|
|
||||||
</file>
|
</file>
|
||||||
<file src="lib/DAV/Calendar.php">
|
<file src="lib/DAV/Calendar.php">
|
||||||
<UndefinedClass>
|
<UndefinedClass>
|
||||||
<code>ExternalCalendar</code>
|
<code><![CDATA[ExternalCalendar]]></code>
|
||||||
</UndefinedClass>
|
</UndefinedClass>
|
||||||
</file>
|
</file>
|
||||||
<file src="lib/DAV/CalendarObject.php">
|
<file src="lib/DAV/CalendarObject.php">
|
||||||
<UndefinedClass>
|
<UndefinedClass>
|
||||||
<code>ICalendarObject</code>
|
<code><![CDATA[ICalendarObject]]></code>
|
||||||
</UndefinedClass>
|
</UndefinedClass>
|
||||||
</file>
|
</file>
|
||||||
<file src="lib/DAV/CalendarPlugin.php">
|
<file src="lib/DAV/CalendarPlugin.php">
|
||||||
<UndefinedClass>
|
<UndefinedClass>
|
||||||
<code>ICalendarProvider</code>
|
<code><![CDATA[ICalendarProvider]]></code>
|
||||||
</UndefinedClass>
|
</UndefinedClass>
|
||||||
</file>
|
</file>
|
||||||
<file src="lib/DAV/DeckCalendarBackend.php">
|
<file src="lib/DAV/DeckCalendarBackend.php">
|
||||||
<UndefinedClass>
|
<UndefinedClass>
|
||||||
<code>NotFound</code>
|
<code><![CDATA[NotFound]]></code>
|
||||||
</UndefinedClass>
|
</UndefinedClass>
|
||||||
</file>
|
</file>
|
||||||
<file src="lib/Db/Card.php">
|
<file src="lib/Db/Card.php">
|
||||||
<UndefinedClass>
|
<UndefinedClass>
|
||||||
<code>VCalendar</code>
|
<code><![CDATA[VCalendar]]></code>
|
||||||
<code>VCalendar</code>
|
<code><![CDATA[VCalendar]]></code>
|
||||||
</UndefinedClass>
|
</UndefinedClass>
|
||||||
</file>
|
</file>
|
||||||
<file src="lib/Db/CardMapper.php">
|
|
||||||
<InvalidScalarArgument>
|
|
||||||
<code>$entity->getId()</code>
|
|
||||||
</InvalidScalarArgument>
|
|
||||||
<UndefinedInterfaceMethod>
|
|
||||||
<code>getUserIdGroups</code>
|
|
||||||
</UndefinedInterfaceMethod>
|
|
||||||
</file>
|
|
||||||
<file src="lib/Db/LabelMapper.php">
|
|
||||||
<ParamNameMismatch>
|
|
||||||
<code>$labelId</code>
|
|
||||||
</ParamNameMismatch>
|
|
||||||
</file>
|
|
||||||
<file src="lib/Db/Stack.php">
|
<file src="lib/Db/Stack.php">
|
||||||
<UndefinedClass>
|
<UndefinedClass>
|
||||||
<code>VCalendar</code>
|
<code><![CDATA[VCalendar]]></code>
|
||||||
<code>VCalendar</code>
|
<code><![CDATA[VCalendar]]></code>
|
||||||
</UndefinedClass>
|
</UndefinedClass>
|
||||||
</file>
|
</file>
|
||||||
<file src="lib/Model/BoardSummary.php">
|
|
||||||
<ConstructorSignatureMismatch>
|
|
||||||
<code>public function __construct(Board $board) {</code>
|
|
||||||
<code>public function __construct(Board $board) {</code>
|
|
||||||
</ConstructorSignatureMismatch>
|
|
||||||
</file>
|
|
||||||
<file src="lib/Model/CardDetails.php">
|
|
||||||
<ConstructorSignatureMismatch>
|
|
||||||
<code>public function __construct(Card $card, ?Board $board = null) {</code>
|
|
||||||
<code>public function __construct(Card $card, ?Board $board = null) {</code>
|
|
||||||
</ConstructorSignatureMismatch>
|
|
||||||
</file>
|
|
||||||
<file src="lib/Service/AttachmentService.php">
|
|
||||||
<InvalidCatch>
|
|
||||||
<code>try {
|
|
||||||
$attachment = $this->attachmentMapper->find($attachmentId);
|
|
||||||
} catch (IMapperException $e) {
|
|
||||||
throw new NoPermissionException('Permission denied');
|
|
||||||
}</code>
|
|
||||||
</InvalidCatch>
|
|
||||||
</file>
|
|
||||||
<file src="lib/Service/BoardService.php">
|
|
||||||
<TooManyArguments>
|
|
||||||
<code>findAll</code>
|
|
||||||
<code>findAll</code>
|
|
||||||
</TooManyArguments>
|
|
||||||
</file>
|
|
||||||
<file src="lib/Service/CirclesService.php">
|
|
||||||
<RedundantCondition>
|
|
||||||
<code>$member !== null</code>
|
|
||||||
</RedundantCondition>
|
|
||||||
</file>
|
|
||||||
<file src="lib/Service/FileService.php">
|
<file src="lib/Service/FileService.php">
|
||||||
<RedundantCondition>
|
<RedundantCondition>
|
||||||
<code>is_resource($content)</code>
|
<code><![CDATA[is_resource($content)]]></code>
|
||||||
<code>is_resource($content)</code>
|
<code><![CDATA[is_resource($content)]]></code>
|
||||||
</RedundantCondition>
|
</RedundantCondition>
|
||||||
</file>
|
</file>
|
||||||
<file src="lib/Sharing/DeckShareProvider.php">
|
<file src="lib/Service/Importer/BoardImportCommandService.php">
|
||||||
<InvalidReturnType>
|
<UndefinedInterfaceMethod>
|
||||||
<code>getShareByToken</code>
|
<code><![CDATA[ask]]></code>
|
||||||
</InvalidReturnType>
|
<code><![CDATA[ask]]></code>
|
||||||
|
<code><![CDATA[ask]]></code>
|
||||||
|
</UndefinedInterfaceMethod>
|
||||||
</file>
|
</file>
|
||||||
<file src="lib/Sharing/Listener.php">
|
<file src="lib/Service/Importer/Systems/TrelloJsonService.php">
|
||||||
<InvalidArgument>
|
<InvalidPropertyFetch>
|
||||||
<code>[self::class, 'listenPreShare']</code>
|
<code><![CDATA[$createCardDate->date]]></code>
|
||||||
</InvalidArgument>
|
</InvalidPropertyFetch>
|
||||||
|
</file>
|
||||||
|
<file src="lib/Teams/DeckTeamResourceProvider.php">
|
||||||
|
<FalsableReturnStatement>
|
||||||
|
<code><![CDATA[file_get_contents(__DIR__ . '/../../img/deck-current.svg')]]></code>
|
||||||
|
</FalsableReturnStatement>
|
||||||
</file>
|
</file>
|
||||||
</files>
|
</files>
|
||||||
|
|||||||
@@ -160,6 +160,7 @@ class ActivityManagerTest extends TestCase {
|
|||||||
'id' => 123,
|
'id' => 123,
|
||||||
'title' => 'My card',
|
'title' => 'My card',
|
||||||
'description' => str_repeat('A', 1000),
|
'description' => str_repeat('A', 1000),
|
||||||
|
'stackId' => 42,
|
||||||
]);
|
]);
|
||||||
$this->cardMapper->expects(self::any())
|
$this->cardMapper->expects(self::any())
|
||||||
->method('find')
|
->method('find')
|
||||||
@@ -170,6 +171,7 @@ class ActivityManagerTest extends TestCase {
|
|||||||
]);
|
]);
|
||||||
$this->stackMapper->expects(self::any())
|
$this->stackMapper->expects(self::any())
|
||||||
->method('find')
|
->method('find')
|
||||||
|
->with(42)
|
||||||
->willReturn($stack);
|
->willReturn($stack);
|
||||||
|
|
||||||
$expectedCard = $card->jsonSerialize();
|
$expectedCard = $card->jsonSerialize();
|
||||||
@@ -207,6 +209,7 @@ class ActivityManagerTest extends TestCase {
|
|||||||
$card->setDescription(str_repeat('A', 5000));
|
$card->setDescription(str_repeat('A', 5000));
|
||||||
$card->setTitle('My card');
|
$card->setTitle('My card');
|
||||||
$card->setId(123);
|
$card->setId(123);
|
||||||
|
$card->setStackId(42);
|
||||||
$this->cardMapper->expects(self::any())
|
$this->cardMapper->expects(self::any())
|
||||||
->method('find')
|
->method('find')
|
||||||
->willReturn($card);
|
->willReturn($card);
|
||||||
@@ -254,6 +257,7 @@ class ActivityManagerTest extends TestCase {
|
|||||||
$card->setDescription(str_repeat('A', 5000));
|
$card->setDescription(str_repeat('A', 5000));
|
||||||
$card->setTitle('My card');
|
$card->setTitle('My card');
|
||||||
$card->setId(123);
|
$card->setId(123);
|
||||||
|
$card->setStackId(42);
|
||||||
$this->cardMapper->expects(self::any())
|
$this->cardMapper->expects(self::any())
|
||||||
->method('find')
|
->method('find')
|
||||||
->willReturn($card);
|
->willReturn($card);
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ class AttachmentMapperTest extends TestCase {
|
|||||||
->method('isOwner')
|
->method('isOwner')
|
||||||
->with('admin', 1)
|
->with('admin', 1)
|
||||||
->willReturn(true);
|
->willReturn(true);
|
||||||
$this->assertTrue($this->attachmentMapper->isOwner('admin', (string)$this->attachments[0]->getId()));
|
$this->assertTrue($this->attachmentMapper->isOwner('admin', $this->attachments[0]->getId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testIsOwnerInvalid() {
|
public function testIsOwnerInvalid() {
|
||||||
@@ -127,7 +127,7 @@ class AttachmentMapperTest extends TestCase {
|
|||||||
->method('isOwner')
|
->method('isOwner')
|
||||||
->with('admin', 1)
|
->with('admin', 1)
|
||||||
->will($this->throwException(new DoesNotExistException('does not exist')));
|
->will($this->throwException(new DoesNotExistException('does not exist')));
|
||||||
$this->assertFalse($this->attachmentMapper->isOwner('admin', (string)$this->attachments[0]->getId()));
|
$this->assertFalse($this->attachmentMapper->isOwner('admin', $this->attachments[0]->getId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testFindBoardId() {
|
public function testFindBoardId() {
|
||||||
|
|||||||
@@ -81,8 +81,8 @@ class CardTest extends TestCase {
|
|||||||
'duedate' => null,
|
'duedate' => null,
|
||||||
'overdue' => 0,
|
'overdue' => 0,
|
||||||
'archived' => false,
|
'archived' => false,
|
||||||
'attachments' => null,
|
'attachments' => [],
|
||||||
'attachmentCount' => null,
|
'attachmentCount' => 0,
|
||||||
'assignedUsers' => null,
|
'assignedUsers' => null,
|
||||||
'deletedAt' => 0,
|
'deletedAt' => 0,
|
||||||
'commentsUnread' => 0,
|
'commentsUnread' => 0,
|
||||||
@@ -110,8 +110,8 @@ class CardTest extends TestCase {
|
|||||||
'duedate' => null,
|
'duedate' => null,
|
||||||
'overdue' => 0,
|
'overdue' => 0,
|
||||||
'archived' => false,
|
'archived' => false,
|
||||||
'attachments' => null,
|
'attachments' => [],
|
||||||
'attachmentCount' => null,
|
'attachmentCount' => 0,
|
||||||
'assignedUsers' => null,
|
'assignedUsers' => null,
|
||||||
'deletedAt' => 0,
|
'deletedAt' => 0,
|
||||||
'commentsUnread' => 0,
|
'commentsUnread' => 0,
|
||||||
@@ -141,8 +141,8 @@ class CardTest extends TestCase {
|
|||||||
'duedate' => null,
|
'duedate' => null,
|
||||||
'overdue' => 0,
|
'overdue' => 0,
|
||||||
'archived' => false,
|
'archived' => false,
|
||||||
'attachments' => null,
|
'attachments' => [],
|
||||||
'attachmentCount' => null,
|
'attachmentCount' => 0,
|
||||||
'assignedUsers' => ['user1'],
|
'assignedUsers' => ['user1'],
|
||||||
'deletedAt' => 0,
|
'deletedAt' => 0,
|
||||||
'commentsUnread' => 0,
|
'commentsUnread' => 0,
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @copyright Copyright (c) 2018 Julius Härtl <jus@bitgrid.net>
|
* @copyright Copyright (c) 2018 Julius Härtl <jus@bitgrid.net>
|
||||||
*
|
*
|
||||||
@@ -116,7 +118,7 @@ class AttachmentServiceTest extends TestCase {
|
|||||||
$this->activityManager = $this->createMock(ActivityManager::class);
|
$this->activityManager = $this->createMock(ActivityManager::class);
|
||||||
|
|
||||||
$this->appContainer->expects($this->exactly(2))
|
$this->appContainer->expects($this->exactly(2))
|
||||||
->method('query')
|
->method('get')
|
||||||
->withConsecutive(
|
->withConsecutive(
|
||||||
[FileService::class],
|
[FileService::class],
|
||||||
[FilesAppService::class]
|
[FilesAppService::class]
|
||||||
@@ -156,7 +158,7 @@ class AttachmentServiceTest extends TestCase {
|
|||||||
$fileAppServiceMock = $this->createMock(FilesAppService::class);
|
$fileAppServiceMock = $this->createMock(FilesAppService::class);
|
||||||
|
|
||||||
$appContainer->expects($this->exactly(3))
|
$appContainer->expects($this->exactly(3))
|
||||||
->method('query')
|
->method('get')
|
||||||
->withConsecutive(
|
->withConsecutive(
|
||||||
[FileService::class],
|
[FileService::class],
|
||||||
[FilesAppService::class],
|
[FilesAppService::class],
|
||||||
@@ -185,7 +187,7 @@ class AttachmentServiceTest extends TestCase {
|
|||||||
$fileAppServiceMock = $this->createMock(FilesAppService::class);
|
$fileAppServiceMock = $this->createMock(FilesAppService::class);
|
||||||
|
|
||||||
$appContainer->expects($this->exactly(3))
|
$appContainer->expects($this->exactly(3))
|
||||||
->method('query')
|
->method('get')
|
||||||
->withConsecutive(
|
->withConsecutive(
|
||||||
[FileService::class],
|
[FileService::class],
|
||||||
[FilesAppService::class],
|
[FilesAppService::class],
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @copyright Copyright (c) 2016 Julius Härtl <jus@bitgrid.net>
|
* @copyright Copyright (c) 2016 Julius Härtl <jus@bitgrid.net>
|
||||||
*
|
*
|
||||||
@@ -240,6 +242,7 @@ class BoardServiceTest extends TestCase {
|
|||||||
|
|
||||||
public function testDelete() {
|
public function testDelete() {
|
||||||
$board = new Board();
|
$board = new Board();
|
||||||
|
$board->setId(42);
|
||||||
$board->setOwner('admin');
|
$board->setOwner('admin');
|
||||||
$board->setDeletedAt(0);
|
$board->setDeletedAt(0);
|
||||||
$this->boardMapper->expects($this->once())
|
$this->boardMapper->expects($this->once())
|
||||||
@@ -252,7 +255,7 @@ class BoardServiceTest extends TestCase {
|
|||||||
]);
|
]);
|
||||||
$this->sessionMapper->expects($this->once())
|
$this->sessionMapper->expects($this->once())
|
||||||
->method('findAllActive')
|
->method('findAllActive')
|
||||||
->with(null)
|
->with(42)
|
||||||
->willReturn([]);
|
->willReturn([]);
|
||||||
$boardDeleted = clone $board;
|
$boardDeleted = clone $board;
|
||||||
$boardDeleted->setDeletedAt(1);
|
$boardDeleted->setDeletedAt(1);
|
||||||
@@ -267,7 +270,7 @@ class BoardServiceTest extends TestCase {
|
|||||||
$user->method('getUID')->willReturn('admin');
|
$user->method('getUID')->willReturn('admin');
|
||||||
$acl = new Acl();
|
$acl = new Acl();
|
||||||
$acl->setBoardId(123);
|
$acl->setBoardId(123);
|
||||||
$acl->setType('user');
|
$acl->setType(Acl::PERMISSION_TYPE_USER);
|
||||||
$acl->setParticipant('admin');
|
$acl->setParticipant('admin');
|
||||||
$acl->setPermissionEdit(true);
|
$acl->setPermissionEdit(true);
|
||||||
$acl->setPermissionShare(true);
|
$acl->setPermissionShare(true);
|
||||||
@@ -287,7 +290,7 @@ class BoardServiceTest extends TestCase {
|
|||||||
'admin' => 'admin',
|
'admin' => 'admin',
|
||||||
]);
|
]);
|
||||||
$this->assertEquals($acl, $this->service->addAcl(
|
$this->assertEquals($acl, $this->service->addAcl(
|
||||||
123, 'user', 'admin', true, true, true
|
123, Acl::PERMISSION_TYPE_USER, 'admin', true, true, true
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -323,7 +326,7 @@ class BoardServiceTest extends TestCase {
|
|||||||
public function testAddAclExtendPermission($currentUserAcl, $providedAcl, $resultingAcl) {
|
public function testAddAclExtendPermission($currentUserAcl, $providedAcl, $resultingAcl) {
|
||||||
$existingAcl = new Acl();
|
$existingAcl = new Acl();
|
||||||
$existingAcl->setBoardId(123);
|
$existingAcl->setBoardId(123);
|
||||||
$existingAcl->setType('user');
|
$existingAcl->setType(Acl::PERMISSION_TYPE_USER);
|
||||||
$existingAcl->setParticipant('admin');
|
$existingAcl->setParticipant('admin');
|
||||||
$existingAcl->setPermissionEdit($currentUserAcl[0]);
|
$existingAcl->setPermissionEdit($currentUserAcl[0]);
|
||||||
$existingAcl->setPermissionShare($currentUserAcl[1]);
|
$existingAcl->setPermissionShare($currentUserAcl[1]);
|
||||||
@@ -391,14 +394,14 @@ class BoardServiceTest extends TestCase {
|
|||||||
->method('dispatchTyped')
|
->method('dispatchTyped')
|
||||||
->with(new AclCreatedEvent($acl));
|
->with(new AclCreatedEvent($acl));
|
||||||
$this->assertEquals($expected, $this->service->addAcl(
|
$this->assertEquals($expected, $this->service->addAcl(
|
||||||
123, 'user', 'admin', $providedAcl[0], $providedAcl[1], $providedAcl[2]
|
123, Acl::PERMISSION_TYPE_USER, 'admin', $providedAcl[0], $providedAcl[1], $providedAcl[2]
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testUpdateAcl() {
|
public function testUpdateAcl() {
|
||||||
$acl = new Acl();
|
$acl = new Acl();
|
||||||
$acl->setBoardId(123);
|
$acl->setBoardId(123);
|
||||||
$acl->setType('user');
|
$acl->setType(Acl::PERMISSION_TYPE_USER);
|
||||||
$acl->setParticipant('admin');
|
$acl->setParticipant('admin');
|
||||||
$acl->setPermissionEdit(true);
|
$acl->setPermissionEdit(true);
|
||||||
$acl->setPermissionShare(true);
|
$acl->setPermissionShare(true);
|
||||||
|
|||||||
@@ -183,6 +183,7 @@ class CardServiceTest extends TestCase {
|
|||||||
->willReturn($boardMock);
|
->willReturn($boardMock);
|
||||||
$card = new Card();
|
$card = new Card();
|
||||||
$card->setId(1337);
|
$card->setId(1337);
|
||||||
|
$card->setStackId(123);
|
||||||
$this->cardMapper->expects($this->any())
|
$this->cardMapper->expects($this->any())
|
||||||
->method('find')
|
->method('find')
|
||||||
->with(123)
|
->with(123)
|
||||||
@@ -200,6 +201,7 @@ class CardServiceTest extends TestCase {
|
|||||||
->with([1337])
|
->with([1337])
|
||||||
->willReturn([$a1, $a2]);
|
->willReturn([$a1, $a2]);
|
||||||
$cardExpected = new Card();
|
$cardExpected = new Card();
|
||||||
|
$cardExpected->setStackId(123);
|
||||||
$cardExpected->setId(1337);
|
$cardExpected->setId(1337);
|
||||||
$cardExpected->setAssignedUsers([$a1, $a2]);
|
$cardExpected->setAssignedUsers([$a1, $a2]);
|
||||||
$cardExpected->setRelatedBoard($boardMock);
|
$cardExpected->setRelatedBoard($boardMock);
|
||||||
@@ -218,6 +220,7 @@ class CardServiceTest extends TestCase {
|
|||||||
'stackId' => 123,
|
'stackId' => 123,
|
||||||
'order' => 999,
|
'order' => 999,
|
||||||
'type' => 'text',
|
'type' => 'text',
|
||||||
|
'id' => 0,
|
||||||
]);
|
]);
|
||||||
$stack = Stack::fromParams([
|
$stack = Stack::fromParams([
|
||||||
'id' => 123,
|
'id' => 123,
|
||||||
@@ -243,6 +246,8 @@ class CardServiceTest extends TestCase {
|
|||||||
$card = new Card();
|
$card = new Card();
|
||||||
$card->setId(1);
|
$card->setId(1);
|
||||||
$card->setTitle('Card title');
|
$card->setTitle('Card title');
|
||||||
|
$card->setType('test');
|
||||||
|
$card->setOrder(0);
|
||||||
$card->setOwner('admin');
|
$card->setOwner('admin');
|
||||||
$card->setStackId(12345);
|
$card->setStackId(12345);
|
||||||
$clonedCard = clone $card;
|
$clonedCard = clone $card;
|
||||||
@@ -290,8 +295,7 @@ class CardServiceTest extends TestCase {
|
|||||||
->willReturn([$label]);
|
->willReturn([$label]);
|
||||||
$this->cardMapper->expects($this->once())
|
$this->cardMapper->expects($this->once())
|
||||||
->method('assignLabel')
|
->method('assignLabel')
|
||||||
->with($clonedCard->getId(), $label->getId())
|
->with($clonedCard->getId(), $label->getId());
|
||||||
->willReturn($label);
|
|
||||||
|
|
||||||
$stackMock = new Stack();
|
$stackMock = new Stack();
|
||||||
$stackMock->setBoardId(1234);
|
$stackMock->setBoardId(1234);
|
||||||
@@ -329,6 +333,7 @@ class CardServiceTest extends TestCase {
|
|||||||
]);
|
]);
|
||||||
$this->cardMapper->expects($this->once())->method('find')->willReturn($card);
|
$this->cardMapper->expects($this->once())->method('find')->willReturn($card);
|
||||||
$this->cardMapper->expects($this->once())->method('update')->willReturnCallback(function ($c) {
|
$this->cardMapper->expects($this->once())->method('update')->willReturnCallback(function ($c) {
|
||||||
|
$c->setId(1);
|
||||||
return $c;
|
return $c;
|
||||||
});
|
});
|
||||||
$this->stackMapper->expects($this->once())
|
$this->stackMapper->expects($this->once())
|
||||||
|
|||||||
@@ -220,8 +220,9 @@ class DefaultBoardServiceTest extends TestCase {
|
|||||||
return $stack;
|
return $stack;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function assembleTestCard($title, $stackId, $userId) {
|
private function assembleTestCard(string $title, int $stackId, string $userId): Card {
|
||||||
$card = new Card();
|
$card = new Card();
|
||||||
|
$card->setId(1);
|
||||||
$card->setTitle($title);
|
$card->setTitle($title);
|
||||||
$card->setStackId($stackId);
|
$card->setStackId($stackId);
|
||||||
$card->setType('text');
|
$card->setType('text');
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user