Skip to content

Conversation

@Arsalanulhaq
Copy link
Contributor

@Arsalanulhaq Arsalanulhaq commented Jan 19, 2026

This pull request adds a post-installation setup workflow for the app, which is triggered after installation is completed. It includes a new event listener for the installation completion event, a background job to handle post-setup tasks (such as sending a welcome email to the admin), a helper for sending the welcome email, and comprehensive unit tests for these new features.

Event-driven post-installation setup:

  • Added InstallationCompletedEventListener to handle the InstallationCompletedEvent, which initializes the admin user, configures SMTP mail settings from secure config files, and schedules the PostSetupJob to run post-install tasks.
  • Registered the new event listener in the application bootstrap by updating the register method in Application.php. [1] [2]

Automated post-setup background job:

  • Implemented PostSetupJob, a timed background job that checks for completion status, verifies system readiness, and sends a welcome email to the initial admin user. The job self-removes after successful execution.
  • Added WelcomeMailHelper to encapsulate logic for generating and sending the welcome email to the admin user, leveraging existing mail helper infrastructure.

Testing and reliability:

  • Added unit tests for PostSetupJob covering various job states and scenarios (already done, unknown status, pending, URL unreachable, and successful mail send).
  • Added unit tests for InstallationCompletedEventListener to verify correct configuration handling, job scheduling, and edge cases such as quoted config values and missing SMTP security settings.

@Arsalanulhaq Arsalanulhaq marked this pull request as draft January 19, 2026 14:02
@Arsalanulhaq Arsalanulhaq force-pushed the as/dev/installation_completed_event_listener branch 6 times, most recently from 97cbe31 to 586ce2d Compare January 21, 2026 10:11
@Arsalanulhaq Arsalanulhaq marked this pull request as ready for review January 21, 2026 10:19
@Arsalanulhaq Arsalanulhaq requested a review from Copilot January 21, 2026 10:57
Copy link

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 pull request implements a post-installation workflow for the NCW Tools app, triggered by the InstallationCompletedEvent. The workflow configures SMTP settings from secure config files, schedules a background job to verify system readiness, and sends a welcome email to the initial admin user.

Changes:

  • Added event listener to handle installation completion, configure SMTP settings, and schedule post-setup tasks
  • Implemented background job to check system readiness and send welcome email with password reset token
  • Added helper class to encapsulate welcome email sending logic
  • Created comprehensive unit tests for all new components
  • Added test stubs for classes not yet available in the OCP package

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
lib/AppInfo/Application.php Registers the InstallationCompletedEventListener for the post-install workflow
lib/Listeners/InstallationCompletedEventListener.php Handles installation completion by reading config files and scheduling the PostSetupJob
lib/BackgroundJob/PostSetupJob.php Timed job that verifies system readiness and sends welcome email to admin
lib/Helper/WelcomeMailHelper.php Encapsulates logic for generating and sending welcome emails
tests/unit/AppInfo/ApplicationTest.php Verifies event listener registration in the application bootstrap
tests/unit/Listeners/PostInstallEventListenerTest.php Tests configuration handling, job scheduling, and edge cases
tests/unit/BackgroundJob/PostSetupJobTest.php Tests job execution flow including various status conditions
tests/unit/Helper/WelcomeMailHelperTest.php Tests welcome email sending with and without password reset tokens
tests/bootstrap.php Adds autoloader for test stubs
tests/stubs/OCP/Install/Events/InstallationCompletedEvent.php Stub class for testing when actual OCP class is unavailable
composer.json Configures autoload-dev to include test stubs
psalm.xml Adds test stubs directory to Psalm analysis

@Arsalanulhaq Arsalanulhaq force-pushed the as/dev/installation_completed_event_listener branch 2 times, most recently from 12a73b4 to 874df30 Compare January 21, 2026 11:07
@Arsalanulhaq Arsalanulhaq requested a review from Copilot January 21, 2026 11:08
Copy link

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

Copilot reviewed 12 out of 12 changed files in this pull request and generated 3 comments.

@Arsalanulhaq Arsalanulhaq force-pushed the as/dev/installation_completed_event_listener branch from 874df30 to a2c8b33 Compare January 21, 2026 11:16
@Arsalanulhaq Arsalanulhaq force-pushed the as/dev/installation_completed_event_listener branch 3 times, most recently from 162beb4 to 9651c9b Compare January 21, 2026 14:49
Copy link
Collaborator

@printminion-co printminion-co left a comment

Choose a reason for hiding this comment

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

review done in PR with fixup commits

Add EditorConfig file to maintain consistent coding styles across
different editors and IDEs. Configures indent styles for PHP (tabs),
JSON/YAML (spaces), and other file types.

Signed-off-by: Misha M.-Kupriyanov <kupriyanov@strato.de>
@Arsalanulhaq Arsalanulhaq force-pushed the as/dev/installation_completed_event_listener branch 2 times, most recently from d22f59b to edb026c Compare January 22, 2026 16:20
…onality

Add a new PostSetupJob that sends a welcome email to the admin user after installation completion. This job checks the installation status and ensures the SMTP configuration is set correctly. Additionally, an InstallationCompletedEventListener is introduced to trigger the PostSetupJob upon installation completion.

This enhancement improves user onboarding by automating the welcome email process.

Signed-off-by: Arsalan Ul Haq Sohni <arsalan-ul-haq.sohni@strato.de>
@Arsalanulhaq Arsalanulhaq force-pushed the as/dev/installation_completed_event_listener branch from edb026c to 444034b Compare January 22, 2026 16:23
@Arsalanulhaq Arsalanulhaq merged commit 001285c into main Jan 26, 2026
28 of 29 checks passed
@Arsalanulhaq Arsalanulhaq deleted the as/dev/installation_completed_event_listener branch January 26, 2026 14:43
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