Skip to content

add const for content section alias#19484

Closed
nielslyngsoe wants to merge 2 commits intomainfrom
v16/feature/content-section-alias-const
Closed

add const for content section alias#19484
nielslyngsoe wants to merge 2 commits intomainfrom
v16/feature/content-section-alias-const

Conversation

@nielslyngsoe
Copy link
Member

Added a constant for the Content Section Alias

Copilot AI review requested due to automatic review settings June 4, 2025 15:37
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces a new constant UMB_SECTION_ALIAS_CONDITION_ALIAS for the section-alias condition and replaces all hard-coded 'Umb.Condition.SectionAlias' literals with the constant across manifests and examples.

  • Added UMB_SECTION_ALIAS_CONDITION_ALIAS in core/section/conditions/constants.ts
  • Updated imports and replaced literal alias in multiple package manifests
  • Updated examples to use the new constant

Reviewed Changes

Copilot reviewed 25 out of 25 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/Umbraco.Web.UI.Client/src/packages/settings/welcome/manifests.ts Import and use new constant instead of literal alias
src/Umbraco.Web.UI.Client/src/packages/settings/structure/manifests.ts Import and use new constant instead of literal alias
src/Umbraco.Web.UI.Client/src/packages/settings/advanced/manifests.ts Import and use new constant instead of literal alias
src/Umbraco.Web.UI.Client/src/packages/search/manifests.ts Import and use new constant instead of literal alias
src/Umbraco.Web.UI.Client/src/packages/publish-cache/manifests.ts Import and use new constant instead of literal alias
src/Umbraco.Web.UI.Client/src/packages/performance-profiling/manifests.ts Import and use new constant instead of literal alias
src/Umbraco.Web.UI.Client/src/packages/packages/package-section/manifests.ts Consolidated imports and replaced literal alias
src/Umbraco.Web.UI.Client/src/packages/models-builder/manifests.ts Import and use new constant instead of literal alias
src/Umbraco.Web.UI.Client/src/packages/members/section/sidebar-app/manifests.ts Import and use new constant instead of literal alias
src/Umbraco.Web.UI.Client/src/packages/media/media/dashboard/manifests.ts Import and use new constant instead of literal alias
src/Umbraco.Web.UI.Client/src/packages/media/media-section/manifests.ts Consolidated imports and replaced literal alias
src/Umbraco.Web.UI.Client/src/packages/language/app-language-select/manifests.ts Import and use new constant instead of literal alias
src/Umbraco.Web.UI.Client/src/packages/health-check/manifests.ts Import and use new constant instead of literal alias
src/Umbraco.Web.UI.Client/src/packages/documents/section/manifests.ts Consolidated imports and replaced literal alias
src/Umbraco.Web.UI.Client/src/packages/documents/document-redirect-management/manifests.ts Import and use new constant instead of literal alias
src/Umbraco.Web.UI.Client/src/packages/dictionary/dashboard/manifests.ts Import and use new constant instead of literal alias
src/Umbraco.Web.UI.Client/src/packages/core/section/conditions/manifests.ts Updated manifest to use new constant alias
src/Umbraco.Web.UI.Client/src/packages/core/section/conditions/constants.ts Added new UMB_SECTION_ALIAS_CONDITION_ALIAS constant
src/Umbraco.Web.UI.Client/examples/validation-context/index.ts Updated example to use new constant alias
src/Umbraco.Web.UI.Client/examples/custom-modal/index.ts Updated example to use new constant alias
Comments suppressed due to low confidence (3)

src/Umbraco.Web.UI.Client/src/packages/core/section/conditions/constants.ts:2

  • [nitpick] Consider adding a brief JSDoc comment above this constant to explain its purpose and where it should be used.
export const UMB_SECTION_ALIAS_CONDITION_ALIAS = 'Umb.Condition.SectionAlias';

src/Umbraco.Web.UI.Client/src/packages/core/section/conditions/manifests.ts:1

  • Add unit tests for the section conditions manifest to verify that the new constant alias correctly registers the SectionAlias condition.
import { UMB_SECTION_ALIAS_CONDITION_ALIAS, UMB_SECTION_USER_PERMISSION_CONDITION_ALIAS } from './constants.js';

src/Umbraco.Web.UI.Client/src/packages/settings/welcome/manifests.ts:17

  • [nitpick] This pattern of injecting the SectionAlias condition is repeated across many manifests—consider a shared helper to reduce duplication and simplify updates.
alias: 'Umb.Condition.SectionAlias',

Comment on lines 1 to 3
import { UMB_SETTINGS_SECTION_ALIAS } from '../constants.js';
import { UMB_SECTION_ALIAS_CONDITION_ALIAS } from '@umbraco-cms/backoffice/section';
import type { UmbExtensionManifestKind } from '@umbraco-cms/backoffice/extension-registry';
Copy link

Copilot AI Jun 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Group external imports (e.g., '@umbraco-cms/backoffice/section') consistently at the top and separate from local imports to match project import ordering conventions.

Suggested change
import { UMB_SETTINGS_SECTION_ALIAS } from '../constants.js';
import { UMB_SECTION_ALIAS_CONDITION_ALIAS } from '@umbraco-cms/backoffice/section';
import type { UmbExtensionManifestKind } from '@umbraco-cms/backoffice/extension-registry';
import { UMB_SECTION_ALIAS_CONDITION_ALIAS } from '@umbraco-cms/backoffice/section';
import type { UmbExtensionManifestKind } from '@umbraco-cms/backoffice/extension-registry';
import { UMB_SETTINGS_SECTION_ALIAS } from '../constants.js';

Copilot uses AI. Check for mistakes.
@bjarnef
Copy link
Contributor

bjarnef commented Jun 4, 2025

Seems a bit odd to me with double ALIAS in constant. Do we really need that?

@madsrasmussen
Copy link
Member

I didn't see this PR before fixing it here #19633 🙈 I will close this PR as the other is merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants