Skip to content

[WEB-3792, 3823] fix: intake form version history#6898

Merged
pushya22 merged 3 commits intopreviewfrom
fix/description-version-history
Apr 9, 2025
Merged

[WEB-3792, 3823] fix: intake form version history#6898
pushya22 merged 3 commits intopreviewfrom
fix/description-version-history

Conversation

@aaryan610
Copy link
Member

@aaryan610 aaryan610 commented Apr 9, 2025

Description

This PR fixes the following bugs related to work item description version history-

  1. Render correct user details for intake work items created via Intake forms.
  2. Removed auto-focus from the Copy markdown button.

Other improvements-

  1. Added an enum for intake work item source instead of using hardcoded values.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)

Summary by CodeRabbit

  • New Features

    • Enhanced display of issue creator details across the interface, now showing more contextual names (e.g., “Intake Form user” when applicable).
    • Improved keyboard navigation by ensuring modal action buttons are focusable.
    • Added translations for "deactivated user" in multiple languages, expanding localization support.
  • Refactor

    • Streamlined handling of issue sources with structured values, leading to consistent and reliable information presentation.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Apr 9, 2025

Walkthrough

This pull request introduces a new enumeration (EInboxIssueSource) to replace hardcoded string values for inbox issue sources, and updates corresponding types and variables across the codebase. Several components now use the useMember hook to fetch and display user details more reliably. Minor formatting adjustments, variable renamings, and accessibility improvements (such as adding a tabIndex attribute) have also been applied for consistency and clarity.

Changes

