Skip to content

Conversation

@gortiz-dotcms
Copy link
Contributor

@gortiz-dotcms gortiz-dotcms commented Dec 22, 2025

Problem

The insert functions in lacked maxContentlets validation before inserting content.
Drag-and-drop validation worked correctly, but the plus button (+) insertion bypassed validation entirely.

Fix

Added maxContentlets validation to both insertion functions, also added an error message for this scenario.

This PR fixes: #33831

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 fixes issue #33831 where the container limit validation was bypassed when adding content via the plus button (+). Previously, only drag-and-drop operations validated the maxContentlets limit correctly.

Key changes:

  • Added maxContentlets validation to both insertion functions (regular and positioned) before content insertion
  • Changed backend validation logic from < to <= to correctly enforce limits
  • Introduced error handling with new CONTAINER_INSERT_ERROR enum to distinguish between duplicate content and container limit errors

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
Language.properties Added new localized error messages for container limit reached scenario
PageRenderUtil.java Changed comparison operator from < to <= to correctly enforce container limit during rendering
enums.ts Introduced CONTAINER_INSERT_ERROR enum with CONTAINER_LIMIT_REACHED and DUPLICATE_CONTENT values
utils/index.ts Added maxContentlets validation in both insertContentletInContainer and insertPositionedContentletInContainer functions with proper error code reporting
edit-ema-editor.component.ts Added error handling for container limit reached cases with appropriate warning messages and constants for message keys
utils.spec.ts Added comprehensive test coverage for container limit validation scenarios including edge cases with limits of 1 and 2
edit-ema-editor.component.spec.ts Updated existing test data with appropriate maxContentlets values to align with new validation logic

@gortiz-dotcms gortiz-dotcms marked this pull request as ready for review December 26, 2025 14:22
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.

[DEFECT] Container limit is not being respected by containers

3 participants