Skip to content

Conversation

imrohitkodam
Copy link

@imrohitkodam imrohitkodam commented Oct 17, 2025

Summary by CodeRabbit

Release Notes

  • New Features

    • Added webhook as a new notification backend option, complementing existing email and SMS backends.
    • Introduced global webhook URL configuration with per-template override capability.
    • Enhanced backend validation with language, body, subject, and URL presence checks.
  • Chores

    • Added automated code review configuration.

Copy link

coderabbitai bot commented Oct 17, 2025

Caution

Review failed

Failed to post review comments

Walkthrough

The pull request adds webhook backend support to a Joomla notification component, expanding from email and SMS backends to include webhooks. Changes include updated configuration settings, backend option registration, notification model enhancements for webhook validation and persistence, database schema updates to store webhook URLs and configuration flags, and installation scripts to manage schema migrations.

Changes

Cohort / File(s) Summary
CodeRabbit Configuration
.coderabbit.yaml
Adds new CodeRabbit configuration file with global settings, review settings (request changes workflow, summaries, review status enabled), path-specific review instructions for JS/PHP/TS files (enforcing framework standards), auto-review rules (WIP/DO NOT MERGE keywords, draft handling, base branches), and chat auto-reply.
Backend Definition
src/com_tjnotifications/admin/defines.php
Updates TJNOTIFICATIONS_CONST_BACKENDS_ARRAY constant to include webhook: "email,sms,webhook".
Backend Form Field
src/com_tjnotifications/admin/models/fields/backends.php
Adds webhook option to the backend options list in getOptions() method.
Notification Model Logic
src/com_tjnotifications/admin/models/notification.php
Adds webhook configuration handling including ComponentHelper import, new/edit detection logic via data['id'], global component params retrieval for webhook URLs, backend-specific validation (language/body for all, subject for email, URL validation for webhook), template configuration persistence with webhook fields (webhook_url, use_global_webhook_url), empty params initialization, error logging on save failure, and template state management updates.
Notification Queries
src/com_tjnotifications/admin/models/notifications.php
Adds ntc.webhook_url and ntc.use_global_webhook_url fields to SELECT statements in getTemplate() method SQL queries.
Database Schema - Install
src/com_tjnotifications/admin/sql/install.mysql.utf8.sql
Modifies template configs table: adds webhook_url (TEXT), use_global_webhook_url (TINYINT), changes subject/body/params to NOT NULL. Modifies logs table: adds webhook_url (TEXT), enforces NOT NULL constraints on body, to, cc, bcc, date, params, message, category, removes default values from state and is_override columns.
Database Schema - Migration
src/com_tjnotifications/admin/sql/updates/mysql/2.1.0.sql
Incremental migration adding webhook_url and use_global_webhook_url columns to template configs table and webhook_url to logs table.
Installation Script
src/com_tjnotifications/install.tjnotifications.php
Introduces addMissingColumns() method to check and add missing webhook columns during updates, invoked in update() after fixMenuLinks().

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Model as notification.php
    participant DB as Database
    participant Logger as Logger
    participant ComponentHelper as ComponentHelper

    User->>Model: save(notification data)
    
    Model->>Model: Determine new vs. existing<br/>(check data['id'])
    Model->>ComponentHelper: Get global webhook URLs
    ComponentHelper-->>Model: params (webhook URLs)
    
    Model->>Model: Backend-specific validation
    alt Backend is email
        Model->>Model: Validate subject, body
    else Backend is webhook
        Model->>Model: Validate webhook URL<br/>(global or per-backend)
    else Backend is sms
        Model->>Model: Validate language, body
    end
    
    alt Validation fails
        Model->>Logger: Log validation error
        Model-->>User: Return false
    else Validation passes
        Model->>DB: Save notification
        alt Save successful
            Model->>DB: Insert/Update template config<br/>(webhook_url, use_global_webhook_url)
            Model->>DB: Set params = json_encode([])
            Model->>Model: Update model state<br/>(templateId, isNew flag)
            Model-->>User: Return success
        else Save failed
            Model->>Logger: Log save failure
            Model-->>User: Return false
        end
    end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

The notification model file introduces substantial backend-specific validation logic, new state management for distinguishing new versus existing records, component parameter handling for global webhook URLs, and persistent storage of webhook configuration. Database schema changes involve significant constraint modifications and new column additions requiring careful review for data integrity implications. The changes span multiple architectural layers (configuration, validation, persistence, schema) with interconnected logic requiring careful verification of backend behavior consistency and database constraint compatibility.

Pre-merge checks and finishing touches

❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Title Check ❓ Inconclusive The PR title "Issue : Resolved issue Invalid Form" is vague and lacks specificity about the actual changes in the changeset. While it references issue resolution (aligning with the PR objective of resolving issue #177), the phrase "Invalid Form" does not convey meaningful information about the primary changes. The substantial modifications across the codebase focus on adding webhook backend support to the notification system, including new configuration files, backend option additions, webhook validation logic, database schema updates, and installation scripts. The title fails to communicate this core functionality and would not help a developer scanning PR history understand the purpose of these changes. Consider revising the title to be more specific and descriptive of the main change, such as "Add webhook backend support for notifications" or "Add webhook integration to TJ-Notifications component". This would clearly communicate the primary purpose of the changeset and improve clarity for future reference.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@imrohitkodam imrohitkodam changed the base branch from master to release-3.1.0 October 17, 2025 09:02
@imrohitkodam imrohitkodam changed the title Resolved issue Invalid form raised by ernest Issue : Resolved issue Invalid Form Oct 17, 2025
@imrohitkodam imrohitkodam changed the title Issue : Resolved issue Invalid Form Issue #239337 : Resolved issue Invalid Form Oct 17, 2025
@imrohitkodam imrohitkodam changed the title Issue #239337 : Resolved issue Invalid Form Issue #239337 : Fixed "Invalid form" error when saving translated notifications with disabled email/webhook/SMS settings Oct 17, 2025
@imrohitkodam imrohitkodam changed the title Issue #239337 : Fixed "Invalid form" error when saving translated notifications with disabled email/webhook/SMS settings Issue #239337 Fix : Fixed "Invalid form" error when saving translated notifications with disabled email/webhook/SMS settings Oct 17, 2025
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.

1 participant