Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closes #7058: Implement DJE Safe Mode Feature #7081

Open
wants to merge 20 commits into
base: feature/3.18
Choose a base branch
from

Conversation

Miraeld
Copy link
Contributor

@Miraeld Miraeld commented Oct 31, 2024

Description

Fixes #7058
This change introduces the "Delay JavaScript Execution safe mode" feature. It enhances user control over JavaScript execution, providing a checkbox to enable or disable safe mode, and displays a warning about potential performance impacts. This helps users manage their site's performance more effectively.

Type of change

  • Enhancement (non-breaking change which improves an existing functionality).

Detailed scenario

To trigger the new code:

  • Navigate to the plugin settings.
  • Locate the "Delay JavaScript Execution" section.
  • Check the "Delay JavaScript Execution safe mode" checkbox.
  • Observe the warning message detailing potential performance impacts.
  • Default exclusion will be added on the front-end.

Technical description

Documentation

The feature adds a checkbox labeled "Delay JavaScript Execution safe mode" and displays a warning when it is checked. The backend logic updates the exclusions list based on the checkbox state and ensures these changes are applied when settings are saved.
Also, when we load delay_js on the front-end, we check if the new option is enabled, and if this is the case, we add default exclusion to delay_js.

New dependencies

No new dependencies are introduced in this change.

Risks

None.

Mandatory Checklist

Code validation

  • I validated all the Acceptance Criteria. If possible, provide screenshots or videos.
  • I triggered all changed lines of code at least once without new errors/warnings/notices.
  • I implemented built-in tests to cover the new/changed code.

Code style

  • I wrote a self-explanatory code about what it does.
  • I protected entry points against unexpected inputs.
  • I did not introduce unnecessary complexity.
  • Output messages (errors, notices, logs) are explicit enough for users to understand the issue and are actionnable.

@Miraeld Miraeld added effort: [M] 3-5 days of estimated development time epics 🔥 For large tasks or features, broken into smaller issues. module: delay JS labels Oct 31, 2024
@Miraeld Miraeld requested a review from a team October 31, 2024 07:40
@Miraeld Miraeld self-assigned this Oct 31, 2024
@Miraeld Miraeld force-pushed the enhancement/7058-dje-safe-mode branch from a8b48f5 to 9e698a6 Compare October 31, 2024 12:10
inc/Engine/Admin/Settings/Page.php Outdated Show resolved Hide resolved
Copy link

codacy-production bot commented Nov 5, 2024

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
Report missing for 1a097421 38.78% (target: 50.00%)
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (1a09742) Report Missing Report Missing Report Missing
Head commit (d37773c) 38145 16704 43.79%

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#7081) 49 19 38.78%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

See your quality gate settings    Change summary preferences

Codacy stopped sending the deprecated coverage status on June 5th, 2024. Learn more

Footnotes

  1. Codacy didn't receive coverage data for the commit, or there was an error processing the received data. Check your integration for errors and validate that your coverage setup is correct.

@Miraeld
Copy link
Contributor Author

Miraeld commented Nov 5, 2024

Codacy Diff Coverage is failing due to the addition of a field on the front-end which isn't triggered in any test (as it's front-end). That's normal 👍

@remyperona remyperona linked an issue Nov 5, 2024 that may be closed by this pull request
inc/Engine/Optimization/DelayJS/HTML.php Outdated Show resolved Hide resolved
inc/Engine/Optimization/DelayJS/HTML.php Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
effort: [M] 3-5 days of estimated development time epics 🔥 For large tasks or features, broken into smaller issues. module: delay JS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement DJE Safe Mode Feature
2 participants