-
Notifications
You must be signed in to change notification settings - Fork 0
feat(installation): implement post setup job and welcome email functionality #4
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
feat(installation): implement post setup job and welcome email functionality #4
Conversation
97cbe31 to
586ce2d
Compare
There was a problem hiding this 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 |
12a73b4 to
874df30
Compare
There was a problem hiding this 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.
874df30 to
a2c8b33
Compare
162beb4 to
9651c9b
Compare
printminion-co
left a comment
There was a problem hiding this 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>
d22f59b to
edb026c
Compare
…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>
edb026c to
444034b
Compare
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:
InstallationCompletedEventListenerto handle theInstallationCompletedEvent, which initializes the admin user, configures SMTP mail settings from secure config files, and schedules thePostSetupJobto run post-install tasks.registermethod inApplication.php. [1] [2]Automated post-setup background job:
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.WelcomeMailHelperto encapsulate logic for generating and sending the welcome email to the admin user, leveraging existing mail helper infrastructure.Testing and reliability:
PostSetupJobcovering various job states and scenarios (already done, unknown status, pending, URL unreachable, and successful mail send).InstallationCompletedEventListenerto verify correct configuration handling, job scheduling, and edge cases such as quoted config values and missing SMTP security settings.