File(s) Change Summary
packages/constants/src/inbox.ts Introduced new enum EInboxIssueSource, reformatted enum and type declarations, and updated TInboxIssue to reflect the new enum type for source.
packages/types/src/issues/activity/issue_activity.d.ts Updated source property in TIssueActivity to use EInboxIssueSource and added import statement for the new enum.
web/core/components/core/description-versions/dropdown.tsx, web/core/components/core/description-versions/root.tsx Renamed variables/properties (e.g., from lastUpdatedByUserDetails to lastUpdatedByUserDisplayName and createdBy to createdByDisplayName) and applied formatting improvements.
web/core/components/core/description-versions/modal.tsx Added tabIndex={1} for better accessibility.
web/core/components/inbox/content/issue-root.tsx, web/core/components/issues/issue-detail/main-content.tsx, web/core/components/issues/peek-overview/issue-detail.tsx Integrated the useMember hook to retrieve user display names, updating logic to set createdByDisplayName based on the issue’s source.
web/core/services/inbox/inbox-issue.service.ts Replaced hardcoded string "IN_APP" with EInboxIssueSource.IN_APP in the create method.
web/core/store/inbox/inbox-issue.store.ts Added new observable property source of type `EInboxIssueSource
packages/i18n/src/locales/*/translations.json Added new translation entry "deactivated_user" in various localization files for multiple languages.

Suggested reviewers

  • prateekshourya29
  • sriramveeraghanta

Poem

I'm a little rabbit with ears so keen,
Hopping through code so fresh and clean.
New enums and hooks make my heart delight,
As display names shine in the soft twilight.
With a happy hop, I cheer the change today—
Coding fields of carrots in a bunny way! 🐰

✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate unit testing code.
    • @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.

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 for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @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 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 for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@makeplane
Copy link

makeplane bot commented Apr 9, 2025

Pull Request Linked with Plane Work Items

Comment Automatically Generated by Plane

Copy link
Contributor

@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: 0

🧹 Nitpick comments (1)
web/core/components/issues/issue-detail/issue-activity/activity/actions/default.tsx (1)

37-38: Consider a mapping for display names

The expression source.toLowerCase() works but might be more maintainable with a direct mapping from enum values to their display names. This would provide more control over how each source type is displayed.

-              created the work item via <span className="font-medium">{source.toLowerCase()}</span>.
+              created the work item via <span className="font-medium">
+                {source === EInboxIssueSource.FORMS ? "forms" : 
+                 source === EInboxIssueSource.EMAIL ? "email" : 
+                 source.toLowerCase()}
+              </span>.
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 993c789 and c61a4bd.

📒 Files selected for processing (11)
  • packages/constants/src/inbox.ts (1 hunks)
  • packages/types/src/issues/activity/issue_activity.d.ts (2 hunks)
  • web/core/components/core/description-versions/dropdown.tsx (2 hunks)
  • web/core/components/core/description-versions/modal.tsx (1 hunks)
  • web/core/components/core/description-versions/root.tsx (1 hunks)
  • web/core/components/inbox/content/issue-root.tsx (4 hunks)
  • web/core/components/issues/issue-detail/issue-activity/activity/actions/default.tsx (2 hunks)
  • web/core/components/issues/issue-detail/main-content.tsx (3 hunks)
  • web/core/components/issues/peek-overview/issue-detail.tsx (3 hunks)
  • web/core/services/inbox/inbox-issue.service.ts (2 hunks)
  • web/core/store/inbox/inbox-issue.store.ts (5 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
packages/constants/src/inbox.ts (2)
packages/types/src/issues/issue.d.ts (1)
  • TIssue (54-67)
packages/types/src/inbox.d.ts (1)
  • TInboxDuplicateIssueDetails (57-61)
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Analyze (javascript)
  • GitHub Check: Analyze (python)
🔇 Additional comments (19)
web/core/components/core/description-versions/modal.tsx (1)

178-178: Improves keyboard navigation accessibility

Adding tabIndex={1} to the Cancel button helps improve keyboard navigation within the modal, ensuring a more predictable tab order. This also addresses the PR objective of removing auto-focus from the "Copy markdown" button.

web/core/components/issues/peek-overview/issue-detail.tsx (2)

13-13: Good addition of user management hook

Adding the useMember hook allows for consistent user data retrieval across components, which is a good architectural improvement.

Also applies to: 50-50


151-151: Enhances user detail rendering for work items

Replacing direct reference to issue.created_by with getUserDetails function ensures that correct user details are consistently displayed. This fix directly addresses the PR objective of ensuring correct user details rendering for intake work items.

web/core/components/issues/issue-detail/main-content.tsx (2)

23-23: Consistent use of useMember hook

Good addition of the useMember hook, maintaining consistency with other components that display user information.

Also applies to: 55-55


158-158: Improves user display name resolution

Using getUserDetails function to retrieve the display name ensures consistent user information display across the application. This aligns with the PR's goal of fixing user detail rendering.

web/core/store/inbox/inbox-issue.store.ts (2)

4-4: Good use of enum for type safety

Importing the EInboxIssueSource enum from constants adds type safety and consistency for inbox issue sources.


22-22: Enhances type safety with enum implementation

Adding the source property of type EInboxIssueSource replaces hardcoded string values with a proper enum, improving code maintainability and type safety. This directly addresses the PR objective of adding an enum for intake work item source.

Also applies to: 42-42, 64-64, 80-80

web/core/components/core/description-versions/dropdown.tsx (2)

28-30: Improved user display name handling logic

The code now correctly implements conditional logic for displaying the last updated user's name, using the getUserDetails hook if the version data is available, and falling back to the entity's creation information when needed.


43-43: Variable name updated for clarity

The variable name has been changed from lastUpdatedByUserDetails to the more specific lastUpdatedByUserDisplayName, which better reflects its purpose and improves code readability.

web/core/services/inbox/inbox-issue.service.ts (2)

1-2: Import statements reorganized with new enum

The import statements now include the EInboxIssueSource enum from @plane/constants, which will be used to replace hardcoded string values.


36-36: Replaced magic string with enum constant

Replaced the hardcoded string "IN_APP" with the enumeration value EInboxIssueSource.IN_APP. This enhances code maintainability and reduces the risk of typos when using these values.

web/core/components/core/description-versions/root.tsx (1)

13-13: Property name updated for clarity and consistency

The property name was updated from createdBy to createdByDisplayName, making it clearer that it contains the display name of the entity creator rather than just an identifier. This change provides better type semantics and consistency across the codebase.

web/core/components/inbox/content/issue-root.tsx (3)

7-7: Added enum import for inbox issue sources

The EInboxIssueSource enum import has been added, providing type-safe constants for identifying the source of inbox issues, replacing hardcoded string values.


54-54: Added user details retrieval hook

The useMember hook has been added with the getUserDetails function, which centralizes user information retrieval and makes the component more maintainable.


236-240: Improved display name handling based on issue source

This change implements the core fix for the PR by conditionally displaying the creator's name based on the inbox issue source. For form-based submissions, it now correctly shows "Intake Form user" instead of trying to look up a potentially non-existent user, addressing the issue with rendering correct user details for intake work items.

packages/types/src/issues/activity/issue_activity.d.ts (1)

1-2: Good use of enum instead of string literals

Replacing hardcoded string literals with an enum (EInboxIssueSource) improves type safety and maintainability. This change aligns well with the PR objective of introducing an enum for intake work item sources.

Also applies to: 37-37

packages/constants/src/inbox.ts (2)

29-29: Approve type update for improved type safety

Updating the TInboxIssue type to use the EInboxIssueSource enum is a good improvement for type safety and consistency across the codebase.


16-20:

Details

❓ Verification inconclusive

Verify the enum value "FORMS" vs previous "FORM" usage

The enum defines FORMS = "FORMS", but the previous string literal used in the type definition was "FORM" (not "FORMS"). This naming inconsistency could cause issues if code elsewhere still expects "FORM" instead of "FORMS".


🏁 Script executed:

#!/bin/bash
# Search for any occurrences of the string literal "FORM" related to source in the codebase
rg -i -C 2 'source.*"FORM"' --type ts --type tsx

Length of output: 78


Action Required: Re-check enum value usage consistency

The enum now defines FORMS = "FORMS" in packages/constants/src/inbox.ts (Lines 16-20), but earlier code expected the literal "FORM". Please run the above command or manually verify that there are no remaining occurrences of "FORM" in the TypeScript files. If any references are found, they should be updated to "FORMS" to maintain consistency.


🏁 Script executed:

#!/bin/bash
# Refined search for occurrences of the legacy "FORM" (as a string literal)
rg -i -C 2 'source.*"FORM"' -g "*.ts" -g "*.tsx"

Length of output: 172


Action: Verify "FORMS" Usage Consistency in Enum

The enum in packages/constants/src/inbox.ts (lines 16–20) now uses the value "FORMS". Our automated search (using refined rg commands) did not return any occurrences of the old literal "FORM". However, note that the search output was minimal due to prior file type issues. Please manually verify that no part of the codebase or related configurations still rely on the literal "FORM". If any such references are discovered, adjust them to "FORMS" for consistency.

web/core/components/issues/issue-detail/issue-activity/activity/actions/default.tsx (1)

5-6: Good implementation of enum usage

Replacing the string comparison with the enum value improves code readability and maintainability, consistent with the changes in other files.

Also applies to: 35-36

Copy link
Contributor

@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: 0

🧹 Nitpick comments (3)
packages/i18n/src/locales/zh-CN/translations.json (1)

873-874: Localization Update: "deactivated_user" Key Added
The new key "deactivated_user": "已停用用户" has been added alongside the existing "view" key. This enhances the localization support by providing a specific translation for deactivated users that aligns with similar changes across other locale files.

packages/i18n/src/locales/pt-BR/translations.json (1)

874-875: Added New Translation Key for Deactivated User

The new entry "deactivated_user": "Usuário desativado" has been added in the "common" section. The change is consistent with localization updates for similar keys in other locale files and follows proper JSON formatting.

packages/i18n/src/locales/cs/translations.json (1)

870-871: Included New Czech Translation for Deactivated User

The new key "deactivated_user": "Deaktivovaný uživatel" has been inserted after the "view" entry. This update aligns well with the coordinated approach across different locale files, ensuring consistency in handling inactive or deactivated user statuses.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between c61a4bd and 6fbb4dc.

📒 Files selected for processing (19)
  • packages/i18n/src/locales/cs/translations.json (1 hunks)
  • packages/i18n/src/locales/de/translations.json (1 hunks)
  • packages/i18n/src/locales/en/translations.json (1 hunks)
  • packages/i18n/src/locales/es/translations.json (1 hunks)
  • packages/i18n/src/locales/fr/translations.json (1 hunks)
  • packages/i18n/src/locales/id/translations.json (1 hunks)
  • packages/i18n/src/locales/it/translations.json (1 hunks)
  • packages/i18n/src/locales/ja/translations.json (1 hunks)
  • packages/i18n/src/locales/ko/translations.json (1 hunks)
  • packages/i18n/src/locales/pl/translations.json (1 hunks)
  • packages/i18n/src/locales/pt-BR/translations.json (1 hunks)
  • packages/i18n/src/locales/ro/translations.json (1 hunks)
  • packages/i18n/src/locales/ru/translations.json (1 hunks)
  • packages/i18n/src/locales/sk/translations.json (1 hunks)
  • packages/i18n/src/locales/ua/translations.json (1 hunks)
  • packages/i18n/src/locales/vi-VN/translations.json (1 hunks)
  • packages/i18n/src/locales/zh-CN/translations.json (1 hunks)
  • packages/i18n/src/locales/zh-TW/translations.json (1 hunks)
  • web/core/components/core/description-versions/dropdown-item.tsx (2 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
web/core/components/core/description-versions/dropdown-item.tsx (2)
packages/i18n/src/hooks/use-translation.ts (1)
  • useTranslation (23-35)
packages/i18n/src/store/index.ts (1)
  • t (231-252)
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Analyze (javascript)
  • GitHub Check: Analyze (python)
🔇 Additional comments (18)
packages/i18n/src/locales/ja/translations.json (1)

873-874: Localization Update: "deactivated_user" Key Added
The newly introduced key "deactivated_user": "無効化されたユーザー" is correctly added to the common section. This update ensures that users of the Japanese locale receive a consistent and clear message regarding deactivated user status, in line with the broader localization improvements made in this PR.

packages/i18n/src/locales/ru/translations.json (1)

872-873: New translation key added for deactivated users.
The new entry

"deactivated_user": "Деактивированный пользователь"

has been correctly added immediately after the "view" key. This update aligns with the broader localization improvements and ensures that user status messages (specifically for deactivated users) render correctly. Please double-check that all locale files use consistent terminology.

packages/i18n/src/locales/ro/translations.json (1)

872-873: New translation key added for deactivated users.
The new entry

"deactivated_user": "Utilizator dezactivat"

has been correctly added following the "view" entry. This update is consistent with the changes made in other locales and will help in rendering accurate user status information throughout the application.

packages/i18n/src/locales/vi-VN/translations.json (1)

866-867: New Translation Entry for Deactivated User

The new key "deactivated_user": "Người dùng bị vô hiệu hóa" has been added immediately after the "view" key. The translation is clear, appropriate, and consistent with similar updates in other locale files. Please verify that the addition of the comma after "view": "Xem" does not conflict with any JSON parser requirements in context, though it appears correctly placed within the object.

packages/i18n/src/locales/ko/translations.json (1)

866-867: New Translation Entry for Deactivated User

The new key "deactivated_user": "비활성화된 사용자" has been inserted following the "view" key. The Korean translation accurately reflects the meaning of “deactivated user” and aligns with the modifications made across other locales. The formatting and placement of the new entry maintain consistency with the rest of the file.

packages/i18n/src/locales/fr/translations.json (1)

873-874: Added French Translation for deactivated_user
The new key "deactivated_user": "Utilisateur désactivé" has been correctly added in the "common" section. This update aligns the French locale with the other languages and ensures that users see a proper translation for deactivated users.

packages/i18n/src/locales/pl/translations.json (1)

868-869: Added Polish Translation for deactivated_user
The new key "deactivated_user": "Dezaktywowany użytkownik" has been appropriately introduced in the "common" section. This change improves the overall localization by ensuring that the "deactivated user" status is consistently translated across all supported languages.

packages/i18n/src/locales/es/translations.json (1)

875-876: Add Spanish Translation for "deactivated_user"
The new key "deactivated_user": "Usuario desactivado" has been added in the "common" section. This addition is consistent with the translations in other languages and improves the localization coverage for user account statuses.

packages/i18n/src/locales/ua/translations.json (1)

867-868: Add Ukrainian Translation for "deactivated_user"
The new entry "deactivated_user": "Деактивований користувач" integrates seamlessly into the file. The translation appears accurate and consistent with the corresponding keys in other locale files.

packages/i18n/src/locales/id/translations.json (1)

872-873: New Translation Key Addition for "deactivated_user"
The key "deactivated_user": "Pengguna dinonaktifkan" has been successfully added. This update aligns with similar translations in other locales and will help ensure consistent messaging for deactivated user statuses across the application.

packages/i18n/src/locales/it/translations.json (1)

871-872: New Translation Key Addition for "deactivated_user" in Italian Locale
The entry "deactivated_user": "Utente disattivato" has been added. This translation is consistent with counterparts in other languages and contributes to improved localization of user account status messaging. Additionally, note that the "view" key now appears with a trailing comma which is syntactically correct in the context of a JSON object.

packages/i18n/src/locales/de/translations.json (1)

865-866: New Translation Key Added for Deactivated User

The addition of "deactivated_user": "Deaktivierter Benutzer" successfully expands the localization support for the German language and aligns with similar updates in other languages. The key is consistent in terminology and placement relative to the existing "view" key.

packages/i18n/src/locales/sk/translations.json (1)

865-866: New Translation Key Added for Deactivated User

The new key "deactivated_user": "Deaktivovaný používateľ" has been added to the Slovak translations, ensuring consistency with the updates made in other locales. This enhancement improves the localization coverage of user status terminology without altering any existing translations.

packages/i18n/src/locales/en/translations.json (1)

705-706: Good addition of localization support for deactivated users!

Adding the new translation key "deactivated_user" will provide proper localization support for cases where user information needs to be displayed for deactivated accounts.

packages/i18n/src/locales/zh-TW/translations.json (1)

874-875: Translation properly added for Traditional Chinese locale.

The Traditional Chinese translation for "deactivated_user" has been correctly added, maintaining consistency with the English version.

web/core/components/core/description-versions/dropdown-item.tsx (3)

3-3: Good use of the i18n hook for internationalization.

Adding the useTranslation import enables proper localization of user-facing strings.


21-22: Appropriate setup of translation hook.

Adding a translation hook with clear comments improves code readability and maintainability.


27-31: Improved user experience with fallback for deactivated users.

This change provides a better user experience by showing a localized message when a user's display name is not available, which addresses the issue mentioned in PR objectives about ensuring correct user details are rendered.

@pushya22 pushya22 merged commit ef20b58 into preview Apr 9, 2025
5 of 6 checks passed
@pushya22 pushya22 deleted the fix/description-version-history branch April 9, 2025 14:27
@coderabbitai coderabbitai bot mentioned this pull request Apr 9, 2025
6 tasks
lifeiscontent pushed a commit that referenced this pull request Aug 18, 2025
* chore: intake form version history

* fix: remove autofocus from the copy markdown button

* chore: add logic to display deactivated user
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants