Skip to content

Prevent Alert widget from starting session unnecessarily.#335

Merged
terabytesoftw merged 2 commits intoyiisoft:masterfrom
terabytesoftw:fix_issue_223
Mar 11, 2026
Merged

Prevent Alert widget from starting session unnecessarily.#335
terabytesoftw merged 2 commits intoyiisoft:masterfrom
terabytesoftw:fix_issue_223

Conversation

@terabytesoftw
Copy link
Copy Markdown
Member

Q A
Is bugfix? ✔️
New feature?
Breaks BC?
Tests pass?

@terabytesoftw terabytesoftw linked an issue Mar 11, 2026 that may be closed by this pull request
@terabytesoftw terabytesoftw requested a review from a team March 11, 2026 08:23
@terabytesoftw terabytesoftw added the status:code review The pull request needs review. label Mar 11, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 11, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (43f17ce) to head (1e076d1).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff             @@
##              master      #335   +/-   ##
===========================================
  Coverage     100.00%   100.00%           
- Complexity        44        46    +2     
===========================================
  Files             13        13           
  Lines            479       518   +39     
===========================================
+ Hits             479       518   +39     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown

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 aims to avoid starting a Yii session when rendering the global Alert widget in requests where no session exists, reducing unnecessary session overhead (especially since the widget is rendered from the main layout on every page).

Changes:

  • Short-circuit Alert::run() when the session is inactive and no session id is present.
  • Update contact-form success handling to use a success flash message with a user-facing message.
  • Add/adjust assets and tests related to the contact success view and the Alert widget behavior.

Reviewed changes

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

Show a summary per file
File Description
widgets/Alert.php Skips flash rendering early when there is no session, avoiding session start.
controllers/SiteController.php Sets a success flash with a message after successful contact submission.
views/site/contact.php Switches success branch to hasFlash('success') and simplifies the success text.
tests/Unit/widgets/AlertTest.php Adds a unit test intended to ensure the widget doesn’t start a session when none exists.
docs/images/contact-success-light.png Adds a contact success screenshot asset.
docs/images/contact-success-dark.png Adds a contact success screenshot asset.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@terabytesoftw terabytesoftw merged commit a945d86 into yiisoft:master Mar 11, 2026
17 checks passed
@terabytesoftw terabytesoftw deleted the fix_issue_223 branch March 11, 2026 18:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status:code review The pull request needs review. type:bug Bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Виджет Alert работает неверно

3 participants