Skip to content

Extract scope comparison into contentScopesAreEqual - #6150

Merged
VPS-Obi merged 1 commit into
mainfrom
refactor/content-scopes-are-equal-helper
Aug 10, 2026
Merged

Extract scope comparison into contentScopesAreEqual#6150
VPS-Obi merged 1 commit into
mainfrom
refactor/content-scopes-are-equal-helper

Conversation

@VPS-thodax

@VPS-thodax VPS-thodax commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Problem

FilesService and the DAM files controller injected ContentScopeService only to call its scopesAreEqual method — a stateless deep comparison. That ties the DAM to the user-permissions layer for a check that needs no state. FoldersService ran the same comparison inline via lodash.isequal, so the rule existed twice.

Solution

The comparison lives in contentScopesAreEqual now, next to the ContentScope interface in user-permissions/:

  • ContentScopeService.scopesAreEqual delegates to it, so its callers are unaffected.
  • The DAM services and the files controller call it directly and no longer inject ContentScopeService.

No changeset because contentScopesAreEqual is internal and ContentScopeService.scopesAreEqual keeps its signature, so the public API is unchanged.

Verification

  • New unit tests in content-scopes-are-equal.spec.ts cover a class instance against a plain object plus differing values, differing keys and undefined scopes

Outlook

First of three stacked pull requests that let DamFilesModule be registered without UserPermissionsModule: #6151 splits DamModule into sub-modules, #6153 makes the DAM's scope-based access control optional.

FilesService and the files controller injected ContentScopeService only to compare
two scopes, so the DAM depends on the user-permissions layer for a check that needs
no state. FoldersService ran the same comparison inline via lodash.isequal.

Move the comparison into contentScopesAreEqual. The DAM call sites and
ContentScopeService.scopesAreEqual, which now delegates to it, share one
implementation, and the DAM services no longer inject ContentScopeService.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@VPS-thodax VPS-thodax self-assigned this Aug 9, 2026
@VPS-thodax
VPS-thodax requested a review from VPS-Obi August 9, 2026 19:56
@VPS-thodax
VPS-thodax marked this pull request as ready for review August 9, 2026 19:56
@VPS-thodax
VPS-thodax requested a review from kaufmo August 9, 2026 22:05
@VPS-Obi
VPS-Obi merged commit 0166c95 into main Aug 10, 2026
17 checks passed
@VPS-Obi
VPS-Obi deleted the refactor/content-scopes-are-equal-helper branch August 10, 2026 08:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants