Skip to content

Conversation

@akanshaaa19
Copy link
Member

@akanshaaa19 akanshaaa19 commented May 22, 2025

target issue is glific/glific-frontend#3311

Summary by CodeRabbit

  • New Features
    • Added a "Deactivate Profile" option to contact profile actions in the flow editor.
    • The flow editor now displays a message when deactivating a profile.
  • Enhancements
    • Expanded filter options in the flow editor configuration to include "profile".

feat: Add 'Deactivate Profile' option in Contact Profile Router form
```
@coderabbitai
Copy link

coderabbitai bot commented May 22, 2025

## Walkthrough

A new "Deactivate Profile" option was introduced to the contact profile flow, affecting both the available profile actions and the UI rendering logic. The flow editor's configuration was updated to include the "profile" filter. The ContactProfileRouter now conditionally displays a message when deactivating a profile. The helper function was updated to find profile options dynamically from a consolidated object.

## Changes

| File(s)                                                                                     | Change Summary                                                                                                   |
|--------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------|
| public/index.html                                                                          | Added `'profile'` to the flow editor's `filters` array in the configuration object.                              |
| src/components/flow/routers/contactprofile/ContactProfileRouterForm.tsx                     | Added "Deactivate Profile" option to selectable profile actions; removed `profileOptionsWithName`; removed blank line in `renderEdit`.           |
| src/components/flow/routers/contactprofile/ContactProfileRouter.tsx                         | Added a conditional branch to render a message when `profile_type` is "Deactivate Profile".                      |
| src/components/flow/routers/contactprofile/helpers.ts                                      | Removed import of `profileOptionsWithName`; updated `nodeToState` to find profile option by name within `profileOptions`. |
| package.json                                                                              | Updated version number from "1.26.3-26" to "1.26.3-27".                                                        |

## Sequence Diagram(s)

```mermaid
sequenceDiagram
    participant User
    participant ContactProfileRouterForm
    participant ContactProfileRouter

    User->>ContactProfileRouterForm: Selects a profile action (including "Deactivate Profile")
    ContactProfileRouterForm->>ContactProfileRouter: Passes selected profile_type and value
    alt profile_type == "Deactivate Profile"
        ContactProfileRouter->>User: Displays "Deactivating profile: <value>"
    else profile_type == "Switch Profile" or "Update Name"
        ContactProfileRouter->>User: Displays corresponding UI
    end

Poem

In the garden of flows, a new path appears,
"Deactivate Profile" now calms our fears.
Filters expanded, options anew,
The router responds with a message true.
Rabbits rejoice, the code is spry—
Another update, with a happy hop and sigh! 🐇✨


<!-- walkthrough_end -->


---

<details>
<summary>📜 Recent review details</summary>

**Configuration used: CodeRabbit UI**
**Review profile: CHILL**
**Plan: Pro**


<details>
<summary>📥 Commits</summary>

Reviewing files that changed from the base of the PR and between 73d9b10cf420e5e7df3d9f8fd68293f16e006d12 and c094c0da4126d04e6ed55571f04f2fccc2848304.

</details>

<details>
<summary>📒 Files selected for processing (1)</summary>

* `src/components/flow/routers/contactprofile/helpers.ts` (2 hunks)

</details>

<details>
<summary>🚧 Files skipped from review as they are similar to previous changes (1)</summary>

* src/components/flow/routers/contactprofile/helpers.ts

</details>

<details>
<summary>⏰ Context from checks skipped due to timeout of 90000ms (3)</summary>

* GitHub Check: Analyze (javascript-typescript)
* GitHub Check: Tests (12.x)
* GitHub Check: Coverage

</details>

</details>
<!-- internal state start -->


<!-- DwQgtGAEAqAWCWBnSTIEMB26CuAXA9mAOYCmGJATmriQCaQDG+Ats2bgFyQAOFk+AIwBWJBrngA3EsgEBPRvlqU0AgfFwA6NPEgQAfACgjoCEYDEZyAAUASpETZWaCrKNwSPbABsvkCiQBHbGlcSHFcLzpIACIAYXwMXDQxawp8ADN4SMQuAEFaJXp8bnEEsPxIJWTxCWoPXgyskmjIAHc0ZAcBZnUaejkw2A9sREp0AGtMRFg0WYBGAE50ZFtIDEcBMbmAVgA2DRghyGZtLG5sCm58Uf50wdRV1AIURLTabAYPTH4S+DLnqpiSR1dAKRLVHhpTKRNrqBBYXBHRCyRA0ZgHdyMGYYUjoAr+RCjZCIjxIBwefzpShkT70DqQWC4XDcHIAelZRDh2AEGiYzA5XngmQYAqF8AYYHSaUSZForLJwUQrIAzMq5nMDgA5CpoArqP4YNC+JSIBgUeC/Mr4PjwZjcSJscGlLBKJJZZCtamQ/ASeCFF6DDwOJwuDFHVYMb6bPwkX0kT100IkyAAVRsABkuIzmWyOVyeXzRcLWekvPgE+prazzj5WTt9kZ9MZwF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xymf4xgCznSrOFwOFBO4rHtqecxhRMy35rLqEqCQGB3gPIjXrU0RtiAADa0k5jSQALqN0xASUIKFkwKvBhzVjSgONcbqFxKFpxkB8adrQI1B1qEnUkfQsRlqzXtk9cosGENeHfUEU7c1yYZFyIuAou4c2OH2tUY69R8BpBCwiRAD9r5kiTFIBoIQCKMDFOgxbcp8HTyIZqatzCHgjFXidhl74GVy21xDh4KQOlCLrGYJsOiAqyqRTZrtO7CRw1NAomkSN0QNQACZ9jKjADjlozxMcaBxxoPHWOADs0QZUYL1WKSME2AQkHJqxP2x3EDWSZhaDy6rjjRV1NQfGWjyEjaoUdcbdCQd5eunDO6O22FertSoj8i3nXLcTqdkWkSnxLnekUO4G5OxW1e/uAcR4Ty2wvJONjM41B3gXI+Awuv9zqFzn6RAucTLHYTLnZBT0Hw65bIwAALAADk2OkUP2xlQU7mLsAQaAAAMJBdgkGD9sYPAhIwkGVHsXYcfdjbAELn2gcxE9zAD07oPKhdhoApwwNUofaALFoAwCnAgFgCFD8qBYWOse6kp8n9Iw+YEFA78qQ5i4g8U4n53svDB0jB6x8n7YJAKe0HSLPyP6RaC7FD1jhYyp0hx5IInxPuxS9Y8r87xPCxg8MET+W4Pcwce0ET8HlPdBtjf9j+kd/6Qsd0gGBgCsdQ8w9lR39K8q8IA+wcY3dTFPdXl4w6Bc42x9AgA -->

<!-- internal state end -->
<!-- finishing_touch_checkbox_start -->

<details open="true">
<summary>✨ Finishing Touches</summary>

- [ ] <!-- {"checkboxId": "7962f53c-55bc-4827-bfbf-6a18da830691"} --> 📝 Generate Docstrings

</details>

<!-- finishing_touch_checkbox_end -->
<!-- tips_start -->

---

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.

<details>
<summary>❤️ Share</summary>

- [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai)
- [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai)
- [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai)
- [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)

</details>

<details>
<summary>🪧 Tips</summary>

### Chat

There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=glific/floweditor&utm_content=156):

- Review comments: Directly reply to a review comment made by CodeRabbit. Example:
  - `I pushed a fix in commit <commit_id>, please review it.`
  - `Explain this complex logic.`
  - `Open a follow-up GitHub issue for this discussion.`
- Files and specific lines of code (under the "Files changed" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples:
  - `@coderabbitai explain this code block.`
  -	`@coderabbitai modularize this function.`
- PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
  - `@coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.`
  - `@coderabbitai read src/utils.ts and explain its main purpose.`
  - `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.`
  - `@coderabbitai help me debug CodeRabbit configuration file.`

### Support

Need help? Create a ticket on our [support page](https://www.coderabbit.ai/contact-us/support) for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

### CodeRabbit Commands (Invoked using PR comments)

- `@coderabbitai pause` to pause the reviews on a PR.
- `@coderabbitai resume` to resume the paused reviews.
- `@coderabbitai review` to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
- `@coderabbitai full review` to do a full review from scratch and review all the files again.
- `@coderabbitai summary` to regenerate the summary of the PR.
- `@coderabbitai generate docstrings` to [generate docstrings](https://docs.coderabbit.ai/finishing-touches/docstrings) for this PR.
- `@coderabbitai generate sequence diagram` to generate a sequence diagram of the changes in this PR.
- `@coderabbitai resolve` resolve all the CodeRabbit review comments.
- `@coderabbitai configuration` to show the current CodeRabbit configuration for the repository.
- `@coderabbitai help` to get help.

### Other keywords and placeholders

- Add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed.
- Add `@coderabbitai summary` to generate the high-level summary at a specific location in the PR description.
- Add `@coderabbitai` anywhere in the PR title to generate the title automatically.

### CodeRabbit Configuration File (`.coderabbit.yaml`)

- You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository.
- Please see the [configuration documentation](https://docs.coderabbit.ai/guides/configure-coderabbit) for more information.
- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json`

### Documentation and Community

- Visit our [Documentation](https://docs.coderabbit.ai) for detailed information on how to use CodeRabbit.
- Join our [Discord Community](http://discord.gg/coderabbit) to get help, request features, and share feedback.
- Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.

</details>

<!-- tips_end -->

@akanshaaa19 akanshaaa19 requested a review from mdshamoon May 22, 2025 07:54
@akanshaaa19 akanshaaa19 self-assigned this May 23, 2025
@akanshaaa19 akanshaaa19 requested a review from mdshamoon May 23, 2025 05:20
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c48bef8 and ab6a7c3.

📒 Files selected for processing (2)
  • src/components/flow/routers/contactprofile/ContactProfileRouterForm.tsx (1 hunks)
  • src/components/flow/routers/contactprofile/helpers.ts (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/components/flow/routers/contactprofile/ContactProfileRouterForm.tsx
🧰 Additional context used
🧬 Code Graph Analysis (1)
src/components/flow/routers/contactprofile/helpers.ts (1)
src/components/flow/routers/contactprofile/ContactProfileRouterForm.tsx (1)
  • profileOptions (23-27)
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: Tests (12.x)
  • GitHub Check: Coverage
🔇 Additional comments (2)
src/components/flow/routers/contactprofile/helpers.ts (2)

9-9: Good refactoring to consolidate profile options.

The removal of profileOptionsWithName import aligns with the consolidation of profile options into a single profileOptions object, reducing code duplication.


28-28: Assignment depends on null-safe lookup above.

This assignment is correct, but ensure the option variable is never undefined to prevent downstream issues in UI components that expect a valid option object.

@akanshaaa19 akanshaaa19 merged commit 32ab1c4 into glific-master May 23, 2025
7 checks passed
@akanshaaa19 akanshaaa19 deleted the feat/deactivating_profile branch May 23, 2025 08:36
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