mirror of
https://github.com/solidtime-io/solidtime.git
synced 2026-08-18 05:02:14 +01:00
Compare commits
26 Commits
dependabot
...
f826474f88
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f826474f88 | ||
|
|
98bbe800f1 | ||
|
|
7035d5fd6e | ||
|
|
f32ec59bb5 | ||
|
|
d2b6be137f | ||
|
|
dc082b2b19 | ||
|
|
82ad8ee316 | ||
|
|
117c3c4b6c | ||
|
|
4c2586936d | ||
|
|
ca843168f6 | ||
|
|
67dcf77635 | ||
|
|
dcd21345b2 | ||
|
|
1f832a24a0 | ||
|
|
07cf3f7405 | ||
|
|
a880ccb32c | ||
|
|
5a41c356d4 | ||
|
|
72bddfba8b | ||
|
|
34a1a89c30 | ||
|
|
77e4d768d4 | ||
|
|
d42e3ffff0 | ||
|
|
4e26c8ad6d | ||
|
|
57794940f1 | ||
|
|
09827d3d83 | ||
|
|
64c5da5223 | ||
|
|
983e6c3815 | ||
|
|
f34b60874e |
28
.github/workflows/build-onpremise.yml
vendored
28
.github/workflows/build-onpremise.yml
vendored
@@ -35,7 +35,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: "Check out code"
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0 # Required for WyriHaximus/github-action-get-previous-tag
|
||||
|
||||
@@ -46,9 +46,9 @@ jobs:
|
||||
- name: "Get Previous tag (normal push)"
|
||||
id: previoustag
|
||||
if: ${{ !startsWith(github.ref, 'refs/tags/v') }}
|
||||
uses: "WyriHaximus/github-action-get-previous-tag@v2"
|
||||
uses: "WyriHaximus/github-action-get-previous-tag@v1"
|
||||
with:
|
||||
pattern: "v*[0-9].*[0-9].*[0-9]"
|
||||
prefix: "v"
|
||||
|
||||
- name: "Get version"
|
||||
id: release-version
|
||||
@@ -96,7 +96,7 @@ jobs:
|
||||
node-version: '20.x'
|
||||
|
||||
- name: "Checkout invoicing extension"
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: solidtime-io/extension-invoicing
|
||||
path: extensions/Invoicing
|
||||
@@ -124,27 +124,27 @@ jobs:
|
||||
|
||||
- name: "Docker meta"
|
||||
id: "meta"
|
||||
uses: docker/metadata-action@v6
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: |
|
||||
${{ env.DOCKER_REPO }}
|
||||
|
||||
- name: "Login to solidtime OnPremise Registry"
|
||||
uses: docker/login-action@v4
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: registry.on-premise.solidtime.io
|
||||
username: ${{ secrets.ONPREMISE_USERNAME }}
|
||||
password: ${{ secrets.ONPREMISE_TOKEN }}
|
||||
|
||||
- name: "Set up QEMU"
|
||||
uses: docker/setup-qemu-action@v4
|
||||
uses: docker/setup-qemu-action@v3
|
||||
|
||||
- name: "Set up Docker Buildx"
|
||||
uses: docker/setup-buildx-action@v4
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: "Build and push by digest"
|
||||
id: build
|
||||
uses: docker/build-push-action@v7
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: .
|
||||
file: docker/prod/Dockerfile
|
||||
@@ -163,7 +163,7 @@ jobs:
|
||||
touch "${{ runner.temp }}/digests/${digest#sha256:}"
|
||||
|
||||
- name: "Upload digest"
|
||||
uses: actions/upload-artifact@v7
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: digests-${{ env.PLATFORM_PAIR }}
|
||||
path: ${{ runner.temp }}/digests/*
|
||||
@@ -177,25 +177,25 @@ jobs:
|
||||
- build
|
||||
steps:
|
||||
- name: "Download digests"
|
||||
uses: actions/download-artifact@v8
|
||||
uses: actions/download-artifact@v6
|
||||
with:
|
||||
path: ${{ runner.temp }}/digests
|
||||
pattern: digests-*
|
||||
merge-multiple: true
|
||||
|
||||
- name: "Login to solidtime OnPremise Registry"
|
||||
uses: docker/login-action@v4
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: registry.on-premise.solidtime.io
|
||||
username: ${{ secrets.ONPREMISE_USERNAME }}
|
||||
password: ${{ secrets.ONPREMISE_TOKEN }}
|
||||
|
||||
- name: "Set up Docker Buildx"
|
||||
uses: docker/setup-buildx-action@v4
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: "Docker meta"
|
||||
id: meta
|
||||
uses: docker/metadata-action@v6
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: |
|
||||
${{ env.DOCKER_REPO }}
|
||||
|
||||
22
.github/workflows/build-private.yml
vendored
22
.github/workflows/build-private.yml
vendored
@@ -22,7 +22,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: "Check out code"
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v5
|
||||
with:
|
||||
fetch-depth: 0 # Required for WyriHaximus/github-action-get-previous-tag
|
||||
|
||||
@@ -33,9 +33,9 @@ jobs:
|
||||
- name: "Get Previous tag (normal push)"
|
||||
id: previoustag
|
||||
if: ${{ !startsWith(github.ref, 'refs/tags/v') }}
|
||||
uses: "WyriHaximus/github-action-get-previous-tag@v2"
|
||||
uses: "WyriHaximus/github-action-get-previous-tag@v1"
|
||||
with:
|
||||
pattern: "v*[0-9].*[0-9].*[0-9]"
|
||||
prefix: "v"
|
||||
|
||||
- name: "Get version"
|
||||
id: version
|
||||
@@ -73,7 +73,7 @@ jobs:
|
||||
node-version: '20.x'
|
||||
|
||||
- name: "Checkout billing extension"
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v5
|
||||
with:
|
||||
repository: solidtime-io/extension-billing
|
||||
path: extensions/Billing
|
||||
@@ -93,7 +93,7 @@ jobs:
|
||||
run: cd extensions/Billing && npm ci
|
||||
|
||||
- name: "Checkout services extension"
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v5
|
||||
with:
|
||||
repository: solidtime-io/extension-services
|
||||
path: extensions/Services
|
||||
@@ -111,7 +111,7 @@ jobs:
|
||||
run: cd extensions/Services && npm ci
|
||||
|
||||
- name: "Checkout invoicing extension"
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v5
|
||||
with:
|
||||
repository: solidtime-io/extension-invoicing
|
||||
path: extensions/Invoicing
|
||||
@@ -160,7 +160,7 @@ jobs:
|
||||
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
|
||||
|
||||
- name: "Login to GitHub Container Registry"
|
||||
uses: docker/login-action@v4
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: rg.fr-par.scw.cloud/solidtime
|
||||
username: nologin
|
||||
@@ -168,7 +168,7 @@ jobs:
|
||||
|
||||
- name: "Docker meta"
|
||||
id: "meta"
|
||||
uses: docker/metadata-action@v6
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: rg.fr-par.scw.cloud/solidtime/solidtime
|
||||
tags: |
|
||||
@@ -179,13 +179,13 @@ jobs:
|
||||
type=sha,format=long
|
||||
|
||||
- name: "Set up QEMU"
|
||||
uses: docker/setup-qemu-action@v4
|
||||
uses: docker/setup-qemu-action@v3
|
||||
|
||||
- name: "Set up Docker Buildx"
|
||||
uses: docker/setup-buildx-action@v4
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: "Build and push"
|
||||
uses: docker/build-push-action@v7
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: .
|
||||
build-args: |
|
||||
|
||||
30
.github/workflows/build-public.yml
vendored
30
.github/workflows/build-public.yml
vendored
@@ -36,7 +36,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: "Check out code"
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v5
|
||||
with:
|
||||
fetch-depth: 0 # Required for WyriHaximus/github-action-get-previous-tag
|
||||
|
||||
@@ -47,9 +47,9 @@ jobs:
|
||||
- name: "Get Previous tag (normal push)"
|
||||
id: previoustag
|
||||
if: ${{ !startsWith(github.ref, 'refs/tags/v') }}
|
||||
uses: "WyriHaximus/github-action-get-previous-tag@v2"
|
||||
uses: "WyriHaximus/github-action-get-previous-tag@v1"
|
||||
with:
|
||||
pattern: "v*[0-9].*[0-9].*[0-9]"
|
||||
prefix: "v"
|
||||
|
||||
- name: "Get version"
|
||||
id: release-version
|
||||
@@ -109,34 +109,34 @@ jobs:
|
||||
|
||||
- name: "Docker meta"
|
||||
id: "meta"
|
||||
uses: docker/metadata-action@v6
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: |
|
||||
${{ env.DOCKERHUB_REPO }}
|
||||
${{ env.GHCR_REPO }}
|
||||
|
||||
- name: "Login to Docker Hub Container Registry"
|
||||
uses: docker/login-action@v4
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
|
||||
- name: "Login to GitHub Container Registry"
|
||||
uses: docker/login-action@v4
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: "Set up QEMU"
|
||||
uses: docker/setup-qemu-action@v4
|
||||
uses: docker/setup-qemu-action@v3
|
||||
|
||||
- name: "Set up Docker Buildx"
|
||||
uses: docker/setup-buildx-action@v4
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: "Build and push by digest"
|
||||
id: build
|
||||
uses: docker/build-push-action@v7
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: .
|
||||
file: docker/prod/Dockerfile
|
||||
@@ -155,7 +155,7 @@ jobs:
|
||||
touch "${{ runner.temp }}/digests/${digest#sha256:}"
|
||||
|
||||
- name: "Upload digest"
|
||||
uses: actions/upload-artifact@v7
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: digests-${{ env.PLATFORM_PAIR }}
|
||||
path: ${{ runner.temp }}/digests/*
|
||||
@@ -169,31 +169,31 @@ jobs:
|
||||
- build
|
||||
steps:
|
||||
- name: "Download digests"
|
||||
uses: actions/download-artifact@v8
|
||||
uses: actions/download-artifact@v6
|
||||
with:
|
||||
path: ${{ runner.temp }}/digests
|
||||
pattern: digests-*
|
||||
merge-multiple: true
|
||||
|
||||
- name: "Login to Docker Hub"
|
||||
uses: docker/login-action@v4
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
|
||||
- name: "Login to GHCR"
|
||||
uses: docker/login-action@v4
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: "Set up Docker Buildx"
|
||||
uses: docker/setup-buildx-action@v4
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: "Docker meta"
|
||||
id: meta
|
||||
uses: docker/metadata-action@v6
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: |
|
||||
${{ env.DOCKERHUB_REPO }}
|
||||
|
||||
4
.github/workflows/generate-api-docs.yml
vendored
4
.github/workflows/generate-api-docs.yml
vendored
@@ -29,7 +29,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: "Checkout code"
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v5
|
||||
|
||||
- name: "Setup PHP"
|
||||
uses: shivammathur/setup-php@v2
|
||||
@@ -52,7 +52,7 @@ jobs:
|
||||
run: php artisan scramble:export --path=build/api-docs.json
|
||||
|
||||
- name: "Upload API docs to GitHub"
|
||||
uses: actions/upload-artifact@v7
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: api-docs.json
|
||||
path: build/api-docs.json
|
||||
|
||||
2
.github/workflows/npm-build.yml
vendored
2
.github/workflows/npm-build.yml
vendored
@@ -11,7 +11,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: "Checkout code"
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v5
|
||||
|
||||
- name: "Setup PHP (for Ziggy)"
|
||||
uses: shivammathur/setup-php@v2
|
||||
|
||||
2
.github/workflows/npm-format-check.yml
vendored
2
.github/workflows/npm-format-check.yml
vendored
@@ -9,7 +9,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: "Checkout code"
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v5
|
||||
|
||||
- name: "Use Node.js"
|
||||
uses: actions/setup-node@v6
|
||||
|
||||
2
.github/workflows/npm-lint.yml
vendored
2
.github/workflows/npm-lint.yml
vendored
@@ -11,7 +11,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: "Checkout code"
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v5
|
||||
|
||||
- name: "Use Node.js"
|
||||
uses: actions/setup-node@v6
|
||||
|
||||
2
.github/workflows/npm-publish-api.yml
vendored
2
.github/workflows/npm-publish-api.yml
vendored
@@ -11,7 +11,7 @@ jobs:
|
||||
id-token: write
|
||||
steps:
|
||||
- name: "Checkout code"
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v5
|
||||
# Setup .npmrc file to publish to npm
|
||||
- name: Install root project dependencies
|
||||
run: npm ci
|
||||
|
||||
2
.github/workflows/npm-publish-ui.yml
vendored
2
.github/workflows/npm-publish-ui.yml
vendored
@@ -11,7 +11,7 @@ jobs:
|
||||
id-token: write
|
||||
steps:
|
||||
- name: "Checkout code"
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v5
|
||||
# Setup .npmrc file to publish to npm
|
||||
- uses: actions/setup-node@v6
|
||||
with:
|
||||
|
||||
4
.github/workflows/npm-test-unit.yml
vendored
4
.github/workflows/npm-test-unit.yml
vendored
@@ -13,10 +13,10 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: "Checkout code"
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: "Use Node.js"
|
||||
uses: actions/setup-node@v6
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '20.x'
|
||||
|
||||
|
||||
2
.github/workflows/npm-typecheck.yml
vendored
2
.github/workflows/npm-typecheck.yml
vendored
@@ -10,7 +10,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: "Checkout code"
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v5
|
||||
|
||||
- name: "Setup PHP (for Ziggy)"
|
||||
uses: shivammathur/setup-php@v2
|
||||
|
||||
2
.github/workflows/phpstan.yml
vendored
2
.github/workflows/phpstan.yml
vendored
@@ -9,7 +9,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: "Checkout code"
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v5
|
||||
|
||||
- name: "Setup PHP"
|
||||
uses: shivammathur/setup-php@v2
|
||||
|
||||
4
.github/workflows/phpunit.yml
vendored
4
.github/workflows/phpunit.yml
vendored
@@ -36,7 +36,7 @@ jobs:
|
||||
--health-retries 5
|
||||
steps:
|
||||
- name: "Checkout code"
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v5
|
||||
|
||||
- name: "Setup PHP"
|
||||
uses: shivammathur/setup-php@v2
|
||||
@@ -68,7 +68,7 @@ jobs:
|
||||
run: php artisan test --stop-on-failure --coverage-text --coverage-clover=coverage.xml
|
||||
|
||||
- name: "Upload coverage reports to Codecov"
|
||||
uses: codecov/codecov-action@v7.0.0
|
||||
uses: codecov/codecov-action@v5.5.1
|
||||
with:
|
||||
token: ${{ secrets.CODECOV_TOKEN }}
|
||||
slug: solidtime-io/solidtime
|
||||
|
||||
2
.github/workflows/pint.yml
vendored
2
.github/workflows/pint.yml
vendored
@@ -9,7 +9,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: "Checkout code"
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v5
|
||||
|
||||
- name: "Check code style"
|
||||
uses: aglipanci/laravel-pint-action@2.6
|
||||
|
||||
12
.github/workflows/playwright.yml
vendored
12
.github/workflows/playwright.yml
vendored
@@ -35,7 +35,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: "Checkout code"
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v5
|
||||
|
||||
- name: "Setup node"
|
||||
uses: actions/setup-node@v6
|
||||
@@ -86,7 +86,7 @@ jobs:
|
||||
MAILPIT_BASE_URL: 'http://localhost:8025'
|
||||
|
||||
- name: "Upload blob report"
|
||||
uses: actions/upload-artifact@v7
|
||||
uses: actions/upload-artifact@v4
|
||||
if: always()
|
||||
with:
|
||||
name: blob-report-${{ matrix.shardIndex }}
|
||||
@@ -99,10 +99,10 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: "Checkout code"
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: "Setup node"
|
||||
uses: actions/setup-node@v6
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '20.x'
|
||||
|
||||
@@ -110,7 +110,7 @@ jobs:
|
||||
run: npm ci
|
||||
|
||||
- name: "Download blob reports"
|
||||
uses: actions/download-artifact@v8
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
path: all-blob-reports
|
||||
pattern: blob-report-*
|
||||
@@ -120,7 +120,7 @@ jobs:
|
||||
run: npx playwright merge-reports --reporter html ./all-blob-reports
|
||||
|
||||
- name: "Upload merged HTML report"
|
||||
uses: actions/upload-artifact@v7
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: playwright-report
|
||||
path: playwright-report/
|
||||
|
||||
@@ -9,9 +9,6 @@ use App\Models\Organization;
|
||||
use App\Models\User;
|
||||
use Illuminate\Foundation\Events\Dispatchable;
|
||||
|
||||
/**
|
||||
* Replaces legacy TeamMemberAdded event.
|
||||
*/
|
||||
class MemberAdded
|
||||
{
|
||||
use Dispatchable;
|
||||
|
||||
@@ -9,9 +9,6 @@ use App\Models\Organization;
|
||||
use App\Models\User;
|
||||
use Illuminate\Foundation\Events\Dispatchable;
|
||||
|
||||
/**
|
||||
* Replaces legacy AddingTeamMember event.
|
||||
*/
|
||||
class MemberAdding
|
||||
{
|
||||
use Dispatchable;
|
||||
|
||||
@@ -9,9 +9,6 @@ use App\Models\Organization;
|
||||
use App\Models\User;
|
||||
use Illuminate\Foundation\Events\Dispatchable;
|
||||
|
||||
/**
|
||||
* Replaces legacy InvitingTeamMember event.
|
||||
*/
|
||||
class OrganizationInvitationAdding
|
||||
{
|
||||
use Dispatchable;
|
||||
|
||||
@@ -6,7 +6,6 @@ namespace App\Http\Controllers\Api\V1;
|
||||
|
||||
use App\Enums\Role;
|
||||
use App\Events\AfterCreateOrganization;
|
||||
use App\Http\Requests\V1\Organization\OrganizationDestroyRequest;
|
||||
use App\Http\Requests\V1\Organization\OrganizationStoreRequest;
|
||||
use App\Http\Requests\V1\Organization\OrganizationUpdateRequest;
|
||||
use App\Http\Resources\V1\Organization\OrganizationResource;
|
||||
@@ -51,9 +50,6 @@ class OrganizationController extends Controller
|
||||
if ($request->getName() !== null) {
|
||||
$organization->name = $request->getName();
|
||||
}
|
||||
if ($request->getCurrency() !== null) {
|
||||
$organization->currency = $request->getCurrency();
|
||||
}
|
||||
if ($request->getEmployeesCanSeeBillableRates() !== null) {
|
||||
$organization->employees_can_see_billable_rates = $request->getEmployeesCanSeeBillableRates();
|
||||
}
|
||||
@@ -125,7 +121,7 @@ class OrganizationController extends Controller
|
||||
*
|
||||
* @throws AuthorizationException
|
||||
*/
|
||||
public function destroy(Organization $organization, OrganizationDestroyRequest $request, DeletionService $deletionService): JsonResponse
|
||||
public function destroy(Organization $organization, DeletionService $deletionService): JsonResponse
|
||||
{
|
||||
$this->checkPermission($organization, 'organizations:delete');
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@ namespace App\Http\Controllers\Api\V1;
|
||||
|
||||
use App\Exceptions\Api\CanNotDeleteUserWhoIsOwnerOfOrganizationWithMultipleMembers;
|
||||
use App\Exceptions\Api\UserResendEmailVerificationNoPendingEmailApiException;
|
||||
use App\Http\Requests\V1\User\UserDestroyRequest;
|
||||
use App\Http\Requests\V1\User\UserUpdateCurrentOrganizationRequest;
|
||||
use App\Http\Requests\V1\User\UserUpdateRequest;
|
||||
use App\Http\Resources\V1\User\UserResource;
|
||||
@@ -194,7 +193,7 @@ class UserController extends Controller
|
||||
* @throws AuthorizationException Thrown when the authenticated user does not match the user to be deleted.
|
||||
* @throws CanNotDeleteUserWhoIsOwnerOfOrganizationWithMultipleMembers Thrown when the user to be deleted is the owner of an organization with multiple members.
|
||||
*/
|
||||
public function destroy(User $user, UserDestroyRequest $request, DeletionService $deletionService): JsonResponse
|
||||
public function destroy(User $user, DeletionService $deletionService): JsonResponse
|
||||
{
|
||||
if ($user->getKey() !== $this->user()->getKey()) {
|
||||
throw new AuthorizationException;
|
||||
|
||||
@@ -54,9 +54,15 @@ class OrganizationController extends Controller
|
||||
'currencies' => array_map(function (Currency $currency): string {
|
||||
return $currency->getName();
|
||||
}, ISOCurrencyProvider::getInstance()->getAvailableCurrencies()),
|
||||
'availableRoles' => [],
|
||||
'availablePermissions' => [],
|
||||
'defaultPermissions' => [],
|
||||
'permissions' => [
|
||||
'canDeleteTeam' => $this->hasPermission($organization, 'organizations:delete'),
|
||||
'canUpdateTeam' => $this->hasPermission($organization, 'organizations:update'),
|
||||
'canAddTeamMembers' => true,
|
||||
'canDeleteTeam' => true,
|
||||
'canRemoveTeamMembers' => true,
|
||||
'canUpdateTeam' => true,
|
||||
'canUpdateTeamMembers' => true,
|
||||
],
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -1,54 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Http\Controllers\Web;
|
||||
|
||||
use Illuminate\Contracts\Auth\StatefulGuard;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Routing\Controller;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
use Laravel\Fortify\Actions\ConfirmPassword;
|
||||
|
||||
class OtherBrowserSessionsController extends Controller
|
||||
{
|
||||
/**
|
||||
* Log the user out of their other browser sessions across all devices.
|
||||
*/
|
||||
public function destroy(Request $request, StatefulGuard $guard): RedirectResponse
|
||||
{
|
||||
$password = (string) $request->string('password');
|
||||
|
||||
$confirmed = app(ConfirmPassword::class)($guard, $request->user(), $password);
|
||||
|
||||
if (! $confirmed) {
|
||||
throw ValidationException::withMessages([
|
||||
'password' => __('The password is incorrect.'),
|
||||
]);
|
||||
}
|
||||
|
||||
$guard->logoutOtherDevices($password);
|
||||
|
||||
$this->deleteOtherSessionRecords($request);
|
||||
|
||||
return back(303);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete the other browser session records from storage.
|
||||
*/
|
||||
protected function deleteOtherSessionRecords(Request $request): void
|
||||
{
|
||||
if (config('session.driver') !== 'database') {
|
||||
return;
|
||||
}
|
||||
|
||||
DB::connection(config('session.connection'))
|
||||
->table(config('session.table', 'sessions'))
|
||||
->where('user_id', $request->user()->getAuthIdentifier())
|
||||
->where('id', '!=', $request->session()->getId())
|
||||
->delete();
|
||||
}
|
||||
}
|
||||
@@ -17,7 +17,7 @@ class EnsureEmailIsVerified
|
||||
*/
|
||||
public function handle(Request $request, Closure $next, ?string $redirectToRoute = null): Response
|
||||
{
|
||||
if (! app()->isLocal() || config('app.local_email_verification')) {
|
||||
if (! app()->isLocal()) {
|
||||
if ($request->user() === null ||
|
||||
(! $request->user()->hasVerifiedEmail())) {
|
||||
return $request->expectsJson()
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Http\Requests\V1\Organization;
|
||||
|
||||
use App\Http\Requests\V1\BaseFormRequest;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Validation\Validator;
|
||||
|
||||
class OrganizationDestroyRequest extends BaseFormRequest
|
||||
{
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array<string, array<string>>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'password' => [
|
||||
'required',
|
||||
'string',
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<int, callable(Validator): void>
|
||||
*/
|
||||
public function after(): array
|
||||
{
|
||||
return [
|
||||
function (Validator $validator): void {
|
||||
if ($validator->errors()->has('password')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$user = $this->user();
|
||||
$password = $this->input('password');
|
||||
|
||||
if (! is_string($password) || $user === null || ! Hash::check($password, (string) $user->password)) {
|
||||
$validator->errors()->add('password', __('The password is incorrect.'));
|
||||
}
|
||||
},
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -11,8 +11,6 @@ use App\Enums\NumberFormat;
|
||||
use App\Enums\TimeFormat;
|
||||
use App\Http\Requests\V1\BaseFormRequest;
|
||||
use App\Models\Organization;
|
||||
use App\Rules\CurrencyRule;
|
||||
use Illuminate\Contracts\Validation\ValidationRule;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
/**
|
||||
@@ -23,7 +21,7 @@ class OrganizationUpdateRequest extends BaseFormRequest
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array<string, array<string|\Illuminate\Contracts\Validation\Rule|ValidationRule>>
|
||||
* @return array<string, array<string|\Illuminate\Contracts\Validation\Rule>>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
@@ -32,10 +30,6 @@ class OrganizationUpdateRequest extends BaseFormRequest
|
||||
'string',
|
||||
'max:255',
|
||||
],
|
||||
'currency' => [
|
||||
'string',
|
||||
new CurrencyRule,
|
||||
],
|
||||
'billable_rate' => array_merge(
|
||||
[
|
||||
'nullable',
|
||||
@@ -74,11 +68,6 @@ class OrganizationUpdateRequest extends BaseFormRequest
|
||||
return $this->has('name') ? (string) $this->input('name') : null;
|
||||
}
|
||||
|
||||
public function getCurrency(): ?string
|
||||
{
|
||||
return $this->has('currency') ? (string) $this->input('currency') : null;
|
||||
}
|
||||
|
||||
public function getNumberFormat(): ?NumberFormat
|
||||
{
|
||||
return $this->has('number_format') ? NumberFormat::from($this->input('number_format')) : null;
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Http\Requests\V1\User;
|
||||
|
||||
use App\Http\Requests\V1\BaseFormRequest;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Validation\Validator;
|
||||
|
||||
class UserDestroyRequest extends BaseFormRequest
|
||||
{
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array<string, array<string>>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'password' => [
|
||||
'required',
|
||||
'string',
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<int, callable(Validator): void>
|
||||
*/
|
||||
public function after(): array
|
||||
{
|
||||
return [
|
||||
function (Validator $validator): void {
|
||||
if ($validator->errors()->has('password')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$user = $this->user();
|
||||
$password = $this->input('password');
|
||||
|
||||
if (! is_string($password) || $user === null || ! Hash::check($password, (string) $user->password)) {
|
||||
$validator->errors()->add('password', __('The password is incorrect.'));
|
||||
}
|
||||
},
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -62,7 +62,6 @@ class UserService
|
||||
$intervalFormat,
|
||||
$timeFormat,
|
||||
);
|
||||
$this->switchCurrentOrganization($user, $organization);
|
||||
}
|
||||
|
||||
return $user;
|
||||
|
||||
@@ -132,8 +132,7 @@
|
||||
"pestphp/pest-plugin": true,
|
||||
"php-http/discovery": true,
|
||||
"wikimedia/composer-merge-plugin": true
|
||||
},
|
||||
"process-timeout": 900
|
||||
}
|
||||
},
|
||||
"minimum-stability": "stable",
|
||||
"prefer-stable": true
|
||||
|
||||
328
composer.lock
generated
328
composer.lock
generated
@@ -3020,26 +3020,25 @@
|
||||
},
|
||||
{
|
||||
"name": "guzzlehttp/guzzle",
|
||||
"version": "7.12.1",
|
||||
"version": "7.10.3",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/guzzle/guzzle.git",
|
||||
"reference": "d34627490fbc03bf5c5d7cfed81f2faa19519425"
|
||||
"reference": "47ba23c7a55247e2e1b7407aca90e9bbed0d9d86"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/guzzle/guzzle/zipball/d34627490fbc03bf5c5d7cfed81f2faa19519425",
|
||||
"reference": "d34627490fbc03bf5c5d7cfed81f2faa19519425",
|
||||
"url": "https://api.github.com/repos/guzzle/guzzle/zipball/47ba23c7a55247e2e1b7407aca90e9bbed0d9d86",
|
||||
"reference": "47ba23c7a55247e2e1b7407aca90e9bbed0d9d86",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-json": "*",
|
||||
"guzzlehttp/promises": "^2.5",
|
||||
"guzzlehttp/psr7": "^2.12.1",
|
||||
"guzzlehttp/promises": "^2.3",
|
||||
"guzzlehttp/psr7": "^2.8",
|
||||
"php": "^7.2.5 || ^8.0",
|
||||
"psr/http-client": "^1.0",
|
||||
"symfony/deprecation-contracts": "^2.5 || ^3.0",
|
||||
"symfony/polyfill-php80": "^1.24"
|
||||
"symfony/deprecation-contracts": "^2.2 || ^3.0"
|
||||
},
|
||||
"provide": {
|
||||
"psr/http-client-implementation": "1.0"
|
||||
@@ -3048,7 +3047,7 @@
|
||||
"bamarni/composer-bin-plugin": "^1.8.2",
|
||||
"ext-curl": "*",
|
||||
"guzzle/client-integration-tests": "3.0.2",
|
||||
"guzzlehttp/test-server": "^0.5.1",
|
||||
"guzzlehttp/test-server": "^0.3.2",
|
||||
"php-http/message-factory": "^1.1",
|
||||
"phpunit/phpunit": "^8.5.52 || ^9.6.34",
|
||||
"psr/log": "^1.1 || ^2.0 || ^3.0"
|
||||
@@ -3128,7 +3127,7 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/guzzle/guzzle/issues",
|
||||
"source": "https://github.com/guzzle/guzzle/tree/7.12.1"
|
||||
"source": "https://github.com/guzzle/guzzle/tree/7.10.3"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -3144,25 +3143,24 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2026-06-18T14:12:49+00:00"
|
||||
"time": "2026-05-20T22:59:19+00:00"
|
||||
},
|
||||
{
|
||||
"name": "guzzlehttp/promises",
|
||||
"version": "2.5.0",
|
||||
"version": "2.4.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/guzzle/promises.git",
|
||||
"reference": "4360e982f87f5f258bf872d094647791db2f4c8e"
|
||||
"reference": "09e8a212562fb1fb6a512c4156ed71525969d6c2"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/guzzle/promises/zipball/4360e982f87f5f258bf872d094647791db2f4c8e",
|
||||
"reference": "4360e982f87f5f258bf872d094647791db2f4c8e",
|
||||
"url": "https://api.github.com/repos/guzzle/promises/zipball/09e8a212562fb1fb6a512c4156ed71525969d6c2",
|
||||
"reference": "09e8a212562fb1fb6a512c4156ed71525969d6c2",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^7.2.5 || ^8.0",
|
||||
"symfony/deprecation-contracts": "^2.5 || ^3.0"
|
||||
"php": "^7.2.5 || ^8.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"bamarni/composer-bin-plugin": "^1.8.2",
|
||||
@@ -3212,7 +3210,7 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/guzzle/promises/issues",
|
||||
"source": "https://github.com/guzzle/promises/tree/2.5.0"
|
||||
"source": "https://github.com/guzzle/promises/tree/2.4.1"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -3228,29 +3226,27 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2026-06-02T12:23:43+00:00"
|
||||
"time": "2026-05-20T22:57:30+00:00"
|
||||
},
|
||||
{
|
||||
"name": "guzzlehttp/psr7",
|
||||
"version": "2.12.1",
|
||||
"version": "2.10.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/guzzle/psr7.git",
|
||||
"reference": "172ef2f4e9824c1e058b7f30be8ae25a02c0f2b7"
|
||||
"reference": "73ab136360b5dfd858006eae9795e8fe43c80361"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/guzzle/psr7/zipball/172ef2f4e9824c1e058b7f30be8ae25a02c0f2b7",
|
||||
"reference": "172ef2f4e9824c1e058b7f30be8ae25a02c0f2b7",
|
||||
"url": "https://api.github.com/repos/guzzle/psr7/zipball/73ab136360b5dfd858006eae9795e8fe43c80361",
|
||||
"reference": "73ab136360b5dfd858006eae9795e8fe43c80361",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^7.2.5 || ^8.0",
|
||||
"psr/http-factory": "^1.0",
|
||||
"psr/http-message": "^1.1 || ^2.0",
|
||||
"ralouphie/getallheaders": "^3.0",
|
||||
"symfony/deprecation-contracts": "^2.5 || ^3.0",
|
||||
"symfony/polyfill-php80": "^1.24"
|
||||
"ralouphie/getallheaders": "^3.0"
|
||||
},
|
||||
"provide": {
|
||||
"psr/http-factory-implementation": "1.0",
|
||||
@@ -3331,7 +3327,7 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/guzzle/psr7/issues",
|
||||
"source": "https://github.com/guzzle/psr7/tree/2.12.1"
|
||||
"source": "https://github.com/guzzle/psr7/tree/2.10.1"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -3347,20 +3343,20 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2026-06-18T09:49:37+00:00"
|
||||
"time": "2026-05-20T09:27:36+00:00"
|
||||
},
|
||||
{
|
||||
"name": "guzzlehttp/uri-template",
|
||||
"version": "v1.0.7",
|
||||
"version": "v1.0.5",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/guzzle/uri-template.git",
|
||||
"reference": "7fe811c23a9e3cd712b4389eaeb50b5456d8c529"
|
||||
"reference": "4f4bbd4e7172148801e76e3decc1e559bdee34e1"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/guzzle/uri-template/zipball/7fe811c23a9e3cd712b4389eaeb50b5456d8c529",
|
||||
"reference": "7fe811c23a9e3cd712b4389eaeb50b5456d8c529",
|
||||
"url": "https://api.github.com/repos/guzzle/uri-template/zipball/4f4bbd4e7172148801e76e3decc1e559bdee34e1",
|
||||
"reference": "4f4bbd4e7172148801e76e3decc1e559bdee34e1",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -3369,7 +3365,7 @@
|
||||
},
|
||||
"require-dev": {
|
||||
"bamarni/composer-bin-plugin": "^1.8.2",
|
||||
"phpunit/phpunit": "^8.5.52 || ^9.6.34",
|
||||
"phpunit/phpunit": "^8.5.44 || ^9.6.25",
|
||||
"uri-template/tests": "1.0.0"
|
||||
},
|
||||
"type": "library",
|
||||
@@ -3417,7 +3413,7 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/guzzle/uri-template/issues",
|
||||
"source": "https://github.com/guzzle/uri-template/tree/v1.0.7"
|
||||
"source": "https://github.com/guzzle/uri-template/tree/v1.0.5"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -3433,7 +3429,7 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2026-06-12T21:33:43+00:00"
|
||||
"time": "2025-08-22T14:27:06+00:00"
|
||||
},
|
||||
{
|
||||
"name": "inertiajs/inertia-laravel",
|
||||
@@ -4197,16 +4193,16 @@
|
||||
},
|
||||
{
|
||||
"name": "laravel/framework",
|
||||
"version": "v12.61.1",
|
||||
"version": "v12.60.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/laravel/framework.git",
|
||||
"reference": "e8472ca9774452fe50841d9bdced060679f4d58d"
|
||||
"reference": "b8b55ce32175cc00f834a56eeb6316f18ed6ea39"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/laravel/framework/zipball/e8472ca9774452fe50841d9bdced060679f4d58d",
|
||||
"reference": "e8472ca9774452fe50841d9bdced060679f4d58d",
|
||||
"url": "https://api.github.com/repos/laravel/framework/zipball/b8b55ce32175cc00f834a56eeb6316f18ed6ea39",
|
||||
"reference": "b8b55ce32175cc00f834a56eeb6316f18ed6ea39",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -4415,7 +4411,7 @@
|
||||
"issues": "https://github.com/laravel/framework/issues",
|
||||
"source": "https://github.com/laravel/framework"
|
||||
},
|
||||
"time": "2026-06-04T14:22:52+00:00"
|
||||
"time": "2026-05-20T11:48:19+00:00"
|
||||
},
|
||||
{
|
||||
"name": "laravel/octane",
|
||||
@@ -6676,16 +6672,16 @@
|
||||
},
|
||||
{
|
||||
"name": "nesbot/carbon",
|
||||
"version": "3.13.0",
|
||||
"version": "3.11.4",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/CarbonPHP/carbon.git",
|
||||
"reference": "40f6618f052df16b545f626fbf9a878e6497d16a"
|
||||
"reference": "e890471a3494740f7d9326d72ce6a8c559ffee60"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/CarbonPHP/carbon/zipball/40f6618f052df16b545f626fbf9a878e6497d16a",
|
||||
"reference": "40f6618f052df16b545f626fbf9a878e6497d16a",
|
||||
"url": "https://api.github.com/repos/CarbonPHP/carbon/zipball/e890471a3494740f7d9326d72ce6a8c559ffee60",
|
||||
"reference": "e890471a3494740f7d9326d72ce6a8c559ffee60",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -6777,7 +6773,7 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2026-06-18T13:49:15+00:00"
|
||||
"time": "2026-04-07T09:57:54+00:00"
|
||||
},
|
||||
{
|
||||
"name": "nette/schema",
|
||||
@@ -7796,16 +7792,16 @@
|
||||
},
|
||||
{
|
||||
"name": "phpoffice/phpspreadsheet",
|
||||
"version": "1.30.5",
|
||||
"version": "1.30.4",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/PHPOffice/PhpSpreadsheet.git",
|
||||
"reference": "97bcabd32a64924688487dcd64aceaf158affb5c"
|
||||
"reference": "02970383cc12e7bf0bc0707ea6e2e8ed23a7aec9"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/PHPOffice/PhpSpreadsheet/zipball/97bcabd32a64924688487dcd64aceaf158affb5c",
|
||||
"reference": "97bcabd32a64924688487dcd64aceaf158affb5c",
|
||||
"url": "https://api.github.com/repos/PHPOffice/PhpSpreadsheet/zipball/02970383cc12e7bf0bc0707ea6e2e8ed23a7aec9",
|
||||
"reference": "02970383cc12e7bf0bc0707ea6e2e8ed23a7aec9",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -7898,9 +7894,9 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/PHPOffice/PhpSpreadsheet/issues",
|
||||
"source": "https://github.com/PHPOffice/PhpSpreadsheet/tree/1.30.5"
|
||||
"source": "https://github.com/PHPOffice/PhpSpreadsheet/tree/1.30.4"
|
||||
},
|
||||
"time": "2026-05-31T05:13:11+00:00"
|
||||
"time": "2026-04-19T06:00:39+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpoption/phpoption",
|
||||
@@ -7979,16 +7975,16 @@
|
||||
},
|
||||
{
|
||||
"name": "phpseclib/phpseclib",
|
||||
"version": "3.0.55",
|
||||
"version": "3.0.52",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/phpseclib/phpseclib.git",
|
||||
"reference": "db9744e6d47e742b1f974e965ad49bdd041105af"
|
||||
"reference": "2adaefc83df2ec548558307690f376dd7d4f4fce"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/db9744e6d47e742b1f974e965ad49bdd041105af",
|
||||
"reference": "db9744e6d47e742b1f974e965ad49bdd041105af",
|
||||
"url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/2adaefc83df2ec548558307690f376dd7d4f4fce",
|
||||
"reference": "2adaefc83df2ec548558307690f376dd7d4f4fce",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -8069,7 +8065,7 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/phpseclib/phpseclib/issues",
|
||||
"source": "https://github.com/phpseclib/phpseclib/tree/3.0.55"
|
||||
"source": "https://github.com/phpseclib/phpseclib/tree/3.0.52"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -8085,7 +8081,7 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2026-06-14T23:24:10+00:00"
|
||||
"time": "2026-04-27T07:02:15+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpstan/phpdoc-parser",
|
||||
@@ -9023,20 +9019,20 @@
|
||||
},
|
||||
{
|
||||
"name": "ramsey/uuid",
|
||||
"version": "4.9.3",
|
||||
"version": "4.9.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/ramsey/uuid.git",
|
||||
"reference": "1df15849d00943a67d677dc9cfd80795f038c9f8"
|
||||
"reference": "8429c78ca35a09f27565311b98101e2826affde0"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/ramsey/uuid/zipball/1df15849d00943a67d677dc9cfd80795f038c9f8",
|
||||
"reference": "1df15849d00943a67d677dc9cfd80795f038c9f8",
|
||||
"url": "https://api.github.com/repos/ramsey/uuid/zipball/8429c78ca35a09f27565311b98101e2826affde0",
|
||||
"reference": "8429c78ca35a09f27565311b98101e2826affde0",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"brick/math": ">=0.8.16 <=0.18",
|
||||
"brick/math": "^0.8.16 || ^0.9 || ^0.10 || ^0.11 || ^0.12 || ^0.13 || ^0.14",
|
||||
"php": "^8.0",
|
||||
"ramsey/collection": "^1.2 || ^2.0"
|
||||
},
|
||||
@@ -9095,9 +9091,9 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/ramsey/uuid/issues",
|
||||
"source": "https://github.com/ramsey/uuid/tree/4.9.3"
|
||||
"source": "https://github.com/ramsey/uuid/tree/4.9.2"
|
||||
},
|
||||
"time": "2026-06-18T03:57:49+00:00"
|
||||
"time": "2025-12-14T04:43:48+00:00"
|
||||
},
|
||||
{
|
||||
"name": "react/promise",
|
||||
@@ -10134,16 +10130,16 @@
|
||||
},
|
||||
{
|
||||
"name": "symfony/console",
|
||||
"version": "v7.4.13",
|
||||
"version": "v7.4.11",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/console.git",
|
||||
"reference": "85095d2573eaefaf35e40b9513a9bf09f72cd217"
|
||||
"reference": "ed0107e43ab452aa77ae99e005b95e56b556e075"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/console/zipball/85095d2573eaefaf35e40b9513a9bf09f72cd217",
|
||||
"reference": "85095d2573eaefaf35e40b9513a9bf09f72cd217",
|
||||
"url": "https://api.github.com/repos/symfony/console/zipball/ed0107e43ab452aa77ae99e005b95e56b556e075",
|
||||
"reference": "ed0107e43ab452aa77ae99e005b95e56b556e075",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -10208,7 +10204,7 @@
|
||||
"terminal"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/console/tree/v7.4.13"
|
||||
"source": "https://github.com/symfony/console/tree/v7.4.11"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -10228,7 +10224,7 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2026-05-24T08:56:14+00:00"
|
||||
"time": "2026-05-13T12:04:42+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/css-selector",
|
||||
@@ -10757,16 +10753,16 @@
|
||||
},
|
||||
{
|
||||
"name": "symfony/html-sanitizer",
|
||||
"version": "v7.4.13",
|
||||
"version": "v7.4.12",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/html-sanitizer.git",
|
||||
"reference": "761f6c49dfd103ee08b3cd09ece588b069e18ec9"
|
||||
"reference": "51cb4f68195883f7ac403abb58ecf7adc74e0f9e"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/html-sanitizer/zipball/761f6c49dfd103ee08b3cd09ece588b069e18ec9",
|
||||
"reference": "761f6c49dfd103ee08b3cd09ece588b069e18ec9",
|
||||
"url": "https://api.github.com/repos/symfony/html-sanitizer/zipball/51cb4f68195883f7ac403abb58ecf7adc74e0f9e",
|
||||
"reference": "51cb4f68195883f7ac403abb58ecf7adc74e0f9e",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -10807,7 +10803,7 @@
|
||||
"sanitizer"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/html-sanitizer/tree/v7.4.13"
|
||||
"source": "https://github.com/symfony/html-sanitizer/tree/v7.4.12"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -10827,20 +10823,20 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2026-05-24T11:20:33+00:00"
|
||||
"time": "2026-05-20T07:20:23+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/http-foundation",
|
||||
"version": "v7.4.13",
|
||||
"version": "v7.4.8",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/http-foundation.git",
|
||||
"reference": "bc354f47c62301e990b7874fa662326368508e2c"
|
||||
"reference": "9381209597ec66c25be154cbf2289076e64d1eab"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/http-foundation/zipball/bc354f47c62301e990b7874fa662326368508e2c",
|
||||
"reference": "bc354f47c62301e990b7874fa662326368508e2c",
|
||||
"url": "https://api.github.com/repos/symfony/http-foundation/zipball/9381209597ec66c25be154cbf2289076e64d1eab",
|
||||
"reference": "9381209597ec66c25be154cbf2289076e64d1eab",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -10889,7 +10885,7 @@
|
||||
"description": "Defines an object-oriented layer for the HTTP specification",
|
||||
"homepage": "https://symfony.com",
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/http-foundation/tree/v7.4.13"
|
||||
"source": "https://github.com/symfony/http-foundation/tree/v7.4.8"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -10909,20 +10905,20 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2026-05-24T11:20:33+00:00"
|
||||
"time": "2026-03-24T13:12:05+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/http-kernel",
|
||||
"version": "v7.4.13",
|
||||
"version": "v7.4.12",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/http-kernel.git",
|
||||
"reference": "9df847980c436451f4f51d1284491bb4356dd989"
|
||||
"reference": "7922b53e70d2ba2027af8bb6a59d91eb3541ea4d"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/http-kernel/zipball/9df847980c436451f4f51d1284491bb4356dd989",
|
||||
"reference": "9df847980c436451f4f51d1284491bb4356dd989",
|
||||
"url": "https://api.github.com/repos/symfony/http-kernel/zipball/7922b53e70d2ba2027af8bb6a59d91eb3541ea4d",
|
||||
"reference": "7922b53e70d2ba2027af8bb6a59d91eb3541ea4d",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -11008,7 +11004,7 @@
|
||||
"description": "Provides a structured process for converting a Request into a Response",
|
||||
"homepage": "https://symfony.com",
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/http-kernel/tree/v7.4.13"
|
||||
"source": "https://github.com/symfony/http-kernel/tree/v7.4.12"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -11028,7 +11024,7 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2026-05-27T08:31:43+00:00"
|
||||
"time": "2026-05-20T09:27:11+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/mailer",
|
||||
@@ -11116,16 +11112,16 @@
|
||||
},
|
||||
{
|
||||
"name": "symfony/mime",
|
||||
"version": "v7.4.13",
|
||||
"version": "v7.4.12",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/mime.git",
|
||||
"reference": "a845722765c4f6b2ce88beaf4f4479975b186770"
|
||||
"reference": "b198dd66c211c97119bcaaff7c13431dbbb5e470"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/mime/zipball/a845722765c4f6b2ce88beaf4f4479975b186770",
|
||||
"reference": "a845722765c4f6b2ce88beaf4f4479975b186770",
|
||||
"url": "https://api.github.com/repos/symfony/mime/zipball/b198dd66c211c97119bcaaff7c13431dbbb5e470",
|
||||
"reference": "b198dd66c211c97119bcaaff7c13431dbbb5e470",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -11181,7 +11177,7 @@
|
||||
"mime-type"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/mime/tree/v7.4.13"
|
||||
"source": "https://github.com/symfony/mime/tree/v7.4.12"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -11201,7 +11197,7 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2026-05-23T16:22:37+00:00"
|
||||
"time": "2026-05-20T07:20:23+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-ctype",
|
||||
@@ -11288,16 +11284,16 @@
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-intl-grapheme",
|
||||
"version": "v1.38.1",
|
||||
"version": "v1.37.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/polyfill-intl-grapheme.git",
|
||||
"reference": "e9247d281d694a5120554d9afaf54e070e88a603"
|
||||
"reference": "4864388bfbd3001ce88e234fab652acd91fdc57e"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/e9247d281d694a5120554d9afaf54e070e88a603",
|
||||
"reference": "e9247d281d694a5120554d9afaf54e070e88a603",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/4864388bfbd3001ce88e234fab652acd91fdc57e",
|
||||
"reference": "4864388bfbd3001ce88e234fab652acd91fdc57e",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -11346,7 +11342,7 @@
|
||||
"shim"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.38.1"
|
||||
"source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.37.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -11366,20 +11362,20 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2026-05-26T05:58:03+00:00"
|
||||
"time": "2026-04-26T13:13:48+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-intl-idn",
|
||||
"version": "v1.38.1",
|
||||
"version": "v1.37.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/polyfill-intl-idn.git",
|
||||
"reference": "dc21118016c039a66235cf93d96b435ffb282412"
|
||||
"reference": "9614ac4d8061dc257ecc64cba1b140873dce8ad3"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/dc21118016c039a66235cf93d96b435ffb282412",
|
||||
"reference": "dc21118016c039a66235cf93d96b435ffb282412",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/9614ac4d8061dc257ecc64cba1b140873dce8ad3",
|
||||
"reference": "9614ac4d8061dc257ecc64cba1b140873dce8ad3",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -11433,7 +11429,7 @@
|
||||
"shim"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/polyfill-intl-idn/tree/v1.38.1"
|
||||
"source": "https://github.com/symfony/polyfill-intl-idn/tree/v1.37.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -11453,20 +11449,20 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2026-05-25T15:22:23+00:00"
|
||||
"time": "2024-09-10T14:38:51+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-intl-normalizer",
|
||||
"version": "v1.38.0",
|
||||
"version": "v1.37.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/polyfill-intl-normalizer.git",
|
||||
"reference": "2d446c214bdbe5b71bde5011b060a05fece3ae6b"
|
||||
"reference": "3833d7255cc303546435cb650316bff708a1c75c"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/2d446c214bdbe5b71bde5011b060a05fece3ae6b",
|
||||
"reference": "2d446c214bdbe5b71bde5011b060a05fece3ae6b",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/3833d7255cc303546435cb650316bff708a1c75c",
|
||||
"reference": "3833d7255cc303546435cb650316bff708a1c75c",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -11518,7 +11514,7 @@
|
||||
"shim"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.38.0"
|
||||
"source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.37.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -11538,20 +11534,20 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2026-05-25T13:48:31+00:00"
|
||||
"time": "2024-09-09T11:45:10+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-mbstring",
|
||||
"version": "v1.38.2",
|
||||
"version": "v1.37.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/polyfill-mbstring.git",
|
||||
"reference": "d3d318bad5e7a1bfbd026009c8bfb8d8f99ae6b6"
|
||||
"reference": "6a21eb99c6973357967f6ce3708cd55a6bec6315"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/d3d318bad5e7a1bfbd026009c8bfb8d8f99ae6b6",
|
||||
"reference": "d3d318bad5e7a1bfbd026009c8bfb8d8f99ae6b6",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/6a21eb99c6973357967f6ce3708cd55a6bec6315",
|
||||
"reference": "6a21eb99c6973357967f6ce3708cd55a6bec6315",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -11603,7 +11599,7 @@
|
||||
"shim"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/polyfill-mbstring/tree/v1.38.2"
|
||||
"source": "https://github.com/symfony/polyfill-mbstring/tree/v1.37.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -11623,7 +11619,7 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2026-05-27T06:59:30+00:00"
|
||||
"time": "2026-04-10T17:25:58+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-php73",
|
||||
@@ -11791,16 +11787,16 @@
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-php81",
|
||||
"version": "v1.38.1",
|
||||
"version": "v1.37.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/polyfill-php81.git",
|
||||
"reference": "6bfb9c766cacffbc8e118cb87217d08ed84e5cd7"
|
||||
"reference": "4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/6bfb9c766cacffbc8e118cb87217d08ed84e5cd7",
|
||||
"reference": "6bfb9c766cacffbc8e118cb87217d08ed84e5cd7",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c",
|
||||
"reference": "4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -11847,7 +11843,7 @@
|
||||
"shim"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/polyfill-php81/tree/v1.38.1"
|
||||
"source": "https://github.com/symfony/polyfill-php81/tree/v1.37.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -11867,20 +11863,20 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2026-05-26T12:45:58+00:00"
|
||||
"time": "2024-09-09T11:45:10+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-php83",
|
||||
"version": "v1.38.2",
|
||||
"version": "v1.37.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/polyfill-php83.git",
|
||||
"reference": "796a26abb75ce49f3a84433cd81bf1009d73d5f8"
|
||||
"reference": "3600c2cb22399e25bb226e4a135ce91eeb2a6149"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-php83/zipball/796a26abb75ce49f3a84433cd81bf1009d73d5f8",
|
||||
"reference": "796a26abb75ce49f3a84433cd81bf1009d73d5f8",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-php83/zipball/3600c2cb22399e25bb226e4a135ce91eeb2a6149",
|
||||
"reference": "3600c2cb22399e25bb226e4a135ce91eeb2a6149",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -11927,7 +11923,7 @@
|
||||
"shim"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/polyfill-php83/tree/v1.38.2"
|
||||
"source": "https://github.com/symfony/polyfill-php83/tree/v1.37.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -11947,20 +11943,20 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2026-05-27T06:51:48+00:00"
|
||||
"time": "2026-04-10T17:25:58+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-php84",
|
||||
"version": "v1.38.1",
|
||||
"version": "v1.37.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/polyfill-php84.git",
|
||||
"reference": "f4e1dfaee5b74aba5964fe1fd4dfc7ba5e3085fa"
|
||||
"reference": "88486db2c389b290bf87ff1de7ebc1e13e42bb06"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-php84/zipball/f4e1dfaee5b74aba5964fe1fd4dfc7ba5e3085fa",
|
||||
"reference": "f4e1dfaee5b74aba5964fe1fd4dfc7ba5e3085fa",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-php84/zipball/88486db2c389b290bf87ff1de7ebc1e13e42bb06",
|
||||
"reference": "88486db2c389b290bf87ff1de7ebc1e13e42bb06",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -12007,7 +12003,7 @@
|
||||
"shim"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/polyfill-php84/tree/v1.38.1"
|
||||
"source": "https://github.com/symfony/polyfill-php84/tree/v1.37.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -12027,20 +12023,20 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2026-05-26T12:51:13+00:00"
|
||||
"time": "2026-04-10T18:47:49+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-php85",
|
||||
"version": "v1.38.1",
|
||||
"version": "v1.37.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/polyfill-php85.git",
|
||||
"reference": "ba2ba04f3352cfa2dcbbcb90aee13ed967f505b1"
|
||||
"reference": "fcfa4973a9917cef23f2e38774da74a2b7d115ee"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-php85/zipball/ba2ba04f3352cfa2dcbbcb90aee13ed967f505b1",
|
||||
"reference": "ba2ba04f3352cfa2dcbbcb90aee13ed967f505b1",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-php85/zipball/fcfa4973a9917cef23f2e38774da74a2b7d115ee",
|
||||
"reference": "fcfa4973a9917cef23f2e38774da74a2b7d115ee",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -12087,7 +12083,7 @@
|
||||
"shim"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/polyfill-php85/tree/v1.38.1"
|
||||
"source": "https://github.com/symfony/polyfill-php85/tree/v1.37.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -12107,7 +12103,7 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2026-05-26T02:25:22+00:00"
|
||||
"time": "2026-04-26T13:10:57+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-uuid",
|
||||
@@ -12194,16 +12190,16 @@
|
||||
},
|
||||
{
|
||||
"name": "symfony/process",
|
||||
"version": "v7.4.13",
|
||||
"version": "v7.4.11",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/process.git",
|
||||
"reference": "f5804be144caceb570f6747519999636b664f24c"
|
||||
"reference": "d9593c9efa40499eb078b81144de42cbc28a31f0"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/process/zipball/f5804be144caceb570f6747519999636b664f24c",
|
||||
"reference": "f5804be144caceb570f6747519999636b664f24c",
|
||||
"url": "https://api.github.com/repos/symfony/process/zipball/d9593c9efa40499eb078b81144de42cbc28a31f0",
|
||||
"reference": "d9593c9efa40499eb078b81144de42cbc28a31f0",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -12235,7 +12231,7 @@
|
||||
"description": "Executes commands in sub-processes",
|
||||
"homepage": "https://symfony.com",
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/process/tree/v7.4.13"
|
||||
"source": "https://github.com/symfony/process/tree/v7.4.11"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -12255,7 +12251,7 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2026-05-23T16:05:06+00:00"
|
||||
"time": "2026-05-11T16:55:21+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/property-access",
|
||||
@@ -12518,16 +12514,16 @@
|
||||
},
|
||||
{
|
||||
"name": "symfony/routing",
|
||||
"version": "v7.4.13",
|
||||
"version": "v7.4.12",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/routing.git",
|
||||
"reference": "3a162171bb008e5e0f15dce6581373a4c0e8390d"
|
||||
"reference": "3b04a5ec4887a8135a12ebf0f4cbc5b8fc8ee204"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/routing/zipball/3a162171bb008e5e0f15dce6581373a4c0e8390d",
|
||||
"reference": "3a162171bb008e5e0f15dce6581373a4c0e8390d",
|
||||
"url": "https://api.github.com/repos/symfony/routing/zipball/3b04a5ec4887a8135a12ebf0f4cbc5b8fc8ee204",
|
||||
"reference": "3b04a5ec4887a8135a12ebf0f4cbc5b8fc8ee204",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -12579,7 +12575,7 @@
|
||||
"url"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/routing/tree/v7.4.13"
|
||||
"source": "https://github.com/symfony/routing/tree/v7.4.12"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -12599,7 +12595,7 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2026-05-24T11:20:33+00:00"
|
||||
"time": "2026-05-20T07:20:23+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/serializer",
|
||||
@@ -12794,16 +12790,16 @@
|
||||
},
|
||||
{
|
||||
"name": "symfony/string",
|
||||
"version": "v7.4.13",
|
||||
"version": "v7.4.11",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/string.git",
|
||||
"reference": "961683010db3b27ec6ebcd7308e6e1ee8fa7ffde"
|
||||
"reference": "965f7306a43383d02c6aca1e3f3bd2f0ea5dee15"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/string/zipball/961683010db3b27ec6ebcd7308e6e1ee8fa7ffde",
|
||||
"reference": "961683010db3b27ec6ebcd7308e6e1ee8fa7ffde",
|
||||
"url": "https://api.github.com/repos/symfony/string/zipball/965f7306a43383d02c6aca1e3f3bd2f0ea5dee15",
|
||||
"reference": "965f7306a43383d02c6aca1e3f3bd2f0ea5dee15",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -12861,7 +12857,7 @@
|
||||
"utf8"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/string/tree/v7.4.13"
|
||||
"source": "https://github.com/symfony/string/tree/v7.4.11"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -12881,7 +12877,7 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2026-05-23T15:23:29+00:00"
|
||||
"time": "2026-05-13T12:04:42+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/translation",
|
||||
@@ -13827,16 +13823,16 @@
|
||||
},
|
||||
{
|
||||
"name": "webmozart/assert",
|
||||
"version": "2.4.1",
|
||||
"version": "2.4.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/webmozarts/assert.git",
|
||||
"reference": "2ccb7c2e821038c03a3e6e1700c570c158c55f70"
|
||||
"reference": "9007ea6f45ecf352a9422b36644e4bfc039b9155"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/webmozarts/assert/zipball/2ccb7c2e821038c03a3e6e1700c570c158c55f70",
|
||||
"reference": "2ccb7c2e821038c03a3e6e1700c570c158c55f70",
|
||||
"url": "https://api.github.com/repos/webmozarts/assert/zipball/9007ea6f45ecf352a9422b36644e4bfc039b9155",
|
||||
"reference": "9007ea6f45ecf352a9422b36644e4bfc039b9155",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -13887,9 +13883,9 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/webmozarts/assert/issues",
|
||||
"source": "https://github.com/webmozarts/assert/tree/2.4.1"
|
||||
"source": "https://github.com/webmozarts/assert/tree/2.4.0"
|
||||
},
|
||||
"time": "2026-06-15T15:31:57+00:00"
|
||||
"time": "2026-05-20T13:07:01+00:00"
|
||||
},
|
||||
{
|
||||
"name": "wikimedia/composer-merge-plugin",
|
||||
|
||||
@@ -81,8 +81,6 @@ return [
|
||||
|
||||
'enable_registration' => (bool) env('APP_ENABLE_REGISTRATION', false),
|
||||
|
||||
'local_email_verification' => (bool) env('APP_LOCAL_EMAIL_VERIFICATION', false),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Timezone
|
||||
|
||||
@@ -107,7 +107,7 @@ services:
|
||||
- sail
|
||||
- reverse-proxy
|
||||
playwright:
|
||||
image: mcr.microsoft.com/playwright:v1.60.0-jammy
|
||||
image: mcr.microsoft.com/playwright:v1.59.1-jammy
|
||||
command: ['npx', 'playwright', 'test', '--ui-port=8080', '--ui-host=0.0.0.0']
|
||||
working_dir: /src
|
||||
extra_hosts:
|
||||
|
||||
@@ -12,7 +12,7 @@ import {
|
||||
createRunningTimeEntryWithStartViaApi,
|
||||
createTaskViaApi,
|
||||
createProjectWithClientViaApi,
|
||||
updateUserProfileViaApi,
|
||||
updateUserProfileViaWeb,
|
||||
updateOrganizationSettingViaApi,
|
||||
} from './utils/api';
|
||||
|
||||
@@ -1803,22 +1803,28 @@ test.describe('Click-Drag Selection to Create', () => {
|
||||
// =============================================
|
||||
|
||||
test.describe('Timezone & Localization', () => {
|
||||
test('week start day: monday shows Mon as first column', async ({ page, ctx }) => {
|
||||
await updateUserProfileViaApi(ctx, { week_start: 'monday' });
|
||||
test('week start day: monday shows Mon as first column', async ({ page }) => {
|
||||
// Navigate to calendar first to load Inertia page props
|
||||
await goToCalendar(page);
|
||||
await updateUserProfileViaWeb(page, { week_start: 'monday' });
|
||||
await page.reload();
|
||||
await expect(page.locator('.fc')).toBeVisible();
|
||||
|
||||
const firstHeader = page.locator('.fc-col-header-cell').first();
|
||||
await expect(firstHeader).toContainText('Mon');
|
||||
});
|
||||
|
||||
test('week start day: sunday shows Sun as first column', async ({ page, ctx }) => {
|
||||
await updateUserProfileViaApi(ctx, { week_start: 'sunday' });
|
||||
test('week start day: sunday shows Sun as first column', async ({ page }) => {
|
||||
await goToCalendar(page);
|
||||
await updateUserProfileViaWeb(page, { week_start: 'sunday' });
|
||||
await page.reload();
|
||||
await expect(page.locator('.fc')).toBeVisible();
|
||||
|
||||
const firstHeader = page.locator('.fc-col-header-cell').first();
|
||||
await expect(firstHeader).toContainText('Sun');
|
||||
|
||||
// Reset to monday for other tests
|
||||
await updateUserProfileViaWeb(page, { week_start: 'monday' });
|
||||
});
|
||||
|
||||
test('12-hour time format shows AM/PM on slot labels', async ({ page, ctx }) => {
|
||||
|
||||
@@ -348,7 +348,7 @@ test.describe('Command Palette', () => {
|
||||
const newOrgName = 'TestOrg' + Math.floor(Math.random() * 10000);
|
||||
|
||||
// Create a new organization
|
||||
await page.goto(PLAYWRIGHT_BASE_URL + '/organizations/create');
|
||||
await page.goto(PLAYWRIGHT_BASE_URL + '/teams/create');
|
||||
await page.getByLabel('Organization Name').fill(newOrgName);
|
||||
await page.getByRole('button', { name: 'Create' }).click();
|
||||
|
||||
@@ -393,7 +393,7 @@ test.describe('Command Palette', () => {
|
||||
const newOrgName = 'GroupTestOrg' + Math.floor(Math.random() * 10000);
|
||||
|
||||
// Create a new organization to ensure we have multiple
|
||||
await page.goto(PLAYWRIGHT_BASE_URL + '/organizations/create');
|
||||
await page.goto(PLAYWRIGHT_BASE_URL + '/teams/create');
|
||||
await page.getByLabel('Organization Name').fill(newOrgName);
|
||||
await page.getByRole('button', { name: 'Create' }).click();
|
||||
await expect(page.getByTestId('dashboard_view')).toBeVisible({ timeout: 10000 });
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { expect, test } from '../playwright/fixtures';
|
||||
import { PLAYWRIGHT_BASE_URL, TEST_USER_PASSWORD } from '../playwright/config';
|
||||
import { PLAYWRIGHT_BASE_URL } from '../playwright/config';
|
||||
|
||||
async function goToOrganizationSettings(page) {
|
||||
await page.goto(PLAYWRIGHT_BASE_URL + '/dashboard');
|
||||
@@ -36,52 +36,13 @@ async function createTimeEntry(page, duration: string) {
|
||||
test('test that organization name can be updated', async ({ page }) => {
|
||||
await goToOrganizationSettings(page);
|
||||
await page.getByLabel('Organization Name').fill('NEW ORG NAME');
|
||||
await Promise.all([
|
||||
page.waitForResponse(
|
||||
(response) =>
|
||||
response.url().includes('/api/v1/organizations/') &&
|
||||
response.request().method() === 'PUT' &&
|
||||
response.status() === 200
|
||||
),
|
||||
page
|
||||
.locator('form')
|
||||
.filter({ hasText: 'Organization Name' })
|
||||
.getByRole('button', { name: 'Save' })
|
||||
.click(),
|
||||
]);
|
||||
await page.reload();
|
||||
await page.getByLabel('Organization Name').press('Enter');
|
||||
await page.getByLabel('Organization Name').press('Meta+r');
|
||||
await expect(page.locator('[data-testid="organization_switcher"]:visible')).toContainText(
|
||||
'NEW ORG NAME'
|
||||
);
|
||||
});
|
||||
|
||||
test('test that organization currency can be updated', async ({ page }) => {
|
||||
await goToOrganizationSettings(page);
|
||||
await page.getByLabel('Currency', { exact: true }).selectOption('USD');
|
||||
await Promise.all([
|
||||
page.waitForRequest(
|
||||
(request) =>
|
||||
request.url().includes('/api/v1/organizations/') &&
|
||||
request.method() === 'PUT' &&
|
||||
request.postDataJSON().currency === 'USD'
|
||||
),
|
||||
page.waitForResponse(
|
||||
async (response) =>
|
||||
response.url().includes('/api/v1/organizations/') &&
|
||||
response.request().method() === 'PUT' &&
|
||||
response.status() === 200 &&
|
||||
(await response.json()).data.currency === 'USD'
|
||||
),
|
||||
page
|
||||
.locator('form')
|
||||
.filter({ hasText: 'Organization Name' })
|
||||
.getByRole('button', { name: 'Save' })
|
||||
.click(),
|
||||
]);
|
||||
await page.reload();
|
||||
await expect(page.getByLabel('Currency', { exact: true })).toHaveValue('USD');
|
||||
});
|
||||
|
||||
test('test that organization billable rate can be updated with all existing time entries', async ({
|
||||
page,
|
||||
}) => {
|
||||
@@ -408,153 +369,13 @@ test('test that format settings persist after page reload', async ({ page }) =>
|
||||
await expect(page.getByLabel('Date Format')).toContainText('DD/MM/YYYY');
|
||||
});
|
||||
|
||||
// =============================================
|
||||
// Create, Delete & Switch
|
||||
// =============================================
|
||||
|
||||
test.describe('Organization Create, Delete & Switch', () => {
|
||||
async function createOrganization(page, name: string) {
|
||||
await page.goto(PLAYWRIGHT_BASE_URL + '/organizations/create');
|
||||
await page.getByLabel('Organization Name').fill(name);
|
||||
await Promise.all([
|
||||
page.waitForResponse(
|
||||
(response) =>
|
||||
response.url().includes('/api/v1/organizations') &&
|
||||
response.request().method() === 'POST' &&
|
||||
response.status() === 201
|
||||
),
|
||||
page.getByRole('button', { name: 'Create' }).click(),
|
||||
]);
|
||||
// The backend switches the current organization to the new one and the
|
||||
// frontend reloads into its dashboard.
|
||||
await expect(page.getByTestId('dashboard_view')).toBeVisible({ timeout: 10000 });
|
||||
}
|
||||
|
||||
test('can create a new organization and switches to it automatically', async ({ page }) => {
|
||||
const newOrgName = 'CreateOrg' + Math.floor(Math.random() * 100000);
|
||||
await createOrganization(page, newOrgName);
|
||||
|
||||
await expect(page.locator('[data-testid="organization_switcher"]:visible')).toContainText(
|
||||
newOrgName
|
||||
);
|
||||
});
|
||||
|
||||
test('does not create an organization when the name is empty', async ({ page }) => {
|
||||
await page.goto(PLAYWRIGHT_BASE_URL + '/organizations/create');
|
||||
|
||||
// The form posts to the API, which rejects the empty name with a 422.
|
||||
await Promise.all([
|
||||
page.waitForResponse(
|
||||
(response) =>
|
||||
response.url().includes('/api/v1/organizations') &&
|
||||
response.request().method() === 'POST' &&
|
||||
response.status() === 422
|
||||
),
|
||||
page.getByRole('button', { name: 'Create' }).click(),
|
||||
]);
|
||||
|
||||
// Validation failed, so we stay on the create form and never reach a
|
||||
// dashboard. Assert on the form rather than the URL.
|
||||
await expect(page.getByText('Organization Details')).toBeVisible();
|
||||
await expect(page.getByRole('alert')).toContainText('The name field is required.');
|
||||
await expect(page.getByLabel('Organization Name')).toHaveAttribute('aria-invalid', 'true');
|
||||
await expect(page.getByTestId('dashboard_view')).toHaveCount(0);
|
||||
});
|
||||
|
||||
test('can delete an organization', async ({ page }) => {
|
||||
// Create a throwaway organization so the primary one is never deleted.
|
||||
const orgName = 'DeleteOrg' + Math.floor(Math.random() * 100000);
|
||||
await createOrganization(page, orgName);
|
||||
|
||||
// Open the (now current) throwaway organization's settings.
|
||||
await goToOrganizationSettings(page);
|
||||
|
||||
// Open the confirmation modal, then confirm inside the dialog.
|
||||
await page.getByRole('button', { name: 'Delete Organization' }).click();
|
||||
await page.getByRole('dialog').getByPlaceholder('Password').fill(TEST_USER_PASSWORD);
|
||||
await Promise.all([
|
||||
page.waitForResponse(
|
||||
(response) =>
|
||||
response.url().includes('/api/v1/organizations') &&
|
||||
response.request().method() === 'DELETE' &&
|
||||
response.status() === 204
|
||||
),
|
||||
page.getByRole('dialog').getByRole('button', { name: 'Delete Organization' }).click(),
|
||||
]);
|
||||
|
||||
// We are redirected to the dashboard of a different organization.
|
||||
await expect(page.getByTestId('dashboard_view')).toBeVisible({ timeout: 10000 });
|
||||
await expect(
|
||||
page.locator('[data-testid="organization_switcher"]:visible')
|
||||
).not.toContainText(orgName);
|
||||
});
|
||||
|
||||
test('delete organization shows an error when the password is wrong', async ({ page }) => {
|
||||
const orgName = 'DeleteOrgWrongPassword' + Math.floor(Math.random() * 100000);
|
||||
await createOrganization(page, orgName);
|
||||
await goToOrganizationSettings(page);
|
||||
|
||||
await page.getByRole('button', { name: 'Delete Organization' }).click();
|
||||
const dialog = page.getByRole('dialog');
|
||||
await dialog.getByPlaceholder('Password').fill('not-the-real-password');
|
||||
await Promise.all([
|
||||
page.waitForResponse(
|
||||
(response) =>
|
||||
response.url().includes('/api/v1/organizations') &&
|
||||
response.request().method() === 'DELETE' &&
|
||||
response.status() === 422
|
||||
),
|
||||
dialog.getByRole('button', { name: 'Delete Organization' }).click(),
|
||||
]);
|
||||
|
||||
await expect(dialog.getByRole('alert')).toBeVisible();
|
||||
await expect(dialog).toBeVisible();
|
||||
});
|
||||
|
||||
test('can switch the current organization via the organization switcher', async ({ page }) => {
|
||||
await page.goto(PLAYWRIGHT_BASE_URL + '/dashboard');
|
||||
const orgSwitcher = page.locator('[data-testid="organization_switcher"]:visible');
|
||||
await expect(orgSwitcher).toBeVisible();
|
||||
const previousOrgNameLines = (await orgSwitcher.innerText())
|
||||
.split('\n')
|
||||
.map((line) => line.trim())
|
||||
.filter(Boolean);
|
||||
const previousOrgName = previousOrgNameLines[previousOrgNameLines.length - 1];
|
||||
|
||||
// Ensure there are at least two organizations to switch between.
|
||||
const orgName = 'SwitchOrg' + Math.floor(Math.random() * 100000);
|
||||
await createOrganization(page, orgName);
|
||||
|
||||
await expect(orgSwitcher).toContainText(orgName);
|
||||
|
||||
// Open the switcher and pick a different organization.
|
||||
await orgSwitcher.click();
|
||||
await expect(page.getByText('Switch Organizations')).toBeVisible();
|
||||
const otherOrgButton = page.getByRole('menuitem', { name: previousOrgName });
|
||||
await expect(otherOrgButton).toBeVisible();
|
||||
|
||||
await Promise.all([
|
||||
page.waitForResponse(
|
||||
(response) =>
|
||||
response.url().includes('/users/me/current-organization') &&
|
||||
response.request().method() === 'PUT' &&
|
||||
response.status() === 200
|
||||
),
|
||||
otherOrgButton.click(),
|
||||
]);
|
||||
|
||||
await expect(orgSwitcher).not.toContainText(orgName, { timeout: 10000 });
|
||||
await expect(orgSwitcher).toContainText(previousOrgName, { timeout: 10000 });
|
||||
});
|
||||
});
|
||||
|
||||
// =============================================
|
||||
// Admin Permission Tests
|
||||
// =============================================
|
||||
|
||||
test.describe('Admin Organization Settings Access', () => {
|
||||
test('admin can see and edit organization settings', async ({ ctx, admin }) => {
|
||||
await admin.page.goto(PLAYWRIGHT_BASE_URL + '/organizations/' + ctx.orgId);
|
||||
await admin.page.goto(PLAYWRIGHT_BASE_URL + '/teams/' + ctx.orgId);
|
||||
|
||||
// Organization Name section is visible
|
||||
await expect(
|
||||
@@ -575,9 +396,6 @@ test.describe('Admin Organization Settings Access', () => {
|
||||
// Save buttons should be visible (admin can update)
|
||||
await expect(admin.page.getByRole('button', { name: 'Save' }).first()).toBeVisible();
|
||||
|
||||
// The Organization Name input is editable (admin can update)
|
||||
await expect(admin.page.getByLabel('Organization Name')).toBeEnabled();
|
||||
|
||||
// Delete organization should NOT be visible (owner only)
|
||||
await expect(
|
||||
admin.page.getByRole('heading', { name: 'Delete Organization' })
|
||||
@@ -591,17 +409,13 @@ test.describe('Admin Organization Settings Access', () => {
|
||||
|
||||
test.describe('Employee Organization Settings Restrictions', () => {
|
||||
test('employee can see org name but not editable settings', async ({ ctx, employee }) => {
|
||||
await employee.page.goto(PLAYWRIGHT_BASE_URL + '/organizations/' + ctx.orgId);
|
||||
await employee.page.goto(PLAYWRIGHT_BASE_URL + '/teams/' + ctx.orgId);
|
||||
|
||||
// Organization Name section is visible (but inputs are disabled)
|
||||
await expect(
|
||||
employee.page.getByRole('heading', { name: 'Organization Name', level: 3 })
|
||||
).toBeVisible({ timeout: 10000 });
|
||||
|
||||
// The name and currency inputs are rendered but disabled (employee cannot update)
|
||||
await expect(employee.page.getByLabel('Organization Name')).toBeDisabled();
|
||||
await expect(employee.page.getByLabel('Currency')).toBeDisabled();
|
||||
|
||||
// Editable settings sections should NOT be visible
|
||||
await expect(
|
||||
employee.page.getByRole('heading', { name: 'Billable Rate', level: 3 })
|
||||
@@ -615,10 +429,5 @@ test.describe('Employee Organization Settings Restrictions', () => {
|
||||
|
||||
// Save button should not be visible (employee cannot update)
|
||||
await expect(employee.page.getByRole('button', { name: 'Save' })).not.toBeVisible();
|
||||
|
||||
// Delete organization should NOT be visible (owner only)
|
||||
await expect(
|
||||
employee.page.getByRole('heading', { name: 'Delete Organization' })
|
||||
).not.toBeVisible();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -342,8 +342,8 @@ test('delete account shows an error when the password is wrong', async ({ page }
|
||||
await Promise.all([
|
||||
page.waitForResponse(
|
||||
(response) =>
|
||||
response.url().includes('/api/v1/users/') &&
|
||||
response.request().method() === 'DELETE' &&
|
||||
response.url().includes('/user/confirm-password') &&
|
||||
response.request().method() === 'POST' &&
|
||||
response.status() === 422
|
||||
),
|
||||
dialog.getByRole('button', { name: 'Delete Account' }).click(),
|
||||
|
||||
@@ -1,192 +0,0 @@
|
||||
import { test, expect } from '../playwright/fixtures';
|
||||
import { PLAYWRIGHT_BASE_URL, TEST_USER_PASSWORD } from '../playwright/config';
|
||||
import { generateTotpCode, generateInvalidTotpCode } from './utils/totp';
|
||||
import type { Page } from '@playwright/test';
|
||||
|
||||
async function goToProfilePage(page: Page) {
|
||||
await page.goto(PLAYWRIGHT_BASE_URL + '/user/profile');
|
||||
}
|
||||
|
||||
/**
|
||||
* ConfirmsPassword only opens the dialog when the password has not been
|
||||
* confirmed recently, so fill it only when it actually shows up.
|
||||
*/
|
||||
async function confirmPasswordIfPrompted(page: Page) {
|
||||
const dialog = page.getByRole('dialog');
|
||||
const appeared = await dialog
|
||||
.waitFor({ state: 'visible', timeout: 2500 })
|
||||
.then(() => true)
|
||||
.catch(() => false);
|
||||
if (appeared) {
|
||||
await dialog.getByPlaceholder('Password').fill(TEST_USER_PASSWORD);
|
||||
await dialog.getByRole('button', { name: 'Confirm' }).click();
|
||||
await expect(dialog).not.toBeVisible();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Enables 2FA from the profile page and returns the TOTP secret (setup key)
|
||||
* and the recovery codes fetched right after enabling.
|
||||
*/
|
||||
async function enableTwoFactor(page: Page): Promise<{ secret: string; recoveryCodes: string[] }> {
|
||||
await goToProfilePage(page);
|
||||
await page
|
||||
.getByText('You have not enabled two factor authentication.')
|
||||
.locator('..')
|
||||
.getByRole('button', { name: 'Enable' })
|
||||
.click();
|
||||
|
||||
const dialog = page.getByRole('dialog');
|
||||
await expect(dialog).toBeVisible();
|
||||
|
||||
const recoveryCodesResponse = page.waitForResponse(
|
||||
(response) =>
|
||||
response.url().includes('/user/two-factor-recovery-codes') &&
|
||||
response.request().method() === 'GET'
|
||||
);
|
||||
await dialog.getByPlaceholder('Password').fill(TEST_USER_PASSWORD);
|
||||
await dialog.getByRole('button', { name: 'Confirm' }).click();
|
||||
|
||||
await expect(page.getByRole('heading', { name: 'Finish enabling two factor' })).toBeVisible();
|
||||
const recoveryCodes: string[] = await (await recoveryCodesResponse).json();
|
||||
|
||||
const setupKeyText = await page.getByText('Setup Key:').textContent();
|
||||
const secret = setupKeyText!.replace('Setup Key:', '').trim();
|
||||
expect(secret.length).toBeGreaterThan(0);
|
||||
|
||||
return { secret, recoveryCodes };
|
||||
}
|
||||
|
||||
/**
|
||||
* Confirms a freshly enabled 2FA setup with a valid TOTP code.
|
||||
*/
|
||||
async function confirmTwoFactor(page: Page, secret: string) {
|
||||
await page.getByLabel('Code').fill(generateTotpCode(secret));
|
||||
await page.getByRole('button', { name: 'Confirm', exact: true }).click();
|
||||
await confirmPasswordIfPrompted(page);
|
||||
await expect(page.getByText('You have enabled two factor authentication.')).toBeVisible();
|
||||
}
|
||||
|
||||
async function logout(page: Page) {
|
||||
await page.getByTestId('current_user_button').click();
|
||||
await page.getByText('Log Out', { exact: true }).click();
|
||||
await page.waitForURL(PLAYWRIGHT_BASE_URL + '/login');
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads the email of the current user from the profile form, waiting until
|
||||
* the user query has populated it.
|
||||
*/
|
||||
async function getProfileEmail(page: Page): Promise<string> {
|
||||
await goToProfilePage(page);
|
||||
const emailInput = page.getByLabel('Email', { exact: true });
|
||||
await expect(emailInput).toHaveValue(/@/);
|
||||
return await emailInput.inputValue();
|
||||
}
|
||||
|
||||
async function loginUntilTwoFactorChallenge(page: Page, email: string) {
|
||||
await page.goto(PLAYWRIGHT_BASE_URL + '/login');
|
||||
await page.getByLabel('Email').fill(email);
|
||||
await page.getByLabel('Password').fill(TEST_USER_PASSWORD);
|
||||
await page.getByRole('button', { name: 'Log in' }).click();
|
||||
await page.waitForURL(PLAYWRIGHT_BASE_URL + '/two-factor-challenge');
|
||||
}
|
||||
|
||||
test('test that 2FA can be confirmed with a TOTP code and shows recovery codes', async ({
|
||||
page,
|
||||
}) => {
|
||||
const { secret, recoveryCodes } = await enableTwoFactor(page);
|
||||
await confirmTwoFactor(page, secret);
|
||||
|
||||
await expect(page.getByText('Store these recovery codes')).toBeVisible();
|
||||
expect(recoveryCodes.length).toBeGreaterThan(0);
|
||||
for (const code of recoveryCodes) {
|
||||
await expect(page.getByText(code)).toBeVisible();
|
||||
}
|
||||
|
||||
// The confirmed state survives a reload
|
||||
await page.reload();
|
||||
await expect(page.getByText('You have enabled two factor authentication.')).toBeVisible();
|
||||
});
|
||||
|
||||
test('test that 2FA confirmation fails with an invalid TOTP code', async ({ page }) => {
|
||||
const { secret } = await enableTwoFactor(page);
|
||||
|
||||
await page.getByLabel('Code').fill(generateInvalidTotpCode(secret));
|
||||
await page.getByRole('button', { name: 'Confirm', exact: true }).click();
|
||||
await confirmPasswordIfPrompted(page);
|
||||
|
||||
await expect(page.getByRole('alert')).toContainText(
|
||||
'The provided two factor authentication code was invalid.'
|
||||
);
|
||||
await expect(page.getByRole('heading', { name: 'Finish enabling two factor' })).toBeVisible();
|
||||
});
|
||||
|
||||
test('test that recovery codes can be regenerated', async ({ page }) => {
|
||||
const { secret, recoveryCodes } = await enableTwoFactor(page);
|
||||
await confirmTwoFactor(page, secret);
|
||||
|
||||
const newCodesResponse = page.waitForResponse(
|
||||
(response) =>
|
||||
response.url().includes('/user/two-factor-recovery-codes') &&
|
||||
response.request().method() === 'GET'
|
||||
);
|
||||
await page.getByRole('button', { name: 'Regenerate Recovery Codes' }).click();
|
||||
await confirmPasswordIfPrompted(page);
|
||||
const newCodes: string[] = await (await newCodesResponse).json();
|
||||
|
||||
expect(newCodes).not.toEqual(recoveryCodes);
|
||||
await expect(page.getByText(newCodes[0])).toBeVisible();
|
||||
await expect(page.getByText(recoveryCodes[0])).not.toBeVisible();
|
||||
});
|
||||
|
||||
test('test that 2FA can be disabled', async ({ page }) => {
|
||||
const { secret } = await enableTwoFactor(page);
|
||||
await confirmTwoFactor(page, secret);
|
||||
|
||||
await page.getByRole('button', { name: 'Disable' }).click();
|
||||
await confirmPasswordIfPrompted(page);
|
||||
await expect(page.getByText('You have not enabled two factor authentication.')).toBeVisible();
|
||||
|
||||
// The disabled state survives a reload
|
||||
await page.reload();
|
||||
await expect(page.getByText('You have not enabled two factor authentication.')).toBeVisible();
|
||||
});
|
||||
|
||||
test('test that login challenges for a TOTP code and rejects an invalid code', async ({ page }) => {
|
||||
const email = await getProfileEmail(page);
|
||||
|
||||
const { secret } = await enableTwoFactor(page);
|
||||
await confirmTwoFactor(page, secret);
|
||||
await logout(page);
|
||||
|
||||
await loginUntilTwoFactorChallenge(page, email);
|
||||
|
||||
await page.getByLabel('Code').fill(generateInvalidTotpCode(secret));
|
||||
await page.getByRole('button', { name: 'Log in' }).click();
|
||||
await expect(page.getByRole('alert')).toContainText(
|
||||
'The provided two factor authentication code was invalid.'
|
||||
);
|
||||
|
||||
// Fortify rejects replayed codes, and the current window's code was
|
||||
// already consumed when confirming the setup — use the next window's
|
||||
// code, which the +/- 1 step verification window also accepts.
|
||||
await page.getByLabel('Code').fill(generateTotpCode(secret, Date.now() + 30_000));
|
||||
await page.getByRole('button', { name: 'Log in' }).click();
|
||||
await expect(page.getByTestId('dashboard_view')).toBeVisible();
|
||||
});
|
||||
|
||||
test('test that login works with a recovery code', async ({ page }) => {
|
||||
const email = await getProfileEmail(page);
|
||||
|
||||
const { secret, recoveryCodes } = await enableTwoFactor(page);
|
||||
await confirmTwoFactor(page, secret);
|
||||
await logout(page);
|
||||
|
||||
await loginUntilTwoFactorChallenge(page, email);
|
||||
|
||||
await page.getByRole('button', { name: 'Use a recovery code' }).click();
|
||||
await page.getByLabel('Recovery Code').fill(recoveryCodes[0]);
|
||||
await page.getByRole('button', { name: 'Log in' }).click();
|
||||
await expect(page.getByTestId('dashboard_view')).toBeVisible();
|
||||
});
|
||||
@@ -641,13 +641,10 @@ export async function updateOrganizationCurrencyViaWeb(
|
||||
const xsrfCookie = cookies.find((c) => c.name === 'XSRF-TOKEN');
|
||||
const xsrfToken = xsrfCookie ? decodeURIComponent(xsrfCookie.value) : '';
|
||||
|
||||
const response = await page.request.put(
|
||||
`${PLAYWRIGHT_BASE_URL}/api/v1/organizations/${ctx.orgId}`,
|
||||
{
|
||||
headers: { 'X-XSRF-TOKEN': xsrfToken },
|
||||
data: { name, currency },
|
||||
}
|
||||
);
|
||||
const response = await page.request.put(`${PLAYWRIGHT_BASE_URL}/teams/${ctx.orgId}`, {
|
||||
headers: { 'X-XSRF-TOKEN': xsrfToken },
|
||||
data: { name, currency },
|
||||
});
|
||||
expect(response.status()).toBe(200);
|
||||
}
|
||||
|
||||
@@ -804,23 +801,53 @@ export async function getCurrentUserViaApi(ctx: TestContext) {
|
||||
};
|
||||
}
|
||||
|
||||
export async function updateUserProfileViaApi(
|
||||
ctx: TestContext,
|
||||
export async function updateUserProfileViaWeb(
|
||||
page: Page,
|
||||
settings: { timezone?: string; week_start?: string }
|
||||
) {
|
||||
const user = await getCurrentUserViaApi(ctx);
|
||||
// Read user info from Inertia's data-page attribute on the root element
|
||||
const userInfo = await page.evaluate(() => {
|
||||
// Try Inertia's data-page attribute (stores initial page props as JSON)
|
||||
const appEl = document.getElementById('app');
|
||||
if (appEl) {
|
||||
const dataPage = appEl.getAttribute('data-page');
|
||||
if (dataPage) {
|
||||
try {
|
||||
const parsed = JSON.parse(dataPage);
|
||||
const user = parsed?.props?.auth?.user;
|
||||
if (user) {
|
||||
return {
|
||||
name: user.name,
|
||||
email: user.email,
|
||||
timezone: user.timezone,
|
||||
week_start: user.week_start,
|
||||
};
|
||||
}
|
||||
} catch {
|
||||
// JSON parse failed
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
});
|
||||
if (!userInfo) throw new Error('Could not read user info from Inertia data-page attribute');
|
||||
|
||||
// Only send the fields under test; the endpoint leaves omitted fields untouched.
|
||||
const data: Record<string, string> = {};
|
||||
if (settings.timezone !== undefined) {
|
||||
data.timezone = settings.timezone;
|
||||
}
|
||||
if (settings.week_start !== undefined) {
|
||||
data.week_start = settings.week_start;
|
||||
}
|
||||
const cookies = await page.context().cookies();
|
||||
const xsrfCookie = cookies.find((c) => c.name === 'XSRF-TOKEN');
|
||||
const xsrfToken = xsrfCookie ? decodeURIComponent(xsrfCookie.value) : '';
|
||||
|
||||
const response = await ctx.request.put(`${PLAYWRIGHT_BASE_URL}/api/v1/users/${user.id}`, {
|
||||
data,
|
||||
const response = await page.request.put(`${PLAYWRIGHT_BASE_URL}/user/profile-information`, {
|
||||
headers: {
|
||||
'X-XSRF-TOKEN': xsrfToken,
|
||||
'Content-Type': 'application/json',
|
||||
Accept: 'application/json',
|
||||
},
|
||||
data: {
|
||||
name: userInfo.name,
|
||||
email: userInfo.email,
|
||||
timezone: settings.timezone ?? userInfo.timezone,
|
||||
week_start: settings.week_start ?? userInfo.week_start,
|
||||
},
|
||||
});
|
||||
expect(response.status()).toBe(200);
|
||||
}
|
||||
|
||||
@@ -1,58 +0,0 @@
|
||||
import { createHmac } from 'node:crypto';
|
||||
|
||||
const BASE32_ALPHABET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567';
|
||||
|
||||
function base32Decode(input: string): Buffer {
|
||||
const normalized = input
|
||||
.toUpperCase()
|
||||
.replace(/=+$/, '')
|
||||
.replace(/[^A-Z2-7]/g, '');
|
||||
let bits = 0;
|
||||
let value = 0;
|
||||
const bytes: number[] = [];
|
||||
for (const char of normalized) {
|
||||
value = (value << 5) | BASE32_ALPHABET.indexOf(char);
|
||||
bits += 5;
|
||||
if (bits >= 8) {
|
||||
bytes.push((value >>> (bits - 8)) & 0xff);
|
||||
bits -= 8;
|
||||
}
|
||||
}
|
||||
return Buffer.from(bytes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a 6-digit TOTP code (RFC 6238, SHA-1, 30 second period) for the
|
||||
* given base32 secret — the "Setup Key" shown while enabling 2FA.
|
||||
*/
|
||||
export function generateTotpCode(base32Secret: string, atMs: number = Date.now()): string {
|
||||
const counter = Math.floor(atMs / 1000 / 30);
|
||||
const counterBuffer = Buffer.alloc(8);
|
||||
counterBuffer.writeBigUInt64BE(BigInt(counter));
|
||||
const digest = createHmac('sha1', base32Decode(base32Secret)).update(counterBuffer).digest();
|
||||
const offset = digest[digest.length - 1] & 0x0f;
|
||||
const code =
|
||||
((digest[offset] & 0x7f) << 24) |
|
||||
((digest[offset + 1] & 0xff) << 16) |
|
||||
((digest[offset + 2] & 0xff) << 8) |
|
||||
(digest[offset + 3] & 0xff);
|
||||
return (code % 1_000_000).toString().padStart(6, '0');
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a syntactically valid TOTP code that is guaranteed to be rejected,
|
||||
* by using a timestamp far outside the accepted verification window.
|
||||
*/
|
||||
export function generateInvalidTotpCode(base32Secret: string): string {
|
||||
const validNow = [
|
||||
generateTotpCode(base32Secret, Date.now() - 30_000),
|
||||
generateTotpCode(base32Secret),
|
||||
generateTotpCode(base32Secret, Date.now() + 30_000),
|
||||
];
|
||||
for (let minutes = 10; ; minutes++) {
|
||||
const candidate = generateTotpCode(base32Secret, Date.now() + minutes * 60_000);
|
||||
if (!validNow.includes(candidate)) {
|
||||
return candidate;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -61,7 +61,7 @@ const switchToTeam = (organization: Organization) => {
|
||||
|
||||
<DropdownMenuItem as-child>
|
||||
<Link
|
||||
:href="route('organizations.show', page.props.auth.user.current_team.id)"
|
||||
:href="route('teams.show', page.props.auth.user.current_team.id)"
|
||||
class="inline-flex items-center gap-2.5 w-full">
|
||||
<Cog6ToothIcon class="w-5 h-5 text-icon-default" />
|
||||
<span>Organization Settings</span>
|
||||
@@ -74,7 +74,7 @@ const switchToTeam = (organization: Organization) => {
|
||||
|
||||
<DropdownMenuItem as-child>
|
||||
<Link
|
||||
:href="route('organizations.create')"
|
||||
:href="route('teams.create')"
|
||||
class="inline-flex items-center gap-2.5 w-full">
|
||||
<PlusCircleIcon class="w-5 h-5 text-icon-default" />
|
||||
<span>Create new organization</span>
|
||||
|
||||
@@ -62,35 +62,4 @@ describe('TimesheetCell', () => {
|
||||
expect(wrapper.emitted('update')).toBeUndefined();
|
||||
expect((input.element as HTMLInputElement).value).toBe(previousValue);
|
||||
});
|
||||
|
||||
it('shows a pending 0 (delete in flight) over the cell total', () => {
|
||||
const wrapper = mount(TimesheetCell, {
|
||||
props: {
|
||||
cell: buildCell(2 * 3600),
|
||||
dayIndex: 0,
|
||||
date: '2026-04-13',
|
||||
isToday: false,
|
||||
hasRunningEntry: false,
|
||||
pendingSeconds: 0,
|
||||
},
|
||||
});
|
||||
|
||||
// `??` (not `||`): a pending 0 must win over the 2h cell total.
|
||||
expect((wrapper.get('input').element as HTMLInputElement).value).toBe('');
|
||||
});
|
||||
|
||||
it('disables editing while the cell is saving', () => {
|
||||
const wrapper = mount(TimesheetCell, {
|
||||
props: {
|
||||
cell: buildCell(2 * 3600),
|
||||
dayIndex: 0,
|
||||
date: '2026-04-13',
|
||||
isToday: false,
|
||||
hasRunningEntry: false,
|
||||
saveStatus: 'saving',
|
||||
},
|
||||
});
|
||||
|
||||
expect((wrapper.get('input').element as HTMLInputElement).disabled).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue';
|
||||
import { CheckIcon } from '@heroicons/vue/16/solid';
|
||||
import DurationSecondsInput from '@/packages/ui/src/Input/DurationSecondsInput.vue';
|
||||
import LoadingSpinner from '@/packages/ui/src/LoadingSpinner.vue';
|
||||
import {
|
||||
Tooltip,
|
||||
TooltipContent,
|
||||
@@ -10,40 +7,18 @@ import {
|
||||
TooltipTrigger,
|
||||
} from '@/packages/ui/src/tooltip';
|
||||
import type { TimesheetCell } from '@/utils/useTimesheetGrid';
|
||||
import type { CellSaveStatus } from '@/utils/timesheet/useTimesheetCellMutations';
|
||||
|
||||
const props = defineProps<{
|
||||
defineProps<{
|
||||
cell?: TimesheetCell;
|
||||
dayIndex: number;
|
||||
date: string;
|
||||
isToday: boolean;
|
||||
hasRunningEntry: boolean;
|
||||
saveStatus?: CellSaveStatus;
|
||||
pendingSeconds?: number;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
update: [newSeconds: number];
|
||||
}>();
|
||||
|
||||
// Show the optimistic value while saving; `??` (not `||`) so a pending 0 (delete) wins.
|
||||
const displaySeconds = computed(() => props.pendingSeconds ?? props.cell?.totalSeconds ?? 0);
|
||||
const isSaving = computed(() => props.saveStatus === 'saving');
|
||||
|
||||
// Swap the border color (don't layer) to avoid same-specificity fights.
|
||||
const inputClass = computed(() => {
|
||||
const border = props.saveStatus === 'error' ? 'border-red-500/70' : 'border-input-border';
|
||||
return [
|
||||
'w-[80px] mx-auto text-center font-medium',
|
||||
'bg-transparent text-text-primary placeholder:text-text-quaternary',
|
||||
'rounded-lg border shadow-none',
|
||||
border,
|
||||
'hover:bg-card-background',
|
||||
'focus-visible:bg-tertiary focus-visible:border-transparent',
|
||||
'focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none',
|
||||
'disabled:cursor-wait disabled:opacity-70',
|
||||
].join(' ');
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -71,26 +46,18 @@ const inputClass = computed(() => {
|
||||
<TooltipContent> Stop the running time entry to edit the timesheet </TooltipContent>
|
||||
</Tooltip>
|
||||
</TooltipProvider>
|
||||
<template v-else>
|
||||
<span class="relative inline-flex items-center">
|
||||
<DurationSecondsInput
|
||||
:model-value="displaySeconds"
|
||||
default-unit="hours"
|
||||
placeholder="-"
|
||||
size="sm"
|
||||
:disabled="isSaving"
|
||||
:input-class="inputClass"
|
||||
@commit="(seconds) => emit('update', seconds ?? 0)" />
|
||||
<span
|
||||
v-if="saveStatus === 'saving' || saveStatus === 'saved'"
|
||||
class="pointer-events-none absolute left-full top-1/2 ml-1.5 flex -translate-y-1/2 items-center"
|
||||
:aria-label="saveStatus === 'saving' ? 'Saving' : 'Saved'">
|
||||
<LoadingSpinner
|
||||
v-if="saveStatus === 'saving'"
|
||||
class="h-3 w-3 m-0 text-text-tertiary" />
|
||||
<CheckIcon v-else class="h-3 w-3 text-text-tertiary" />
|
||||
</span>
|
||||
</span>
|
||||
</template>
|
||||
<DurationSecondsInput
|
||||
v-else
|
||||
:model-value="cell?.totalSeconds ?? 0"
|
||||
default-unit="hours"
|
||||
placeholder="-"
|
||||
size="sm"
|
||||
input-class="w-[80px] mx-auto text-center font-medium
|
||||
bg-transparent text-text-primary placeholder:text-text-quaternary
|
||||
rounded-lg border border-input-border shadow-none
|
||||
hover:bg-card-background
|
||||
focus-visible:bg-tertiary focus-visible:border-transparent
|
||||
focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none"
|
||||
@commit="(seconds) => emit('update', seconds ?? 0)" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -15,7 +15,6 @@ import type {
|
||||
Task,
|
||||
} from '@/packages/api/src';
|
||||
import type { TimesheetRow as TimesheetRowType, TimesheetRowKey } from '@/utils/useTimesheetGrid';
|
||||
import type { CellSaveStatus } from '@/utils/timesheet/useTimesheetCellMutations';
|
||||
|
||||
const organization = inject<ComputedRef<Organization>>('organization');
|
||||
const dayjs = getDayJsInstance();
|
||||
@@ -37,8 +36,6 @@ defineProps<{
|
||||
createClient: (client: CreateClientBody) => Promise<Client | undefined>;
|
||||
createTag: (name: string) => Promise<Tag | undefined>;
|
||||
formatDuration: (seconds: number) => string;
|
||||
cellStatuses: Record<string, CellSaveStatus>;
|
||||
cellPendingSeconds: Record<string, number>;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
@@ -63,7 +60,7 @@ const emit = defineEmits<{
|
||||
class="grid min-w-full w-max border-y border-default-background-separator"
|
||||
style="
|
||||
grid-template-columns:
|
||||
minmax(420px, 1fr) repeat(7, minmax(116px, 120px)) minmax(100px, auto)
|
||||
minmax(420px, 1fr) repeat(7, minmax(96px, 120px)) minmax(100px, auto)
|
||||
40px;
|
||||
">
|
||||
<!-- Header row -->
|
||||
@@ -103,8 +100,6 @@ const emit = defineEmits<{
|
||||
:create-client="createClient"
|
||||
:create-tag="createTag"
|
||||
:format-duration="formatDuration"
|
||||
:cell-statuses="cellStatuses"
|
||||
:cell-pending-seconds="cellPendingSeconds"
|
||||
@remove-row="$emit('remove-row', $event)"
|
||||
@cell-update="
|
||||
(dayIndex, seconds) => $emit('cell-update', row, dayIndex, seconds)
|
||||
|
||||
@@ -15,10 +15,6 @@ import type {
|
||||
Organization,
|
||||
} from '@/packages/api/src';
|
||||
import type { TimesheetRow, TimesheetRowKey } from '@/utils/useTimesheetGrid';
|
||||
import {
|
||||
makeCellStatusKey,
|
||||
type CellSaveStatus,
|
||||
} from '@/utils/timesheet/useTimesheetCellMutations';
|
||||
import { Button } from '@/packages/ui/src/Buttons';
|
||||
|
||||
const organization = inject<ComputedRef<Organization>>('organization');
|
||||
@@ -38,8 +34,6 @@ const props = defineProps<{
|
||||
createClient: (client: CreateClientBody) => Promise<Client | undefined>;
|
||||
createTag: (name: string) => Promise<Tag | undefined>;
|
||||
formatDuration: (seconds: number) => string;
|
||||
cellStatuses: Record<string, CellSaveStatus>;
|
||||
cellPendingSeconds: Record<string, number>;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
@@ -115,8 +109,6 @@ function hasRunningEntry(dayIndex: number): boolean {
|
||||
:date="day"
|
||||
:is-today="day === todayDate"
|
||||
:has-running-entry="hasRunningEntry(dayIndex)"
|
||||
:save-status="cellStatuses[makeCellStatusKey(row.key, dayIndex)]"
|
||||
:pending-seconds="cellPendingSeconds[makeCellStatusKey(row.key, dayIndex)]"
|
||||
@update="(seconds) => emit('cellUpdate', dayIndex, seconds)" />
|
||||
|
||||
<!-- Row total -->
|
||||
|
||||
@@ -280,15 +280,10 @@ const page = usePage<{
|
||||
v-if="canUpdateOrganization()"
|
||||
title="Settings"
|
||||
:icon="Cog6ToothIcon"
|
||||
:href="
|
||||
route(
|
||||
'organizations.show',
|
||||
page.props.auth.user.current_team.id
|
||||
)
|
||||
"
|
||||
:href="route('teams.show', page.props.auth.user.current_team.id)"
|
||||
:current="
|
||||
route().current(
|
||||
'organizations.show',
|
||||
'teams.show',
|
||||
page.props.auth.user.current_team.id
|
||||
)
|
||||
"></NavigationSidebarItem>
|
||||
@@ -298,7 +293,7 @@ const page = usePage<{
|
||||
<div class="justify-self-end">
|
||||
<UpdateSidebarNotification></UpdateSidebarNotification>
|
||||
<ul
|
||||
class="border-t border-default-background-separator pt-3 gap-1 flex justify-between items-center">
|
||||
class="border-t border-default-background-separator pt-3 gap-1 pr-2 flex justify-between items-center">
|
||||
<UserSettingsIcon></UserSettingsIcon>
|
||||
|
||||
<NavigationSidebarItem
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue';
|
||||
import axios from 'axios';
|
||||
import ActionSection from '@/Components/ActionSection.vue';
|
||||
import DangerButton from '@/packages/ui/src/Buttons/DangerButton.vue';
|
||||
import DialogModal from '@/packages/ui/src/DialogModal.vue';
|
||||
import { Field, FieldError } from '@/packages/ui/src/field';
|
||||
import SecondaryButton from '@/packages/ui/src/Buttons/SecondaryButton.vue';
|
||||
import TextInput from '@/packages/ui/src/Input/TextInput.vue';
|
||||
import { useDeleteUserMutation } from '@/utils/useUserQuery';
|
||||
import { getCurrentUserId } from '@/utils/useUser';
|
||||
import { useDeleteUserMutation, useUserQuery } from '@/utils/useUserQuery';
|
||||
|
||||
const { user } = useUserQuery();
|
||||
const deleteUserMutation = useDeleteUserMutation();
|
||||
|
||||
const confirmingUserDeletion = ref(false);
|
||||
@@ -23,26 +24,26 @@ function confirmUserDeletion() {
|
||||
}
|
||||
|
||||
async function deleteUser() {
|
||||
if (processing.value) return;
|
||||
if (!user.value || processing.value) return;
|
||||
processing.value = true;
|
||||
passwordError.value = '';
|
||||
try {
|
||||
await deleteUserMutation.mutateAsync({
|
||||
userId: getCurrentUserId(),
|
||||
body: { password: password.value },
|
||||
});
|
||||
window.location.href = '/';
|
||||
await axios.post(route('password.confirm'), { password: password.value });
|
||||
} catch (error) {
|
||||
if (error && typeof error === 'object' && 'response' in error) {
|
||||
const response = error.response as
|
||||
| { status?: number; data?: { errors?: { password?: string[] } } }
|
||||
| undefined;
|
||||
if (response?.status === 422) {
|
||||
passwordError.value = response.data?.errors?.password?.[0] ?? 'Invalid password.';
|
||||
}
|
||||
}
|
||||
processing.value = false;
|
||||
if (axios.isAxiosError(error) && error.response?.status === 422) {
|
||||
passwordError.value = error.response.data?.errors?.password?.[0] ?? 'Invalid password.';
|
||||
} else {
|
||||
passwordError.value = 'Could not confirm password. Please try again.';
|
||||
}
|
||||
passwordInput.value?.focus();
|
||||
return;
|
||||
}
|
||||
try {
|
||||
await deleteUserMutation.mutateAsync(user.value.id);
|
||||
window.location.href = '/';
|
||||
} catch {
|
||||
processing.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, onBeforeUnmount, ref, watch } from 'vue';
|
||||
import { usePage } from '@inertiajs/vue3';
|
||||
import axios from 'axios';
|
||||
import ActionMessage from '@/Components/ActionMessage.vue';
|
||||
import FormSection from '@/Components/FormSection.vue';
|
||||
import { Field, FieldError, FieldLabel } from '@/packages/ui/src/field';
|
||||
@@ -15,7 +16,6 @@ import {
|
||||
useUserQuery,
|
||||
} from '@/utils/useUserQuery';
|
||||
import type { UpdateUserBody, User } from '@/packages/api/src';
|
||||
import { getApiValidationFieldErrors } from '@/utils/apiValidation';
|
||||
|
||||
const { user } = useUserQuery();
|
||||
const updateUser = useUpdateUserMutation();
|
||||
@@ -58,9 +58,17 @@ const hasUploadedPhoto = computed(() => {
|
||||
return !!url && !url.includes('ui-avatars.com');
|
||||
});
|
||||
|
||||
const fieldErrors = computed<Record<string, string>>(() =>
|
||||
getApiValidationFieldErrors(updateUser.error.value)
|
||||
);
|
||||
const fieldErrors = computed<Record<string, string>>(() => {
|
||||
const err = updateUser.error.value;
|
||||
if (!axios.isAxiosError(err) || err.response?.status !== 422) return {};
|
||||
const raw = err.response.data?.errors as Record<string, string[]> | undefined;
|
||||
if (!raw) return {};
|
||||
const flat: Record<string, string> = {};
|
||||
for (const [key, messages] of Object.entries(raw)) {
|
||||
if (Array.isArray(messages) && messages[0]) flat[key] = messages[0];
|
||||
}
|
||||
return flat;
|
||||
});
|
||||
|
||||
function buildPayload(): UpdateUserBody {
|
||||
if (!user.value) return {};
|
||||
|
||||
@@ -1,68 +1,25 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, ref, watch } from 'vue';
|
||||
import axios from 'axios';
|
||||
import { router, usePage } from '@inertiajs/vue3';
|
||||
import { useForm, usePage } from '@inertiajs/vue3';
|
||||
import FormSection from '@/Components/FormSection.vue';
|
||||
import { Field, FieldError, FieldLabel } from '@/packages/ui/src/field';
|
||||
import { Field, FieldLabel, FieldError } from '@/packages/ui/src/field';
|
||||
import PrimaryButton from '@/packages/ui/src/Buttons/PrimaryButton.vue';
|
||||
import TextInput from '@/packages/ui/src/Input/TextInput.vue';
|
||||
import type { User } from '@/types/models';
|
||||
import { useOrganizationStore } from '@/utils/useOrganization';
|
||||
import { useNotificationsStore } from '@/utils/notification';
|
||||
import {
|
||||
getApiValidationFieldErrors,
|
||||
getApiValidationMessage,
|
||||
isApiValidationError,
|
||||
} from '@/utils/apiValidation';
|
||||
import { initializeStores } from '@/utils/init';
|
||||
|
||||
const name = ref('');
|
||||
const processing = ref(false);
|
||||
const createError = ref<unknown>(null);
|
||||
const organizationStore = useOrganizationStore();
|
||||
const notifications = useNotificationsStore();
|
||||
|
||||
const fieldErrors = computed<Record<string, string>>(() =>
|
||||
getApiValidationFieldErrors(createError.value)
|
||||
);
|
||||
|
||||
watch(name, () => {
|
||||
createError.value = null;
|
||||
const form = useForm({
|
||||
name: '',
|
||||
});
|
||||
|
||||
const createTeam = async () => {
|
||||
processing.value = true;
|
||||
createError.value = null;
|
||||
try {
|
||||
const organization = await organizationStore.createOrganization(name.value);
|
||||
if (organization) {
|
||||
notifications.addNotification('success', 'Organization created successfully');
|
||||
// The backend already switched the current organization to the new one.
|
||||
// Flush Inertia's prefetch cache and do a full reload so the new
|
||||
// organization context is picked up everywhere.
|
||||
router.flushAll();
|
||||
router.visit(route('dashboard'));
|
||||
}
|
||||
} catch (error) {
|
||||
createError.value = error;
|
||||
if (isApiValidationError(error)) {
|
||||
notifications.addNotification(
|
||||
'error',
|
||||
getApiValidationMessage(error, 'Failed to create organization')
|
||||
);
|
||||
} else if (axios.isAxiosError(error)) {
|
||||
notifications.addNotification(
|
||||
'error',
|
||||
'Failed to create organization',
|
||||
error.response?.data?.message ?? 'Please try again later.'
|
||||
);
|
||||
} else {
|
||||
notifications.addNotification('error', 'Failed to create organization');
|
||||
}
|
||||
} finally {
|
||||
processing.value = false;
|
||||
}
|
||||
const createTeam = () => {
|
||||
form.post(route('teams.store'), {
|
||||
errorBag: 'createTeam',
|
||||
preserveScroll: true,
|
||||
onSuccess: () => {
|
||||
initializeStores();
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
const page = usePage<{
|
||||
auth: {
|
||||
user: User;
|
||||
@@ -103,17 +60,16 @@ const page = usePage<{
|
||||
<FieldLabel for="name">Organization Name</FieldLabel>
|
||||
<TextInput
|
||||
id="name"
|
||||
v-model="name"
|
||||
v-model="form.name"
|
||||
type="text"
|
||||
class="block w-full"
|
||||
autofocus
|
||||
:aria-invalid="Boolean(fieldErrors.name)" />
|
||||
<FieldError v-if="fieldErrors.name">{{ fieldErrors.name }}</FieldError>
|
||||
autofocus />
|
||||
<FieldError v-if="form.errors.name">{{ form.errors.name }}</FieldError>
|
||||
</Field>
|
||||
</template>
|
||||
|
||||
<template #actions>
|
||||
<PrimaryButton :class="{ 'opacity-25': processing }" :disabled="processing">
|
||||
<PrimaryButton :class="{ 'opacity-25': form.processing }" :disabled="form.processing">
|
||||
Create
|
||||
</PrimaryButton>
|
||||
</template>
|
||||
|
||||
@@ -1,58 +1,26 @@
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue';
|
||||
import { router } from '@inertiajs/vue3';
|
||||
import { useForm } from '@inertiajs/vue3';
|
||||
import ActionSection from '@/Components/ActionSection.vue';
|
||||
import ConfirmationModal from '@/Components/ConfirmationModal.vue';
|
||||
import DangerButton from '@/packages/ui/src/Buttons/DangerButton.vue';
|
||||
import DialogModal from '@/packages/ui/src/DialogModal.vue';
|
||||
import { Field, FieldError } from '@/packages/ui/src/field';
|
||||
import SecondaryButton from '@/packages/ui/src/Buttons/SecondaryButton.vue';
|
||||
import TextInput from '@/packages/ui/src/Input/TextInput.vue';
|
||||
import { useOrganizationStore } from '@/utils/useOrganization';
|
||||
|
||||
const props = defineProps<{
|
||||
team: { id: string };
|
||||
}>();
|
||||
const props = defineProps({
|
||||
team: Object,
|
||||
});
|
||||
|
||||
const confirmingTeamDeletion = ref(false);
|
||||
const passwordInput = ref<HTMLInputElement | null>(null);
|
||||
const password = ref('');
|
||||
const passwordError = ref('');
|
||||
const processing = ref(false);
|
||||
const organizationStore = useOrganizationStore();
|
||||
const form = useForm({});
|
||||
|
||||
const confirmTeamDeletion = () => {
|
||||
confirmingTeamDeletion.value = true;
|
||||
setTimeout(() => passwordInput.value?.focus(), 250);
|
||||
};
|
||||
|
||||
const deleteTeam = async () => {
|
||||
if (processing.value) return;
|
||||
processing.value = true;
|
||||
passwordError.value = '';
|
||||
try {
|
||||
await organizationStore.deleteOrganization(props.team.id, { password: password.value });
|
||||
// The backend reassigns the user's current organization after deletion,
|
||||
// so flush the prefetch cache and reload into the dashboard.
|
||||
router.flushAll();
|
||||
router.visit(route('dashboard'));
|
||||
} catch (error) {
|
||||
if (error && typeof error === 'object' && 'response' in error) {
|
||||
const response = error.response as
|
||||
| { status?: number; data?: { errors?: { password?: string[] } } }
|
||||
| undefined;
|
||||
if (response?.status === 422) {
|
||||
passwordError.value = response.data?.errors?.password?.[0] ?? 'Invalid password.';
|
||||
}
|
||||
}
|
||||
processing.value = false;
|
||||
passwordInput.value?.focus();
|
||||
}
|
||||
};
|
||||
|
||||
const closeModal = () => {
|
||||
confirmingTeamDeletion.value = false;
|
||||
password.value = '';
|
||||
passwordError.value = '';
|
||||
const deleteTeam = () => {
|
||||
form.delete(route('teams.destroy', props.team), {
|
||||
errorBag: 'deleteTeam',
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -74,40 +42,30 @@ const closeModal = () => {
|
||||
</div>
|
||||
|
||||
<!-- Delete Organization Confirmation Modal -->
|
||||
<DialogModal :show="confirmingTeamDeletion" @close="closeModal">
|
||||
<ConfirmationModal
|
||||
:show="confirmingTeamDeletion"
|
||||
@close="confirmingTeamDeletion = false">
|
||||
<template #title> Delete Organization </template>
|
||||
|
||||
<template #content>
|
||||
Are you sure you want to delete this organization? Once a organization is
|
||||
deleted, all of its resources and data will be permanently deleted. Please enter
|
||||
your password to confirm you would like to permanently delete this organization.
|
||||
|
||||
<Field class="mt-4">
|
||||
<TextInput
|
||||
ref="passwordInput"
|
||||
v-model="password"
|
||||
type="password"
|
||||
class="block w-3/4"
|
||||
placeholder="Password"
|
||||
autocomplete="current-password"
|
||||
@keyup.enter="deleteTeam" />
|
||||
|
||||
<FieldError v-if="passwordError">{{ passwordError }}</FieldError>
|
||||
</Field>
|
||||
deleted, all of its resources and data will be permanently deleted.
|
||||
</template>
|
||||
|
||||
<template #footer>
|
||||
<SecondaryButton @click="closeModal"> Cancel </SecondaryButton>
|
||||
<SecondaryButton @click="confirmingTeamDeletion = false">
|
||||
Cancel
|
||||
</SecondaryButton>
|
||||
|
||||
<DangerButton
|
||||
class="ms-3"
|
||||
:class="{ 'opacity-25': processing }"
|
||||
:disabled="processing"
|
||||
:class="{ 'opacity-25': form.processing }"
|
||||
:disabled="form.processing"
|
||||
@click="deleteTeam">
|
||||
Delete Organization
|
||||
</DangerButton>
|
||||
</template>
|
||||
</DialogModal>
|
||||
</ConfirmationModal>
|
||||
</template>
|
||||
</ActionSection>
|
||||
</template>
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import { Link, router } from '@inertiajs/vue3';
|
||||
import { reactive, ref } from 'vue';
|
||||
import axios from 'axios';
|
||||
import { Link, useForm } from '@inertiajs/vue3';
|
||||
import ActionMessage from '@/Components/ActionMessage.vue';
|
||||
import FormSection from '@/Components/FormSection.vue';
|
||||
import { Field, FieldLabel, FieldError } from '@/packages/ui/src/field';
|
||||
@@ -12,66 +10,22 @@ import type { Permissions } from '@/types/jetstream';
|
||||
import { CreditCardIcon } from '@heroicons/vue/20/solid';
|
||||
import { isBillingActivated } from '@/utils/billing';
|
||||
import { canManageBilling } from '@/utils/permissions';
|
||||
import { api } from '@/packages/api/src';
|
||||
import { useNotificationsStore } from '@/utils/notification';
|
||||
import { getApiValidationFieldErrors, isApiValidationError } from '@/utils/apiValidation';
|
||||
|
||||
const props = defineProps<{
|
||||
team: Organization;
|
||||
permissions: Permissions;
|
||||
}>();
|
||||
|
||||
const form = reactive({
|
||||
const form = useForm({
|
||||
name: props.team.name,
|
||||
currency: props.team.currency,
|
||||
});
|
||||
|
||||
const errors = ref<Record<string, string>>({});
|
||||
const processing = ref(false);
|
||||
const recentlySuccessful = ref(false);
|
||||
const notifications = useNotificationsStore();
|
||||
let recentlySuccessfulTimeout: ReturnType<typeof setTimeout> | undefined;
|
||||
|
||||
const updateTeamName = async () => {
|
||||
processing.value = true;
|
||||
recentlySuccessful.value = false;
|
||||
errors.value = {};
|
||||
try {
|
||||
await api.updateOrganization(
|
||||
{
|
||||
name: form.name,
|
||||
currency: form.currency,
|
||||
},
|
||||
{
|
||||
params: {
|
||||
organization: props.team.id,
|
||||
},
|
||||
}
|
||||
);
|
||||
notifications.addNotification('success', 'Organization updated successfully');
|
||||
recentlySuccessful.value = true;
|
||||
if (recentlySuccessfulTimeout) {
|
||||
clearTimeout(recentlySuccessfulTimeout);
|
||||
}
|
||||
recentlySuccessfulTimeout = setTimeout(() => {
|
||||
recentlySuccessful.value = false;
|
||||
}, 2000);
|
||||
router.reload({ only: ['auth', 'team'] });
|
||||
} catch (error) {
|
||||
if (isApiValidationError(error)) {
|
||||
errors.value = getApiValidationFieldErrors(error);
|
||||
} else if (axios.isAxiosError(error)) {
|
||||
notifications.addNotification(
|
||||
'error',
|
||||
'Failed to update organization',
|
||||
error.response?.data?.message ?? 'Please try again later.'
|
||||
);
|
||||
} else {
|
||||
notifications.addNotification('error', 'Failed to update organization');
|
||||
}
|
||||
} finally {
|
||||
processing.value = false;
|
||||
}
|
||||
const updateTeamName = () => {
|
||||
form.put(route('teams.update', props.team.id), {
|
||||
errorBag: 'updateTeamName',
|
||||
preserveScroll: true,
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -120,7 +74,7 @@ const updateTeamName = async () => {
|
||||
class="block w-full"
|
||||
:disabled="!permissions.canUpdateTeam" />
|
||||
|
||||
<FieldError v-if="errors.name">{{ errors.name }}</FieldError>
|
||||
<FieldError v-if="form.errors.name">{{ form.errors.name }}</FieldError>
|
||||
</Field>
|
||||
|
||||
<!-- Currency -->
|
||||
@@ -140,14 +94,14 @@ const updateTeamName = async () => {
|
||||
{{ currencyKey }} - {{ currencyTranslated }}
|
||||
</option>
|
||||
</select>
|
||||
<FieldError v-if="errors.currency">{{ errors.currency }}</FieldError>
|
||||
<FieldError v-if="form.errors.currency">{{ form.errors.currency }}</FieldError>
|
||||
</Field>
|
||||
</template>
|
||||
|
||||
<template v-if="permissions.canUpdateTeam" #actions>
|
||||
<ActionMessage :on="recentlySuccessful" class="me-3"> Saved. </ActionMessage>
|
||||
<ActionMessage :on="form.recentlySuccessful" class="me-3"> Saved. </ActionMessage>
|
||||
|
||||
<PrimaryButton :class="{ 'opacity-25': processing }" :disabled="processing">
|
||||
<PrimaryButton :class="{ 'opacity-25': form.processing }" :disabled="form.processing">
|
||||
Save
|
||||
</PrimaryButton>
|
||||
</template>
|
||||
|
||||
@@ -4,7 +4,7 @@ import DeleteTeamForm from '@/Pages/Teams/Partials/DeleteTeamForm.vue';
|
||||
import SectionBorder from '@/Components/SectionBorder.vue';
|
||||
import UpdateTeamNameForm from '@/Pages/Teams/Partials/UpdateTeamNameForm.vue';
|
||||
import type { Organization } from '@/types/models';
|
||||
import type { Permissions } from '@/types/jetstream';
|
||||
import type { Permissions, Role } from '@/types/jetstream';
|
||||
import OrganizationBillableRate from '@/Pages/Teams/Partials/OrganizationBillableRate.vue';
|
||||
import OrganizationFormatSettings from '@/Pages/Teams/Partials/OrganizationFormatSettings.vue';
|
||||
import OrganizationTimeEntrySettings from '@/Pages/Teams/Partials/OrganizationTimeEntrySettings.vue';
|
||||
@@ -14,6 +14,7 @@ import { storeToRefs } from 'pinia';
|
||||
|
||||
defineProps<{
|
||||
team: Organization;
|
||||
availableRoles: Role[];
|
||||
permissions: Permissions;
|
||||
}>();
|
||||
|
||||
@@ -43,17 +44,17 @@ onMounted(async () => {
|
||||
<template v-else>
|
||||
<UpdateTeamNameForm :team="team" :permissions="permissions" />
|
||||
|
||||
<SectionBorder v-if="permissions.canUpdateTeam" />
|
||||
<SectionBorder />
|
||||
<OrganizationBillableRate v-if="permissions.canUpdateTeam" :team="team" />
|
||||
<SectionBorder />
|
||||
|
||||
<SectionBorder v-if="permissions.canUpdateTeam" />
|
||||
<OrganizationFormatSettings v-if="permissions.canUpdateTeam" :team="team" />
|
||||
<SectionBorder />
|
||||
|
||||
<SectionBorder v-if="permissions.canUpdateTeam" />
|
||||
<OrganizationTimeEntrySettings v-if="permissions.canUpdateTeam" />
|
||||
<SectionBorder />
|
||||
|
||||
<template v-if="permissions.canDeleteTeam">
|
||||
<SectionBorder />
|
||||
<template v-if="permissions.canDeleteTeam && !team.personal_team">
|
||||
<DeleteTeamForm class="mt-10 sm:mt-0" :team="team" />
|
||||
</template>
|
||||
</template>
|
||||
|
||||
@@ -90,12 +90,7 @@ const weekRangeDisplay = computed(() => {
|
||||
});
|
||||
|
||||
// ── Cell / row mutation handlers ──────────────────────────────────
|
||||
const { handleCellUpdate, cellStatus, cellPendingSeconds } = useTimesheetCellMutations(
|
||||
weekDays,
|
||||
timeEntries,
|
||||
rows,
|
||||
removeSlot
|
||||
);
|
||||
const { handleCellUpdate } = useTimesheetCellMutations(weekDays, timeEntries, rows, removeSlot);
|
||||
|
||||
const { handleRowIdentityChange, handleAddRow } = useTimesheetRowMutations(
|
||||
mutations,
|
||||
@@ -172,8 +167,6 @@ async function createTag(name: string): Promise<Tag | undefined> {
|
||||
:create-client="createClient"
|
||||
:create-tag="createTag"
|
||||
:format-duration="formatDuration"
|
||||
:cell-statuses="cellStatus"
|
||||
:cell-pending-seconds="cellPendingSeconds"
|
||||
@remove-row="handleRemoveRow"
|
||||
@cell-update="handleCellUpdate"
|
||||
@project-task-change="
|
||||
|
||||
@@ -114,8 +114,6 @@ export type ApiToken = ApiTokenIndexResponse['data'][0];
|
||||
|
||||
export type DetailedInvoiceResponse = ZodiosResponseByAlias<SolidTimeApi, 'getInvoice'>;
|
||||
|
||||
export type DetailedInvoice = DetailedInvoiceResponse['data'];
|
||||
|
||||
export type InvoiceIndexEntry = ZodiosResponseByAlias<SolidTimeApi, 'getInvoices'>['data'][0];
|
||||
|
||||
export type UpdateInvoiceSettings = ZodiosBodyByAlias<SolidTimeApi, 'updateInvoiceSettings'>;
|
||||
@@ -126,8 +124,6 @@ export type UpdateInvoiceBody = ZodiosBodyByAlias<SolidTimeApi, 'updateInvoice'>
|
||||
|
||||
export type User = ZodiosResponseByAlias<SolidTimeApi, 'getMe'>['data'];
|
||||
export type UpdateUserBody = ZodiosBodyByAlias<SolidTimeApi, 'updateUser'>;
|
||||
export type DeleteUserBody = ZodiosBodyByAlias<SolidTimeApi, 'deleteUser'>;
|
||||
export type DeleteOrganizationBody = ZodiosBodyByAlias<SolidTimeApi, 'deleteOrganization'>;
|
||||
|
||||
const api = createApiClient('/api', { validate: 'none' });
|
||||
|
||||
|
||||
@@ -37,7 +37,6 @@ const ClientStoreRequest = z.object({ name: z.string().min(1).max(255) }).passth
|
||||
const ClientUpdateRequest = z
|
||||
.object({ name: z.string().min(1).max(255), is_archived: z.boolean().optional() })
|
||||
.passthrough();
|
||||
const DestroyWithPasswordRequest = z.object({ password: z.string() }).passthrough();
|
||||
const ImportRequest = z.object({ type: z.string(), data: z.string() }).passthrough();
|
||||
const InvitationResource = z
|
||||
.object({ id: z.string(), email: z.string(), role: z.string() })
|
||||
@@ -331,7 +330,6 @@ const OrganizationResource = z
|
||||
const OrganizationUpdateRequest = z
|
||||
.object({
|
||||
name: z.string().max(255),
|
||||
currency: z.string(),
|
||||
billable_rate: z.union([z.number(), z.null()]),
|
||||
employees_can_see_billable_rates: z.boolean(),
|
||||
employees_can_manage_tasks: z.boolean(),
|
||||
@@ -805,39 +803,6 @@ const endpoints = makeApi([
|
||||
z.object({ code: z.string(), name: z.string(), symbol: z.string() }).passthrough()
|
||||
),
|
||||
},
|
||||
{
|
||||
method: 'post',
|
||||
path: '/v1/organizations',
|
||||
alias: 'createOrganization',
|
||||
requestFormat: 'json',
|
||||
parameters: [
|
||||
{
|
||||
name: 'body',
|
||||
type: 'Body',
|
||||
schema: z.object({ name: z.string().max(255) }).passthrough(),
|
||||
},
|
||||
],
|
||||
response: z.object({ data: OrganizationResource }).passthrough(),
|
||||
errors: [
|
||||
{
|
||||
status: 401,
|
||||
description: `Unauthenticated`,
|
||||
schema: z.object({ message: z.string() }).passthrough(),
|
||||
},
|
||||
{
|
||||
status: 403,
|
||||
description: `Authorization error`,
|
||||
schema: z.object({ message: z.string() }).passthrough(),
|
||||
},
|
||||
{
|
||||
status: 422,
|
||||
description: `Validation error`,
|
||||
schema: z
|
||||
.object({ message: z.string(), errors: z.record(z.array(z.string())) })
|
||||
.passthrough(),
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
method: 'get',
|
||||
path: '/v1/organizations/:organization',
|
||||
@@ -912,42 +877,6 @@ const endpoints = makeApi([
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
method: 'delete',
|
||||
path: '/v1/organizations/:organization',
|
||||
alias: 'deleteOrganization',
|
||||
requestFormat: 'json',
|
||||
parameters: [
|
||||
{
|
||||
name: 'body',
|
||||
type: 'Body',
|
||||
schema: DestroyWithPasswordRequest,
|
||||
},
|
||||
{
|
||||
name: 'organization',
|
||||
type: 'Path',
|
||||
schema: z.string(),
|
||||
},
|
||||
],
|
||||
response: z.void(),
|
||||
errors: [
|
||||
{
|
||||
status: 401,
|
||||
description: `Unauthenticated`,
|
||||
schema: z.object({ message: z.string() }).passthrough(),
|
||||
},
|
||||
{
|
||||
status: 403,
|
||||
description: `Authorization error`,
|
||||
schema: z.object({ message: z.string() }).passthrough(),
|
||||
},
|
||||
{
|
||||
status: 404,
|
||||
description: `Not found`,
|
||||
schema: z.object({ message: z.string() }).passthrough(),
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
method: 'get',
|
||||
path: '/v1/organizations/:organization/charts/daily-tracked-hours',
|
||||
@@ -1969,54 +1898,6 @@ const endpoints = makeApi([
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
method: 'post',
|
||||
path: '/v1/organizations/:organization/invoices/:invoice/copy',
|
||||
alias: 'copyInvoice',
|
||||
requestFormat: 'json',
|
||||
parameters: [
|
||||
{
|
||||
name: 'body',
|
||||
type: 'Body',
|
||||
schema: z.object({ reference: z.string() }).passthrough(),
|
||||
},
|
||||
{
|
||||
name: 'organization',
|
||||
type: 'Path',
|
||||
schema: z.string(),
|
||||
},
|
||||
{
|
||||
name: 'invoice',
|
||||
type: 'Path',
|
||||
schema: z.string(),
|
||||
},
|
||||
],
|
||||
response: z.object({ data: DetailedInvoiceResource }).passthrough(),
|
||||
errors: [
|
||||
{
|
||||
status: 401,
|
||||
description: `Unauthenticated`,
|
||||
schema: z.object({ message: z.string() }).passthrough(),
|
||||
},
|
||||
{
|
||||
status: 403,
|
||||
description: `Authorization error`,
|
||||
schema: z.object({ message: z.string() }).passthrough(),
|
||||
},
|
||||
{
|
||||
status: 404,
|
||||
description: `Not found`,
|
||||
schema: z.object({ message: z.string() }).passthrough(),
|
||||
},
|
||||
{
|
||||
status: 422,
|
||||
description: `Validation error`,
|
||||
schema: z
|
||||
.object({ message: z.string(), errors: z.record(z.array(z.string())) })
|
||||
.passthrough(),
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
method: 'get',
|
||||
path: '/v1/organizations/:organization/invoices/:invoice',
|
||||
@@ -4566,42 +4447,6 @@ The report is considered public if the `is_public` field is set to &#x
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
method: 'put',
|
||||
path: '/v1/users/me/current-organization',
|
||||
alias: 'updateMyCurrentOrganization',
|
||||
description: `Switches the organization that the user is currently working in. The user
|
||||
must be a member of the given organization. This endpoint is independent of
|
||||
the organization.`,
|
||||
requestFormat: 'json',
|
||||
parameters: [
|
||||
{
|
||||
name: 'body',
|
||||
type: 'Body',
|
||||
schema: z.object({ organization_id: z.string().uuid() }).passthrough(),
|
||||
},
|
||||
],
|
||||
response: z.object({ data: UserResource }).passthrough(),
|
||||
errors: [
|
||||
{
|
||||
status: 401,
|
||||
description: `Unauthenticated`,
|
||||
schema: z.object({ message: z.string() }).passthrough(),
|
||||
},
|
||||
{
|
||||
status: 403,
|
||||
description: `Authorization error`,
|
||||
schema: z.object({ message: z.string() }).passthrough(),
|
||||
},
|
||||
{
|
||||
status: 422,
|
||||
description: `Validation error`,
|
||||
schema: z
|
||||
.object({ message: z.string(), errors: z.record(z.array(z.string())) })
|
||||
.passthrough(),
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
method: 'put',
|
||||
path: '/v1/users/:user',
|
||||
@@ -4648,11 +4493,6 @@ the organization.`,
|
||||
description: `This endpoint is independent of the organization.`,
|
||||
requestFormat: 'json',
|
||||
parameters: [
|
||||
{
|
||||
name: 'body',
|
||||
type: 'Body',
|
||||
schema: DestroyWithPasswordRequest,
|
||||
},
|
||||
{
|
||||
name: 'user',
|
||||
type: 'Path',
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
import type { User } from '@/types/models';
|
||||
|
||||
export interface Permissions {
|
||||
canAddTeamMembers: boolean;
|
||||
canDeleteTeam: boolean;
|
||||
canRemoveTeamMembers: boolean;
|
||||
canUpdateTeam: boolean;
|
||||
canUpdateTeamMembers: boolean;
|
||||
}
|
||||
|
||||
export interface Session {
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
import axios, { type AxiosError } from 'axios';
|
||||
|
||||
type ApiValidationResponse = {
|
||||
message?: string;
|
||||
errors?: Record<string, string[]>;
|
||||
};
|
||||
|
||||
export function isApiValidationError(error: unknown): error is AxiosError<ApiValidationResponse> {
|
||||
return axios.isAxiosError<ApiValidationResponse>(error) && error.response?.status === 422;
|
||||
}
|
||||
|
||||
export function getApiValidationFieldErrors(error: unknown): Record<string, string> {
|
||||
if (!isApiValidationError(error)) {
|
||||
return {};
|
||||
}
|
||||
|
||||
const fieldErrors: Record<string, string> = {};
|
||||
for (const [field, messages] of Object.entries(error.response?.data?.errors ?? {})) {
|
||||
if (Array.isArray(messages) && messages[0]) {
|
||||
fieldErrors[field] = messages[0];
|
||||
}
|
||||
}
|
||||
return fieldErrors;
|
||||
}
|
||||
|
||||
export function getApiValidationMessage(error: unknown, fallback: string): string {
|
||||
if (!isApiValidationError(error)) {
|
||||
return fallback;
|
||||
}
|
||||
return error.response?.data?.message ?? fallback;
|
||||
}
|
||||
@@ -210,7 +210,7 @@ export function createNavigationCommands(
|
||||
icon: Cog6ToothIcon,
|
||||
keywords: ['settings', 'organization', 'configuration'],
|
||||
group: 'navigation',
|
||||
action: () => navigate('organizations.show', { organizationId: currentTeamId() }),
|
||||
action: () => navigate('teams.show', { team: currentTeamId() }),
|
||||
permission: permissions.canUpdateOrganization,
|
||||
priority: GROUP_PRIORITIES.navigation - 3,
|
||||
},
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
|
||||
import { ref } from 'vue';
|
||||
import { createPinia, setActivePinia } from 'pinia';
|
||||
import { useTimesheetCellMutations, makeCellStatusKey } from './useTimesheetCellMutations';
|
||||
import { useTimesheetCellMutations } from './useTimesheetCellMutations';
|
||||
import { api } from '@/packages/api/src';
|
||||
import type { TimesheetRow, TimesheetCell } from '@/utils/useTimesheetGrid';
|
||||
import type { TimeEntry } from '@/packages/api/src';
|
||||
@@ -549,119 +549,3 @@ describe('useTimesheetCellMutations.handleCellUpdate', () => {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('useTimesheetCellMutations save status', () => {
|
||||
// Timer handles keep old fade-outs from clearing newer status, and
|
||||
// the same-cell saving guard prevents concurrent writes from stale rows.
|
||||
|
||||
it('does not let a stale fade-out timer clear a newer edit on the same cell', async () => {
|
||||
const { cellMutations } = setup([]);
|
||||
const row = buildEmptyRow('p-1');
|
||||
const key = makeCellStatusKey(row.key, 0);
|
||||
|
||||
await cellMutations.handleCellUpdate(row, 0, HOUR);
|
||||
expect(cellMutations.cellStatus.value[key]).toBe('saved');
|
||||
|
||||
// Re-edit the same cell partway through the first "saved" window.
|
||||
vi.advanceTimersByTime(1000);
|
||||
await cellMutations.handleCellUpdate(row, 0, 2 * HOUR);
|
||||
expect(cellMutations.cellPendingSeconds.value[key]).toBe(2 * HOUR);
|
||||
|
||||
// Advance past the FIRST timer's deadline: it must not wipe the newer state.
|
||||
vi.advanceTimersByTime(2000);
|
||||
expect(cellMutations.cellStatus.value[key]).toBe('saved');
|
||||
expect(cellMutations.cellPendingSeconds.value[key]).toBe(2 * HOUR);
|
||||
});
|
||||
|
||||
it('ignores another commit while the same cell is saving', async () => {
|
||||
const { cellMutations } = setup([]);
|
||||
const row = buildEmptyRow('p-1');
|
||||
const key = makeCellStatusKey(row.key, 0);
|
||||
|
||||
let release!: () => void;
|
||||
const gateA = new Promise<void>((res) => {
|
||||
release = () => res();
|
||||
});
|
||||
apiMocks.createTimeEntry.mockImplementationOnce(async () => {
|
||||
await gateA;
|
||||
return { data: { id: 'a' } } as never;
|
||||
});
|
||||
|
||||
const save = cellMutations.handleCellUpdate(row, 0, HOUR);
|
||||
expect(cellMutations.cellStatus.value[key]).toBe('saving');
|
||||
expect(cellMutations.cellPendingSeconds.value[key]).toBe(HOUR);
|
||||
|
||||
// The second commit would be planned from the same stale row, so it is ignored.
|
||||
await cellMutations.handleCellUpdate(row, 0, 2 * HOUR);
|
||||
expect(apiMocks.createTimeEntry).toHaveBeenCalledTimes(1);
|
||||
expect(cellMutations.cellPendingSeconds.value[key]).toBe(HOUR);
|
||||
|
||||
release();
|
||||
await save;
|
||||
expect(cellMutations.cellStatus.value[key]).toBe('saved');
|
||||
expect(cellMutations.cellPendingSeconds.value[key]).toBe(HOUR);
|
||||
});
|
||||
|
||||
it('marks error and drops the optimistic value when the save fails', async () => {
|
||||
const { cellMutations } = setup([]);
|
||||
const row = buildEmptyRow('p-1');
|
||||
const key = makeCellStatusKey(row.key, 0);
|
||||
|
||||
apiMocks.createTimeEntry.mockRejectedValueOnce(new Error('boom'));
|
||||
|
||||
await cellMutations.handleCellUpdate(row, 0, HOUR);
|
||||
|
||||
expect(cellMutations.cellStatus.value[key]).toBe('error');
|
||||
expect(cellMutations.cellPendingSeconds.value[key]).toBeUndefined();
|
||||
expect(addNotification).toHaveBeenCalledWith(
|
||||
'error',
|
||||
'Failed to update timesheet',
|
||||
expect.any(String)
|
||||
);
|
||||
});
|
||||
|
||||
it('marks error and drops the optimistic value when the day is full', async () => {
|
||||
// Block all but the last 2h, then ask for 3h → NoFreeWindowError.
|
||||
const blocker = entry('2026-04-10T00:00:00Z', '2026-04-10T22:00:00Z', { id: 'blocker' });
|
||||
const { cellMutations } = setup([blocker]);
|
||||
const row = buildEmptyRow('p-1');
|
||||
const key = makeCellStatusKey(row.key, 0);
|
||||
|
||||
await cellMutations.handleCellUpdate(row, 0, 3 * HOUR);
|
||||
|
||||
expect(cellMutations.cellStatus.value[key]).toBe('error');
|
||||
expect(cellMutations.cellPendingSeconds.value[key]).toBeUndefined();
|
||||
expect(addNotification).toHaveBeenCalledWith(
|
||||
'error',
|
||||
"This day can't fit any more work",
|
||||
expect.any(String)
|
||||
);
|
||||
});
|
||||
|
||||
it('creates no status when the committed value is unchanged', async () => {
|
||||
const cellEntry = entry('2026-04-10T09:00:00Z', '2026-04-10T10:00:00Z');
|
||||
const { cellMutations } = setup([cellEntry]);
|
||||
const row = buildRow('p-1', [cellEntry]);
|
||||
const key = makeCellStatusKey(row.key, 0);
|
||||
|
||||
await cellMutations.handleCellUpdate(row, 0, HOUR);
|
||||
|
||||
expect(cellMutations.cellStatus.value[key]).toBeUndefined();
|
||||
expect(cellMutations.cellPendingSeconds.value[key]).toBeUndefined();
|
||||
});
|
||||
|
||||
it('tracks save status independently for each cell', async () => {
|
||||
const { cellMutations } = setup([]);
|
||||
const row = buildEmptyRow('p-1');
|
||||
const mondayKey = makeCellStatusKey(row.key, 0);
|
||||
const tuesdayKey = makeCellStatusKey(row.key, 1);
|
||||
|
||||
await cellMutations.handleCellUpdate(row, 0, HOUR);
|
||||
await cellMutations.handleCellUpdate(row, 1, 2 * HOUR);
|
||||
|
||||
expect(cellMutations.cellStatus.value[mondayKey]).toBe('saved');
|
||||
expect(cellMutations.cellStatus.value[tuesdayKey]).toBe('saved');
|
||||
expect(cellMutations.cellPendingSeconds.value[mondayKey]).toBe(HOUR);
|
||||
expect(cellMutations.cellPendingSeconds.value[tuesdayKey]).toBe(2 * HOUR);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ref, type Ref } from 'vue';
|
||||
import type { Ref } from 'vue';
|
||||
import { useQueryClient } from '@tanstack/vue-query';
|
||||
import { api, type CreateTimeEntryBody, type TimeEntry } from '@/packages/api/src';
|
||||
import { formatHumanReadableDuration, getDayJsInstance } from '@/packages/ui/src/utils/time';
|
||||
@@ -19,17 +19,6 @@ import {
|
||||
type FreeWindow,
|
||||
} from './cellMath';
|
||||
|
||||
export type CellSaveStatus = 'saving' | 'saved' | 'error';
|
||||
|
||||
/** Map key for a cell's save state (row + day). */
|
||||
export function makeCellStatusKey(rowKey: TimesheetRowKey, dayIndex: number): string {
|
||||
return `${rowKey}:${dayIndex}`;
|
||||
}
|
||||
|
||||
/** How long the saved/error state stays visible before fading. */
|
||||
const SAVED_VISIBLE_MS = 2800;
|
||||
const ERROR_VISIBLE_MS = 2500;
|
||||
|
||||
/**
|
||||
* Cell-level edit dispatcher. Picks one of four strategies based on
|
||||
* the diff between current and requested totals:
|
||||
@@ -59,58 +48,15 @@ export function useTimesheetCellMutations(
|
||||
const queryClient = useQueryClient();
|
||||
const notifications = useNotificationsStore();
|
||||
|
||||
// Save status + the optimistic value shown while saving, so a saved cell
|
||||
// doesn't flicker back to its old total before the refetch lands.
|
||||
const cellStatus = ref<Record<string, CellSaveStatus>>({});
|
||||
const cellPendingSeconds = ref<Record<string, number>>({});
|
||||
const statusClearTimers: Record<string, ReturnType<typeof setTimeout>> = {};
|
||||
|
||||
function clearStatusTimer(key: string): void {
|
||||
clearTimeout(statusClearTimers[key]);
|
||||
delete statusClearTimers[key];
|
||||
}
|
||||
|
||||
function beginSaving(key: string, seconds: number): void {
|
||||
clearStatusTimer(key);
|
||||
cellPendingSeconds.value[key] = seconds;
|
||||
cellStatus.value[key] = 'saving';
|
||||
}
|
||||
|
||||
function markSaved(key: string): void {
|
||||
clearStatusTimer(key);
|
||||
cellStatus.value[key] = 'saved';
|
||||
statusClearTimers[key] = setTimeout(() => {
|
||||
delete cellStatus.value[key];
|
||||
delete cellPendingSeconds.value[key];
|
||||
delete statusClearTimers[key];
|
||||
}, SAVED_VISIBLE_MS);
|
||||
}
|
||||
|
||||
function markError(key: string): void {
|
||||
clearStatusTimer(key);
|
||||
cellStatus.value[key] = 'error';
|
||||
// Drop the optimistic value so the cell shows server truth after refetch.
|
||||
delete cellPendingSeconds.value[key];
|
||||
statusClearTimers[key] = setTimeout(() => {
|
||||
delete cellStatus.value[key];
|
||||
delete statusClearTimers[key];
|
||||
}, ERROR_VISIBLE_MS);
|
||||
}
|
||||
|
||||
async function handleCellUpdate(
|
||||
row: TimesheetRow,
|
||||
dayIndex: number,
|
||||
newTotalSeconds: number
|
||||
): Promise<void> {
|
||||
const statusKey = makeCellStatusKey(row.key, dayIndex);
|
||||
if (cellStatus.value[statusKey] === 'saving') return;
|
||||
|
||||
const cell = row.cells.get(dayIndex);
|
||||
const existingSeconds = cell?.totalSeconds ?? 0;
|
||||
if (newTotalSeconds === existingSeconds) return;
|
||||
|
||||
beginSaving(statusKey, newTotalSeconds);
|
||||
|
||||
// Capture row state before the mutation: a row that was empty
|
||||
// and shares identity with another slot collapses after the
|
||||
// first entry lands, so the entry naturally identity-routes to
|
||||
@@ -128,9 +74,7 @@ export function useTimesheetCellMutations(
|
||||
'Another row with the same project, task, billable status and tags already exists.'
|
||||
);
|
||||
}
|
||||
markSaved(statusKey);
|
||||
} catch (err) {
|
||||
markError(statusKey);
|
||||
if (err instanceof NoFreeWindowError) {
|
||||
const friendlyDuration = formatHumanReadableDuration(
|
||||
err.requiredSeconds,
|
||||
@@ -149,6 +93,7 @@ export function useTimesheetCellMutations(
|
||||
'Failed to update timesheet',
|
||||
'Please try again later.'
|
||||
);
|
||||
throw err;
|
||||
} finally {
|
||||
queryClient.invalidateQueries({ queryKey: ['timeEntries'] });
|
||||
}
|
||||
@@ -371,5 +316,5 @@ export function useTimesheetCellMutations(
|
||||
return best;
|
||||
}
|
||||
|
||||
return { handleCellUpdate, cellStatus, cellPendingSeconds };
|
||||
return { handleCellUpdate };
|
||||
}
|
||||
|
||||
@@ -2,45 +2,37 @@ import { router } from '@inertiajs/vue3';
|
||||
import { initializeStores } from '@/utils/init';
|
||||
import { defineStore } from 'pinia';
|
||||
import { computed, ref } from 'vue';
|
||||
import axios from 'axios';
|
||||
import type {
|
||||
Organization,
|
||||
OrganizationResponse,
|
||||
DeleteOrganizationBody,
|
||||
UpdateOrganizationBody,
|
||||
} from '@/packages/api/src';
|
||||
import { useNotificationsStore } from '@/utils/notification';
|
||||
import { getCurrentOrganizationId } from '@/utils/useUser';
|
||||
import { api } from '@/packages/api/src';
|
||||
|
||||
export async function switchOrganization(organizationId: string) {
|
||||
const { handleApiRequestNotifications } = useNotificationsStore();
|
||||
try {
|
||||
await handleApiRequestNotifications(
|
||||
() => api.updateMyCurrentOrganization({ organization_id: organizationId }),
|
||||
undefined,
|
||||
'Failed to switch organization'
|
||||
);
|
||||
} catch {
|
||||
// The error notification is surfaced by the request handler.
|
||||
return;
|
||||
}
|
||||
|
||||
// The current organization changed server-side. Clear Inertia's prefetch
|
||||
// cache and reload into the dashboard so the new organization context
|
||||
// (auth.user.current_team) is picked up everywhere.
|
||||
export function switchOrganization(organizationId: string) {
|
||||
// Clear Inertia's prefetch cache to prevent stale pages from the old
|
||||
// organization being served when navigating after the switch.
|
||||
router.flushAll();
|
||||
router.visit(route('dashboard'), {
|
||||
preserveState: false,
|
||||
onSuccess: () => {
|
||||
initializeStores();
|
||||
|
||||
router.put(
|
||||
route('current-team.update'),
|
||||
{
|
||||
team_id: organizationId,
|
||||
},
|
||||
});
|
||||
{
|
||||
preserveState: false,
|
||||
onSuccess: () => {
|
||||
initializeStores();
|
||||
},
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
export const useOrganizationStore = defineStore('organization', () => {
|
||||
const organizationResponse = ref<OrganizationResponse | null>(null);
|
||||
const { addNotification, handleApiRequestNotifications } = useNotificationsStore();
|
||||
const { handleApiRequestNotifications } = useNotificationsStore();
|
||||
|
||||
async function fetchOrganization() {
|
||||
const organization = getCurrentOrganizationId();
|
||||
@@ -75,42 +67,9 @@ export const useOrganizationStore = defineStore('organization', () => {
|
||||
}
|
||||
}
|
||||
|
||||
async function createOrganization(name: string): Promise<Organization | null> {
|
||||
const response = await api.createOrganization({ name });
|
||||
return response?.data ?? null;
|
||||
}
|
||||
|
||||
async function deleteOrganization(organizationId: string, body: DeleteOrganizationBody) {
|
||||
try {
|
||||
await api.deleteOrganization(body, {
|
||||
params: {
|
||||
organization: organizationId,
|
||||
},
|
||||
});
|
||||
addNotification('success', 'Organization deleted successfully');
|
||||
} catch (error) {
|
||||
if (!axios.isAxiosError(error) || error.response?.status !== 422) {
|
||||
addNotification(
|
||||
'error',
|
||||
'Failed to delete organization',
|
||||
axios.isAxiosError(error)
|
||||
? (error.response?.data?.message ?? 'Please try again later.')
|
||||
: 'Please try again later.'
|
||||
);
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
const organization = computed<Organization | null>(() => {
|
||||
return organizationResponse.value?.data || null;
|
||||
});
|
||||
|
||||
return {
|
||||
organization,
|
||||
fetchOrganization,
|
||||
updateOrganization,
|
||||
createOrganization,
|
||||
deleteOrganization,
|
||||
};
|
||||
return { organization, fetchOrganization, updateOrganization };
|
||||
});
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { useMutation, useQuery, useQueryClient } from '@tanstack/vue-query';
|
||||
import { computed } from 'vue';
|
||||
import axios from 'axios';
|
||||
import { api, type DeleteUserBody, type UpdateUserBody, type User } from '@/packages/api/src';
|
||||
import { api, type UpdateUserBody, type User } from '@/packages/api/src';
|
||||
import { useNotificationsStore } from '@/utils/notification';
|
||||
|
||||
const ME_QUERY_KEY = ['me'] as const;
|
||||
@@ -61,9 +61,9 @@ export function useDeleteUserMutation() {
|
||||
const { addNotification } = useNotificationsStore();
|
||||
|
||||
return useMutation({
|
||||
mutationFn: async ({ userId, body }: { userId: string; body: DeleteUserBody }) => {
|
||||
mutationFn: async (userId: string) => {
|
||||
try {
|
||||
await api.deleteUser(body, { params: { user: userId } });
|
||||
await api.deleteUser(undefined, { params: { user: userId } });
|
||||
} catch (error) {
|
||||
if (!axios.isAxiosError(error) || error.response?.status !== 422) {
|
||||
addNotification(
|
||||
|
||||
7
resources/js/ziggy.d.ts
vendored
7
resources/js/ziggy.d.ts
vendored
@@ -114,13 +114,6 @@ declare module 'ziggy-js' {
|
||||
'other-browser-sessions.destroy': [];
|
||||
'current-user-photo.destroy': [];
|
||||
'current-user.destroy': [];
|
||||
'organizations.create': [];
|
||||
'organizations.show': [
|
||||
{
|
||||
'name': 'organizationId';
|
||||
'required': true;
|
||||
},
|
||||
];
|
||||
'teams.create': [];
|
||||
'teams.store': [];
|
||||
'teams.show': [
|
||||
|
||||
@@ -197,12 +197,6 @@ const Ziggy = {
|
||||
'methods': ['DELETE'],
|
||||
},
|
||||
'current-user.destroy': { 'uri': 'user', 'methods': ['DELETE'] },
|
||||
'organizations.create': { 'uri': 'organizations/create', 'methods': ['GET', 'HEAD'] },
|
||||
'organizations.show': {
|
||||
'uri': 'organizations/{organizationId}',
|
||||
'methods': ['GET', 'HEAD'],
|
||||
'parameters': ['organizationId'],
|
||||
},
|
||||
'teams.create': { 'uri': 'teams/create', 'methods': ['GET', 'HEAD'] },
|
||||
'teams.store': { 'uri': 'teams', 'methods': ['POST'] },
|
||||
'teams.show': {
|
||||
|
||||
@@ -2,14 +2,13 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use App\Enums\Role;
|
||||
use App\Http\Controllers\Web\DashboardController;
|
||||
use App\Http\Controllers\Web\HomeController;
|
||||
use App\Http\Controllers\Web\OrganizationController;
|
||||
use App\Http\Controllers\Web\OrganizationInvitationController;
|
||||
use App\Http\Controllers\Web\OtherBrowserSessionsController;
|
||||
use App\Http\Controllers\Web\UserController;
|
||||
use App\Http\Controllers\Web\UserProfileController;
|
||||
use App\Service\PermissionStore;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Inertia\Inertia;
|
||||
@@ -33,7 +32,6 @@ Route::get('/shared-report', function () {
|
||||
|
||||
Route::middleware([
|
||||
'auth:web',
|
||||
'auth.session',
|
||||
'verified',
|
||||
])->group(function (): void {
|
||||
Route::get('/dashboard', [DashboardController::class, 'dashboard'])->name('dashboard');
|
||||
@@ -76,14 +74,7 @@ Route::middleware([
|
||||
|
||||
Route::get('/members', function () {
|
||||
return Inertia::render('Members', [
|
||||
'availableRoles' => collect(PermissionStore::roleDefinitions())
|
||||
->map(fn (array $definition, string $key): array => [
|
||||
'key' => $key,
|
||||
'name' => $definition['name'],
|
||||
'description' => $definition['description'],
|
||||
])
|
||||
->values()
|
||||
->all(),
|
||||
'availableRoles' => Role::values(),
|
||||
]);
|
||||
})->name('members');
|
||||
|
||||
@@ -104,8 +95,6 @@ Route::middleware([
|
||||
return to_route('organizations.show', [$organizationId]);
|
||||
})->name('teams.show');
|
||||
Route::get('/user/profile', [UserProfileController::class, 'show'])->name('profile.show');
|
||||
Route::delete('/user/other-browser-sessions', [OtherBrowserSessionsController::class, 'destroy'])
|
||||
->name('other-browser-sessions.destroy');
|
||||
});
|
||||
|
||||
Route::get('/team-invitations/{invitation}', [OrganizationInvitationController::class, 'accept'])
|
||||
|
||||
25
tests/Feature/BrowserSessionsTest.php
Normal file
25
tests/Feature/BrowserSessionsTest.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
|
||||
class BrowserSessionsTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
public function test_other_browser_sessions_can_be_logged_out(): void
|
||||
{
|
||||
$this->actingAs($user = User::factory()->create());
|
||||
|
||||
$response = $this->delete('/user/other-browser-sessions', [
|
||||
'password' => 'password',
|
||||
]);
|
||||
|
||||
$response->assertSessionHasNoErrors();
|
||||
}
|
||||
}
|
||||
@@ -5,9 +5,12 @@ declare(strict_types=1);
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Enums\Weekday;
|
||||
use App\Mail\VerifyUpdatedEmailMail;
|
||||
use App\Models\User;
|
||||
use App\Service\TimezoneService;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use Illuminate\Support\Facades\URL;
|
||||
use Tests\TestCase;
|
||||
|
||||
class ProfileInformationTest extends TestCase
|
||||
@@ -36,4 +39,66 @@ class ProfileInformationTest extends TestCase
|
||||
$user = $user->fresh();
|
||||
$this->assertEquals($user->name, $user->name);
|
||||
}
|
||||
|
||||
public function test_pending_email_verification_redirects_with_danger_banner_when_email_already_in_use(): void
|
||||
{
|
||||
// Arrange
|
||||
User::factory()->create([
|
||||
'email' => 'taken@example.com',
|
||||
'is_placeholder' => false,
|
||||
]);
|
||||
$user = User::factory()->create([
|
||||
'email' => 'current@example.com',
|
||||
'pending_email' => 'taken@example.com',
|
||||
]);
|
||||
$this->actingAs($user);
|
||||
$verificationUrl = URL::temporarySignedRoute(
|
||||
'users.verify-email-change',
|
||||
now()->addMinutes(60),
|
||||
[
|
||||
'user' => $user->getKey(),
|
||||
'email' => 'taken@example.com',
|
||||
],
|
||||
false
|
||||
);
|
||||
|
||||
// Act
|
||||
$response = $this->get($verificationUrl);
|
||||
|
||||
// Assert
|
||||
$response->assertRedirect(route('dashboard'));
|
||||
$response->assertSessionHas('bannerStyle', 'danger');
|
||||
$response->assertSessionHas('bannerText', 'The email address is already in use.');
|
||||
$user = $user->fresh();
|
||||
$this->assertEquals('current@example.com', $user->email);
|
||||
$this->assertEquals('taken@example.com', $user->pending_email);
|
||||
}
|
||||
|
||||
public function test_stale_pending_email_verification_link_is_rejected(): void
|
||||
{
|
||||
// Arrange
|
||||
$user = User::factory()->create([
|
||||
'email' => 'current@example.com',
|
||||
'pending_email' => 'newer@example.com',
|
||||
]);
|
||||
$this->actingAs($user);
|
||||
$verificationUrl = URL::temporarySignedRoute(
|
||||
'users.verify-email-change',
|
||||
now()->addMinutes(60),
|
||||
[
|
||||
'user' => $user->getKey(),
|
||||
'email' => 'older@example.com',
|
||||
],
|
||||
false
|
||||
);
|
||||
|
||||
// Act
|
||||
$response = $this->get($verificationUrl);
|
||||
|
||||
// Assert
|
||||
$response->assertForbidden();
|
||||
$user = $user->fresh();
|
||||
$this->assertEquals('current@example.com', $user->email);
|
||||
$this->assertEquals('newer@example.com', $user->pending_email);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,7 +61,6 @@ class RegistrationTest extends TestCaseWithDatabase
|
||||
$member = Member::query()->whereBelongsTo($user, 'user')->whereBelongsTo($organization, 'organization')->firstOrFail();
|
||||
$this->assertSame(Role::Owner->value, $member->role);
|
||||
Event::assertNotDispatched(NewsletterRegistered::class);
|
||||
$this->assertSame($organization->getKey(), $user->current_team_id);
|
||||
}
|
||||
|
||||
public function test_user_registration_fails_if_registration_is_deactivated(): void
|
||||
|
||||
@@ -382,58 +382,6 @@ class OrganizationEndpointTest extends ApiEndpointTestAbstract
|
||||
]);
|
||||
}
|
||||
|
||||
public function test_update_endpoint_can_update_the_currency_of_the_organization(): void
|
||||
{
|
||||
// Arrange
|
||||
$data = $this->createUserWithPermission([
|
||||
'organizations:update',
|
||||
]);
|
||||
$this->assertBillableRateServiceIsUnused();
|
||||
$data->organization->currency = 'EUR';
|
||||
$data->organization->save();
|
||||
Passport::actingAs($data->user);
|
||||
|
||||
// Act
|
||||
$response = $this->putJson(route('api.v1.organizations.update', [$data->organization->getKey()]), [
|
||||
'name' => $data->organization->name,
|
||||
'currency' => 'USD',
|
||||
]);
|
||||
|
||||
// Assert
|
||||
$response->assertStatus(200);
|
||||
$response->assertJsonPath('data.currency', 'USD');
|
||||
$this->assertDatabaseHas(Organization::class, [
|
||||
'id' => $data->organization->getKey(),
|
||||
'currency' => 'USD',
|
||||
]);
|
||||
}
|
||||
|
||||
public function test_update_endpoint_fails_if_currency_is_invalid(): void
|
||||
{
|
||||
// Arrange
|
||||
$data = $this->createUserWithPermission([
|
||||
'organizations:update',
|
||||
]);
|
||||
$this->assertBillableRateServiceIsUnused();
|
||||
$data->organization->currency = 'EUR';
|
||||
$data->organization->save();
|
||||
Passport::actingAs($data->user);
|
||||
|
||||
// Act
|
||||
$response = $this->putJson(route('api.v1.organizations.update', [$data->organization->getKey()]), [
|
||||
'name' => $data->organization->name,
|
||||
'currency' => 'NOT_A_CURRENCY',
|
||||
]);
|
||||
|
||||
// Assert
|
||||
$response->assertStatus(422);
|
||||
$response->assertJsonValidationErrors(['currency']);
|
||||
$this->assertDatabaseHas(Organization::class, [
|
||||
'id' => $data->organization->getKey(),
|
||||
'currency' => 'EUR',
|
||||
]);
|
||||
}
|
||||
|
||||
public function test_delete_endpoint_if_user_does_not_have_permission(): void
|
||||
{
|
||||
// Arrange
|
||||
@@ -441,9 +389,7 @@ class OrganizationEndpointTest extends ApiEndpointTestAbstract
|
||||
Passport::actingAs($data->user);
|
||||
|
||||
// Act
|
||||
$response = $this->deleteJson(route('api.v1.organizations.destroy', [$data->organization->getKey()]), [
|
||||
'password' => 'password',
|
||||
]);
|
||||
$response = $this->deleteJson(route('api.v1.organizations.destroy', [$data->organization->getKey()]));
|
||||
|
||||
// Assert
|
||||
$response->assertForbidden();
|
||||
@@ -458,54 +404,12 @@ class OrganizationEndpointTest extends ApiEndpointTestAbstract
|
||||
Passport::actingAs($data->user);
|
||||
|
||||
// Act
|
||||
$response = $this->deleteJson(route('api.v1.organizations.destroy', ['not-uuid']), [
|
||||
'password' => 'password',
|
||||
]);
|
||||
$response = $this->deleteJson(route('api.v1.organizations.destroy', ['not-uuid']));
|
||||
|
||||
// Assert
|
||||
$response->assertNotFound();
|
||||
}
|
||||
|
||||
public function test_delete_endpoint_fails_without_password(): void
|
||||
{
|
||||
// Arrange
|
||||
$data = $this->createUserWithPermission([
|
||||
'organizations:delete',
|
||||
]);
|
||||
Passport::actingAs($data->user);
|
||||
|
||||
// Act
|
||||
$response = $this->deleteJson(route('api.v1.organizations.destroy', [$data->organization->getKey()]));
|
||||
|
||||
// Assert
|
||||
$response->assertUnprocessable();
|
||||
$response->assertJsonValidationErrors(['password']);
|
||||
$this->assertDatabaseHas(Organization::class, [
|
||||
'id' => $data->organization->getKey(),
|
||||
]);
|
||||
}
|
||||
|
||||
public function test_delete_endpoint_fails_with_wrong_password(): void
|
||||
{
|
||||
// Arrange
|
||||
$data = $this->createUserWithPermission([
|
||||
'organizations:delete',
|
||||
]);
|
||||
Passport::actingAs($data->user);
|
||||
|
||||
// Act
|
||||
$response = $this->deleteJson(route('api.v1.organizations.destroy', [$data->organization->getKey()]), [
|
||||
'password' => 'wrong-password',
|
||||
]);
|
||||
|
||||
// Assert
|
||||
$response->assertUnprocessable();
|
||||
$response->assertJsonValidationErrors(['password']);
|
||||
$this->assertDatabaseHas(Organization::class, [
|
||||
'id' => $data->organization->getKey(),
|
||||
]);
|
||||
}
|
||||
|
||||
public function test_delete_endpoint_can_delete_organization(): void
|
||||
{
|
||||
// Arrange
|
||||
@@ -516,9 +420,7 @@ class OrganizationEndpointTest extends ApiEndpointTestAbstract
|
||||
Passport::actingAs($data->user);
|
||||
|
||||
// Act
|
||||
$response = $this->deleteJson(route('api.v1.organizations.destroy', [$data->organization->getKey()]), [
|
||||
'password' => 'password',
|
||||
]);
|
||||
$response = $this->deleteJson(route('api.v1.organizations.destroy', [$data->organization->getKey()]));
|
||||
|
||||
// Assert
|
||||
$response->assertNoContent();
|
||||
|
||||
@@ -649,9 +649,7 @@ class UserEndpointTest extends ApiEndpointTestAbstract
|
||||
Passport::actingAs($otherData->user);
|
||||
|
||||
// Act
|
||||
$response = $this->deleteJson(route('api.v1.users.destroy', $data->user->getKey()), [
|
||||
'password' => 'password',
|
||||
]);
|
||||
$response = $this->deleteJson(route('api.v1.users.destroy', $data->user->getKey()));
|
||||
|
||||
// Assert
|
||||
$response->assertForbidden();
|
||||
@@ -676,46 +674,12 @@ class UserEndpointTest extends ApiEndpointTestAbstract
|
||||
Passport::actingAs($data->user);
|
||||
|
||||
// Act
|
||||
$response = $this->deleteJson(route('api.v1.users.destroy', 'not-valid'), [
|
||||
'password' => 'password',
|
||||
]);
|
||||
$response = $this->deleteJson(route('api.v1.users.destroy', 'not-valid'));
|
||||
|
||||
// Assert
|
||||
$response->assertNotFound();
|
||||
}
|
||||
|
||||
public function test_delete_fails_without_password(): void
|
||||
{
|
||||
// Arrange
|
||||
$data = $this->createUserWithPermission();
|
||||
Passport::actingAs($data->user);
|
||||
|
||||
// Act
|
||||
$response = $this->deleteJson(route('api.v1.users.destroy', $data->user->getKey()));
|
||||
|
||||
// Assert
|
||||
$response->assertUnprocessable();
|
||||
$response->assertJsonValidationErrors(['password']);
|
||||
$this->assertDatabaseHas(User::class, ['id' => $data->user->getKey()]);
|
||||
}
|
||||
|
||||
public function test_delete_fails_with_wrong_password(): void
|
||||
{
|
||||
// Arrange
|
||||
$data = $this->createUserWithPermission();
|
||||
Passport::actingAs($data->user);
|
||||
|
||||
// Act
|
||||
$response = $this->deleteJson(route('api.v1.users.destroy', $data->user->getKey()), [
|
||||
'password' => 'wrong-password',
|
||||
]);
|
||||
|
||||
// Assert
|
||||
$response->assertUnprocessable();
|
||||
$response->assertJsonValidationErrors(['password']);
|
||||
$this->assertDatabaseHas(User::class, ['id' => $data->user->getKey()]);
|
||||
}
|
||||
|
||||
public function test_delete_removes_user(): void
|
||||
{
|
||||
// Arrange
|
||||
@@ -723,9 +687,7 @@ class UserEndpointTest extends ApiEndpointTestAbstract
|
||||
Passport::actingAs($data->user);
|
||||
|
||||
// Act
|
||||
$response = $this->deleteJson(route('api.v1.users.destroy', $data->user->getKey()), [
|
||||
'password' => 'password',
|
||||
]);
|
||||
$response = $this->deleteJson(route('api.v1.users.destroy', $data->user->getKey()));
|
||||
|
||||
// Assert
|
||||
$response->assertNoContent();
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\Unit\Endpoint\Web;
|
||||
|
||||
use Inertia\Testing\AssertableInertia as Assert;
|
||||
|
||||
class MembersEndpointTest extends EndpointTestAbstract
|
||||
{
|
||||
public function test_members_passes_available_roles_as_objects_with_key_name_and_description(): void
|
||||
{
|
||||
// Arrange
|
||||
$data = $this->createUserWithPermission([
|
||||
'members:view',
|
||||
]);
|
||||
$this->actingAs($data->user);
|
||||
|
||||
// Act
|
||||
$response = $this->get(route('members'));
|
||||
|
||||
// Assert
|
||||
$response->assertOk();
|
||||
$response->assertInertia(fn (Assert $page) => $page
|
||||
->component('Members')
|
||||
->has('availableRoles', 5, fn (Assert $role) => $role
|
||||
->has('key')
|
||||
->has('name')
|
||||
->has('description')
|
||||
)
|
||||
->where('availableRoles.0.key', 'owner')
|
||||
->where('availableRoles.0.name', 'Owner')
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -4,14 +4,12 @@ declare(strict_types=1);
|
||||
|
||||
namespace Tests\Unit\Endpoint\Web;
|
||||
|
||||
use App\Enums\Role;
|
||||
use App\Http\Controllers\Web\OrganizationController;
|
||||
use App\Models\Organization;
|
||||
use App\Models\OrganizationInvitation;
|
||||
use App\Models\User;
|
||||
use Inertia\Testing\AssertableInertia as Assert;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
use PHPUnit\Framework\Attributes\DataProvider;
|
||||
|
||||
#[CoversClass(OrganizationController::class)]
|
||||
class OrganizationEndpointTest extends EndpointTestAbstract
|
||||
@@ -67,37 +65,14 @@ class OrganizationEndpointTest extends EndpointTestAbstract
|
||||
->where('team.owner.name', $data->owner->name)
|
||||
->has('team.owner.profile_photo_url')
|
||||
->has('currencies')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, array{role: Role, canUpdateTeam: bool, canDeleteTeam: bool}>
|
||||
*/
|
||||
public static function showPermissionsPerRoleProvider(): array
|
||||
{
|
||||
return [
|
||||
'owner can update and delete' => ['role' => Role::Owner, 'canUpdateTeam' => true, 'canDeleteTeam' => true],
|
||||
'admin can update but not delete' => ['role' => Role::Admin, 'canUpdateTeam' => true, 'canDeleteTeam' => false],
|
||||
'employee can neither update nor delete' => ['role' => Role::Employee, 'canUpdateTeam' => false, 'canDeleteTeam' => false],
|
||||
];
|
||||
}
|
||||
|
||||
#[DataProvider('showPermissionsPerRoleProvider')]
|
||||
public function test_organization_show_returns_permissions_based_on_role(Role $role, bool $canUpdateTeam, bool $canDeleteTeam): void
|
||||
{
|
||||
// Arrange
|
||||
$data = $this->createUserWithRole($role);
|
||||
$this->actingAs($data->user);
|
||||
|
||||
// Act
|
||||
$response = $this->get(route('organizations.show', [$data->organization->getKey()]));
|
||||
|
||||
// Assert
|
||||
$response->assertOk();
|
||||
$response->assertInertia(fn (Assert $page) => $page
|
||||
->component('Teams/Show')
|
||||
->where('permissions.canUpdateTeam', $canUpdateTeam)
|
||||
->where('permissions.canDeleteTeam', $canDeleteTeam)
|
||||
->where('availableRoles', [])
|
||||
->where('availablePermissions', [])
|
||||
->where('defaultPermissions', [])
|
||||
->where('permissions.canAddTeamMembers', true)
|
||||
->where('permissions.canDeleteTeam', true)
|
||||
->where('permissions.canRemoveTeamMembers', true)
|
||||
->where('permissions.canUpdateTeam', true)
|
||||
->where('permissions.canUpdateTeamMembers', true)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,103 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\Unit\Endpoint\Web;
|
||||
|
||||
use App\Http\Controllers\Web\OtherBrowserSessionsController;
|
||||
use App\Models\User;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
|
||||
#[CoversClass(OtherBrowserSessionsController::class)]
|
||||
class OtherBrowserSessionsEndpointTest extends EndpointTestAbstract
|
||||
{
|
||||
public function test_destroy_logs_out_other_browser_sessions_with_the_correct_password(): void
|
||||
{
|
||||
// Arrange
|
||||
$user = User::factory()->create();
|
||||
$originalPasswordHash = $user->password;
|
||||
$this->actingAs($user);
|
||||
|
||||
// Act
|
||||
$response = $this->delete('/user/other-browser-sessions', [
|
||||
'password' => 'password',
|
||||
]);
|
||||
|
||||
// Assert
|
||||
$response->assertRedirect();
|
||||
$response->assertSessionHasNoErrors();
|
||||
// logoutOtherDevices re-hashes the password (same plaintext, new hash) to invalidate other sessions.
|
||||
$this->assertNotSame($originalPasswordHash, $user->fresh()->password);
|
||||
$this->assertTrue(Hash::check('password', $user->fresh()->password));
|
||||
}
|
||||
|
||||
public function test_destroy_fails_with_an_incorrect_password(): void
|
||||
{
|
||||
// Arrange
|
||||
$user = User::factory()->create();
|
||||
$originalPasswordHash = $user->password;
|
||||
$this->actingAs($user);
|
||||
|
||||
// Act
|
||||
$response = $this->delete('/user/other-browser-sessions', [
|
||||
'password' => 'wrong-password',
|
||||
]);
|
||||
|
||||
// Assert
|
||||
$response->assertSessionHasErrors('password');
|
||||
// No side effects when the password is incorrect: the password must not be re-hashed.
|
||||
$this->assertSame($originalPasswordHash, $user->fresh()->password);
|
||||
}
|
||||
|
||||
public function test_destroy_requires_authentication(): void
|
||||
{
|
||||
// Act
|
||||
$response = $this->delete('/user/other-browser-sessions', [
|
||||
'password' => 'password',
|
||||
]);
|
||||
|
||||
// Assert
|
||||
$response->assertRedirect(route('login'));
|
||||
}
|
||||
|
||||
public function test_destroy_deletes_the_other_database_session_records_of_the_current_user(): void
|
||||
{
|
||||
// Arrange
|
||||
config(['session.driver' => 'database']);
|
||||
$user = User::factory()->create();
|
||||
$otherUser = User::factory()->create();
|
||||
$this->actingAs($user);
|
||||
|
||||
DB::table('sessions')->insert([
|
||||
[
|
||||
'id' => 'other-session-of-current-user',
|
||||
'user_id' => $user->getKey(),
|
||||
'ip_address' => '192.0.2.10',
|
||||
'user_agent' => '',
|
||||
'payload' => '',
|
||||
'last_activity' => now()->subMinutes(5)->timestamp,
|
||||
],
|
||||
[
|
||||
'id' => 'session-of-another-user',
|
||||
'user_id' => $otherUser->getKey(),
|
||||
'ip_address' => '192.0.2.30',
|
||||
'user_agent' => '',
|
||||
'payload' => '',
|
||||
'last_activity' => now()->timestamp,
|
||||
],
|
||||
]);
|
||||
|
||||
// Act
|
||||
$response = $this->delete('/user/other-browser-sessions', [
|
||||
'password' => 'password',
|
||||
]);
|
||||
|
||||
// Assert
|
||||
$response->assertSessionHasNoErrors();
|
||||
// The current user's other sessions are removed, while another user's session is untouched.
|
||||
$this->assertDatabaseMissing('sessions', ['id' => 'other-session-of-current-user']);
|
||||
$this->assertDatabaseHas('sessions', ['id' => 'session-of-another-user']);
|
||||
}
|
||||
}
|
||||
@@ -1,253 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\Unit\Endpoint\Web;
|
||||
|
||||
use App\Http\Controllers\Web\UserController;
|
||||
use App\Models\User;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\Facades\URL;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
|
||||
#[CoversClass(UserController::class)]
|
||||
class UserEndpointTest extends EndpointTestAbstract
|
||||
{
|
||||
public function test_pending_email_verification_updates_email_and_redirects_with_success_banner(): void
|
||||
{
|
||||
// Arrange
|
||||
$this->travelTo(Carbon::parse('2024-01-02 12:00:00', 'UTC'));
|
||||
$user = User::factory()->create([
|
||||
'email' => 'current@example.com',
|
||||
'pending_email' => 'new@example.com',
|
||||
'email_verified_at' => null,
|
||||
]);
|
||||
$this->actingAs($user);
|
||||
$verificationUrl = URL::temporarySignedRoute(
|
||||
'users.verify-email-change',
|
||||
now()->addMinutes(60),
|
||||
[
|
||||
'user' => $user->getKey(),
|
||||
'email' => 'NEW@EXAMPLE.COM',
|
||||
],
|
||||
false
|
||||
);
|
||||
|
||||
// Act
|
||||
$response = $this->get($verificationUrl);
|
||||
|
||||
// Assert
|
||||
$response->assertRedirect(route('dashboard'));
|
||||
$response->assertSessionHas('bannerStyle', 'success');
|
||||
$response->assertSessionHas('bannerText', 'Your email address has been updated successfully.');
|
||||
$user->refresh();
|
||||
$this->assertSame('new@example.com', $user->email);
|
||||
$this->assertNull($user->pending_email);
|
||||
$this->assertTrue(now()->equalTo($user->email_verified_at));
|
||||
}
|
||||
|
||||
public function test_pending_email_verification_is_rejected_for_another_authenticated_user(): void
|
||||
{
|
||||
// Arrange
|
||||
$user = User::factory()->create([
|
||||
'email' => 'current@example.com',
|
||||
'pending_email' => 'new@example.com',
|
||||
]);
|
||||
$this->actingAs(User::factory()->create());
|
||||
$verificationUrl = URL::temporarySignedRoute(
|
||||
'users.verify-email-change',
|
||||
now()->addMinutes(60),
|
||||
[
|
||||
'user' => $user->getKey(),
|
||||
'email' => 'new@example.com',
|
||||
],
|
||||
false
|
||||
);
|
||||
|
||||
// Act
|
||||
$response = $this->get($verificationUrl);
|
||||
|
||||
// Assert
|
||||
$response->assertForbidden();
|
||||
$user->refresh();
|
||||
$this->assertSame('current@example.com', $user->email);
|
||||
$this->assertSame('new@example.com', $user->pending_email);
|
||||
}
|
||||
|
||||
public function test_pending_email_verification_without_email_is_rejected(): void
|
||||
{
|
||||
// Arrange
|
||||
$user = User::factory()->create([
|
||||
'email' => 'current@example.com',
|
||||
'pending_email' => 'new@example.com',
|
||||
]);
|
||||
$this->actingAs($user);
|
||||
$verificationUrl = URL::temporarySignedRoute(
|
||||
'users.verify-email-change',
|
||||
now()->addMinutes(60),
|
||||
['user' => $user->getKey()],
|
||||
false
|
||||
);
|
||||
|
||||
// Act
|
||||
$response = $this->get($verificationUrl);
|
||||
|
||||
// Assert
|
||||
$response->assertForbidden();
|
||||
$user->refresh();
|
||||
$this->assertSame('current@example.com', $user->email);
|
||||
$this->assertSame('new@example.com', $user->pending_email);
|
||||
}
|
||||
|
||||
public function test_pending_email_verification_with_non_string_email_is_rejected(): void
|
||||
{
|
||||
// Arrange
|
||||
$user = User::factory()->create([
|
||||
'email' => 'current@example.com',
|
||||
'pending_email' => 'new@example.com',
|
||||
]);
|
||||
$this->actingAs($user);
|
||||
$verificationUrl = URL::temporarySignedRoute(
|
||||
'users.verify-email-change',
|
||||
now()->addMinutes(60),
|
||||
[
|
||||
'user' => $user->getKey(),
|
||||
'email' => ['new@example.com'],
|
||||
],
|
||||
false
|
||||
);
|
||||
|
||||
// Act
|
||||
$response = $this->get($verificationUrl);
|
||||
|
||||
// Assert
|
||||
$response->assertForbidden();
|
||||
$user->refresh();
|
||||
$this->assertSame('current@example.com', $user->email);
|
||||
$this->assertSame('new@example.com', $user->pending_email);
|
||||
}
|
||||
|
||||
public function test_stale_pending_email_verification_link_is_rejected(): void
|
||||
{
|
||||
// Arrange
|
||||
$user = User::factory()->create([
|
||||
'email' => 'current@example.com',
|
||||
'pending_email' => 'newer@example.com',
|
||||
]);
|
||||
$this->actingAs($user);
|
||||
$verificationUrl = URL::temporarySignedRoute(
|
||||
'users.verify-email-change',
|
||||
now()->addMinutes(60),
|
||||
[
|
||||
'user' => $user->getKey(),
|
||||
'email' => 'older@example.com',
|
||||
],
|
||||
false
|
||||
);
|
||||
|
||||
// Act
|
||||
$response = $this->get($verificationUrl);
|
||||
|
||||
// Assert
|
||||
$response->assertForbidden();
|
||||
$user->refresh();
|
||||
$this->assertSame('current@example.com', $user->email);
|
||||
$this->assertSame('newer@example.com', $user->pending_email);
|
||||
}
|
||||
|
||||
public function test_pending_email_verification_redirects_with_danger_banner_when_email_already_in_use(): void
|
||||
{
|
||||
// Arrange
|
||||
User::factory()->create([
|
||||
'email' => 'taken@example.com',
|
||||
'is_placeholder' => false,
|
||||
]);
|
||||
$user = User::factory()->create([
|
||||
'email' => 'current@example.com',
|
||||
'pending_email' => 'taken@example.com',
|
||||
]);
|
||||
$this->actingAs($user);
|
||||
$verificationUrl = URL::temporarySignedRoute(
|
||||
'users.verify-email-change',
|
||||
now()->addMinutes(60),
|
||||
[
|
||||
'user' => $user->getKey(),
|
||||
'email' => 'taken@example.com',
|
||||
],
|
||||
false
|
||||
);
|
||||
|
||||
// Act
|
||||
$response = $this->get($verificationUrl);
|
||||
|
||||
// Assert
|
||||
$response->assertRedirect(route('dashboard'));
|
||||
$response->assertSessionHas('bannerStyle', 'danger');
|
||||
$response->assertSessionHas('bannerText', 'The email address is already in use.');
|
||||
$user->refresh();
|
||||
$this->assertSame('current@example.com', $user->email);
|
||||
$this->assertSame('taken@example.com', $user->pending_email);
|
||||
}
|
||||
|
||||
public function test_pending_email_verification_ignores_placeholder_users_with_the_same_email(): void
|
||||
{
|
||||
// Arrange
|
||||
User::factory()->placeholder()->create([
|
||||
'email' => 'new@example.com',
|
||||
]);
|
||||
$user = User::factory()->create([
|
||||
'email' => 'current@example.com',
|
||||
'pending_email' => 'new@example.com',
|
||||
'email_verified_at' => null,
|
||||
]);
|
||||
$this->actingAs($user);
|
||||
$verificationUrl = URL::temporarySignedRoute(
|
||||
'users.verify-email-change',
|
||||
now()->addMinutes(60),
|
||||
[
|
||||
'user' => $user->getKey(),
|
||||
'email' => 'new@example.com',
|
||||
],
|
||||
false
|
||||
);
|
||||
|
||||
// Act
|
||||
$response = $this->get($verificationUrl);
|
||||
|
||||
// Assert
|
||||
$response->assertRedirect(route('dashboard'));
|
||||
$response->assertSessionHas('bannerStyle', 'success');
|
||||
$user->refresh();
|
||||
$this->assertSame('new@example.com', $user->email);
|
||||
$this->assertNull($user->pending_email);
|
||||
$this->assertNotNull($user->email_verified_at);
|
||||
}
|
||||
|
||||
public function test_pending_email_verification_with_invalid_signature_is_rejected(): void
|
||||
{
|
||||
// Arrange
|
||||
$user = User::factory()->create([
|
||||
'email' => 'current@example.com',
|
||||
'pending_email' => 'new@example.com',
|
||||
]);
|
||||
$this->actingAs($user);
|
||||
$verificationUrl = URL::temporarySignedRoute(
|
||||
'users.verify-email-change',
|
||||
now()->addMinutes(60),
|
||||
[
|
||||
'user' => $user->getKey(),
|
||||
'email' => 'new@example.com',
|
||||
],
|
||||
false
|
||||
);
|
||||
|
||||
// Act
|
||||
$response = $this->get($verificationUrl.'&invalid');
|
||||
|
||||
// Assert
|
||||
$response->assertForbidden();
|
||||
$user->refresh();
|
||||
$this->assertSame('current@example.com', $user->email);
|
||||
$this->assertSame('new@example.com', $user->pending_email);
|
||||
}
|
||||
}
|
||||
@@ -4,17 +4,12 @@ declare(strict_types=1);
|
||||
|
||||
namespace Tests\Unit\Filament\Resources;
|
||||
|
||||
use App\Enums\Role;
|
||||
use App\Events\OrganizationInvitationAdding;
|
||||
use App\Filament\Resources\OrganizationResource;
|
||||
use App\Mail\OrganizationInvitationMail;
|
||||
use App\Models\Organization;
|
||||
use App\Models\OrganizationInvitation;
|
||||
use App\Models\User;
|
||||
use App\Service\DeletionService;
|
||||
use Illuminate\Support\Facades\Config;
|
||||
use Illuminate\Support\Facades\Event;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use Livewire\Livewire;
|
||||
use Mockery\MockInterface;
|
||||
use PHPUnit\Framework\Attributes\UsesClass;
|
||||
@@ -117,34 +112,4 @@ class OrganizationResourceTest extends FilamentTestCase
|
||||
$response->assertSuccessful();
|
||||
$response->assertCanSeeTableRecords($organizationInvitations);
|
||||
}
|
||||
|
||||
public function test_can_create_related_invitation(): void
|
||||
{
|
||||
// Arrange
|
||||
Event::fake([
|
||||
OrganizationInvitationAdding::class,
|
||||
]);
|
||||
Mail::fake();
|
||||
$organization = Organization::factory()->create();
|
||||
|
||||
// Act
|
||||
$response = Livewire::test(OrganizationResource\RelationManagers\InvitationsRelationManager::class, [
|
||||
'ownerRecord' => $organization,
|
||||
'pageClass' => OrganizationResource\Pages\EditOrganization::class,
|
||||
])->callTableAction('create', data: [
|
||||
'email' => 'new-user@example.com',
|
||||
'role' => Role::Employee->value,
|
||||
]);
|
||||
|
||||
// Assert
|
||||
$response->assertSuccessful();
|
||||
$response->assertHasNoTableActionErrors();
|
||||
$this->assertDatabaseHas(OrganizationInvitation::class, [
|
||||
'organization_id' => $organization->getKey(),
|
||||
'email' => 'new-user@example.com',
|
||||
'role' => Role::Employee->value,
|
||||
]);
|
||||
Event::assertDispatched(OrganizationInvitationAdding::class);
|
||||
Mail::assertQueued(OrganizationInvitationMail::class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,14 +73,13 @@ class EnsureEmailIsVerifiedMiddlewareTest extends MiddlewareTestAbstract
|
||||
$response->assertOk();
|
||||
}
|
||||
|
||||
public function test_users_with_unverified_email_can_access_route_in_local_environment_if_local_email_verification_is_disabled(): void
|
||||
public function test_users_with_unverified_email_can_access_route_in_local_environment(): void
|
||||
{
|
||||
// Arrange
|
||||
$user = User::factory()->unverified()->create();
|
||||
$route = $this->createTestRoute();
|
||||
$this->actingAs($user);
|
||||
$this->app->detectEnvironment(fn () => 'local');
|
||||
config(['app.local_email_verification' => false]);
|
||||
|
||||
// Act
|
||||
$response = $this->get($route);
|
||||
@@ -88,36 +87,4 @@ class EnsureEmailIsVerifiedMiddlewareTest extends MiddlewareTestAbstract
|
||||
// Assert
|
||||
$response->assertOk();
|
||||
}
|
||||
|
||||
public function tests_users_with_unverified_email_are_redirected_in_non_local_environment_even_if_local_email_verification_is_disabled(): void
|
||||
{
|
||||
// Arrange
|
||||
$user = User::factory()->unverified()->create();
|
||||
$route = $this->createTestRoute();
|
||||
$this->actingAs($user);
|
||||
$this->assertSame('testing', config('app.env'));
|
||||
config(['app.local_email_verification' => false]);
|
||||
|
||||
// Act
|
||||
$response = $this->get($route);
|
||||
|
||||
// Assert
|
||||
$response->assertRedirect(route('verification.notice'));
|
||||
}
|
||||
|
||||
public function test_users_with_unverified_email_are_redirected_in_local_environment_if_local_email_verification_is_enabled(): void
|
||||
{
|
||||
// Arrange
|
||||
$user = User::factory()->unverified()->create();
|
||||
$route = $this->createTestRoute();
|
||||
$this->actingAs($user);
|
||||
$this->app->detectEnvironment(fn () => 'local');
|
||||
config(['app.local_email_verification' => true]);
|
||||
|
||||
// Act
|
||||
$response = $this->get($route);
|
||||
|
||||
// Assert
|
||||
$response->assertRedirect(route('verification.notice'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,131 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\Unit\Service\Dto;
|
||||
|
||||
use App\Service\Dto\UserAgentDto;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
use Tests\TestCase;
|
||||
|
||||
#[CoversClass(UserAgentDto::class)]
|
||||
class UserAgentDtoTest extends TestCase
|
||||
{
|
||||
public function test_chrome_on_windows_is_detected_as_a_desktop_browser(): void
|
||||
{
|
||||
// Arrange
|
||||
$userAgent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36';
|
||||
$agent = new UserAgentDto;
|
||||
$agent->setUserAgent($userAgent);
|
||||
|
||||
// Act
|
||||
$platform = $agent->platform();
|
||||
$browser = $agent->browser();
|
||||
$isDesktop = $agent->isDesktop();
|
||||
|
||||
// Assert
|
||||
$this->assertSame('Windows', $platform);
|
||||
$this->assertSame('Chrome', $browser);
|
||||
$this->assertTrue($isDesktop);
|
||||
}
|
||||
|
||||
public function test_edge_is_detected_before_chrome(): void
|
||||
{
|
||||
// Arrange
|
||||
$userAgent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36 Edg/120.0.0.0';
|
||||
$agent = new UserAgentDto;
|
||||
$agent->setUserAgent($userAgent);
|
||||
|
||||
// Act
|
||||
$browser = $agent->browser();
|
||||
|
||||
// Assert
|
||||
$this->assertSame('Edge', $browser);
|
||||
}
|
||||
|
||||
public function test_iphone_safari_is_detected_as_a_non_desktop_browser(): void
|
||||
{
|
||||
// Arrange
|
||||
$userAgent = 'Mozilla/5.0 (iPhone; CPU iPhone OS 17_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.0 Mobile/15E148 Safari/604.1';
|
||||
$agent = new UserAgentDto;
|
||||
$agent->setUserAgent($userAgent);
|
||||
|
||||
// Act
|
||||
$platform = $agent->platform();
|
||||
$browser = $agent->browser();
|
||||
$isDesktop = $agent->isDesktop();
|
||||
|
||||
// Assert
|
||||
$this->assertSame('iOS', $platform);
|
||||
$this->assertSame('Safari', $browser);
|
||||
$this->assertFalse($isDesktop);
|
||||
}
|
||||
|
||||
public function test_ipad_is_detected_as_non_desktop(): void
|
||||
{
|
||||
// Arrange
|
||||
$userAgent = 'Mozilla/5.0 (iPad; CPU OS 17_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.0 Mobile/15E148 Safari/604.1';
|
||||
$agent = new UserAgentDto;
|
||||
$agent->setUserAgent($userAgent);
|
||||
|
||||
// Act
|
||||
$isDesktop = $agent->isDesktop();
|
||||
|
||||
// Assert
|
||||
$this->assertFalse($isDesktop);
|
||||
}
|
||||
|
||||
public function test_unknown_user_agent_has_no_platform_or_browser_and_is_a_desktop(): void
|
||||
{
|
||||
// Arrange
|
||||
$agent = new UserAgentDto;
|
||||
$agent->setUserAgent('CustomClient/1.0');
|
||||
|
||||
// Act
|
||||
$platform = $agent->platform();
|
||||
$browser = $agent->browser();
|
||||
$isDesktop = $agent->isDesktop();
|
||||
|
||||
// Assert
|
||||
$this->assertNull($platform);
|
||||
$this->assertNull($browser);
|
||||
$this->assertTrue($isDesktop);
|
||||
}
|
||||
|
||||
public function test_cloudfront_desktop_header_is_detected_as_desktop(): void
|
||||
{
|
||||
// Arrange
|
||||
$agent = new UserAgentDto;
|
||||
$agent->setUserAgent('Amazon CloudFront');
|
||||
$agent->setHttpHeaders([
|
||||
'HTTP_CLOUDFRONT_IS_DESKTOP_VIEWER' => 'true',
|
||||
]);
|
||||
|
||||
// Act
|
||||
$isDesktop = $agent->isDesktop();
|
||||
|
||||
// Assert
|
||||
$this->assertTrue($isDesktop);
|
||||
}
|
||||
|
||||
public function test_cached_values_are_resolved_for_the_current_user_agent(): void
|
||||
{
|
||||
// Arrange
|
||||
$agent = new UserAgentDto;
|
||||
$agent->setUserAgent('Mozilla/5.0 (Windows NT 10.0; Win64; x64) Chrome/120.0.0.0 Safari/537.36');
|
||||
$agent->platform();
|
||||
$agent->browser();
|
||||
$agent->isDesktop();
|
||||
$agent->setUserAgent('Mozilla/5.0 (iPhone; CPU iPhone OS 17_0 like Mac OS X) Version/17.0 Mobile/15E148 Safari/604.1');
|
||||
|
||||
// Act
|
||||
$platform = $agent->platform();
|
||||
$browser = $agent->browser();
|
||||
$isDesktop = $agent->isDesktop();
|
||||
|
||||
// Assert
|
||||
$this->assertSame('iOS', $platform);
|
||||
$this->assertSame('Safari', $browser);
|
||||
$this->assertFalse($isDesktop);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user