[WEB-3792, 3823] fix: intake form version history#6898
Conversation
WalkthroughThis pull request introduces a new enumeration ( Changes
Suggested reviewers
Poem
✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
|
Pull Request Linked with Plane Work Items
Comment Automatically Generated by Plane |
There was a problem hiding this comment.
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 namesThe 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
📒 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 accessibilityAdding
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 hookAdding the
useMemberhook 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 itemsReplacing direct reference to
issue.created_bywithgetUserDetailsfunction 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 hookGood addition of the
useMemberhook, maintaining consistency with other components that display user information.Also applies to: 55-55
158-158: Improves user display name resolutionUsing
getUserDetailsfunction 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 safetyImporting the
EInboxIssueSourceenum from constants adds type safety and consistency for inbox issue sources.
22-22: Enhances type safety with enum implementationAdding the
sourceproperty of typeEInboxIssueSourcereplaces 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 logicThe code now correctly implements conditional logic for displaying the last updated user's name, using the
getUserDetailshook if the version data is available, and falling back to the entity's creation information when needed.
43-43: Variable name updated for clarityThe variable name has been changed from
lastUpdatedByUserDetailsto the more specificlastUpdatedByUserDisplayName, 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 enumThe import statements now include the
EInboxIssueSourceenum from@plane/constants, which will be used to replace hardcoded string values.
36-36: Replaced magic string with enum constantReplaced the hardcoded string
"IN_APP"with the enumeration valueEInboxIssueSource.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 consistencyThe property name was updated from
createdBytocreatedByDisplayName, 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 sourcesThe
EInboxIssueSourceenum 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 hookThe
useMemberhook has been added with thegetUserDetailsfunction, which centralizes user information retrieval and makes the component more maintainable.
236-240: Improved display name handling based on issue sourceThis 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 literalsReplacing 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 safetyUpdating the
TInboxIssuetype to use theEInboxIssueSourceenum 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 tsxLength of output: 78
Action Required: Re-check enum value usage consistency
The enum now defines
FORMS = "FORMS"inpackages/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 refinedrgcommands) 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 usageReplacing the string comparison with the enum value improves code readability and maintainability, consistent with the changes in other files.
Also applies to: 35-36
There was a problem hiding this comment.
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 UserThe 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 UserThe 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
📒 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 UserThe 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 UserThe 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 fordeactivated_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 fordeactivated_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 UserThe 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 UserThe 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.
* chore: intake form version history * fix: remove autofocus from the copy markdown button * chore: add logic to display deactivated user
Description
This PR fixes the following bugs related to work item description version history-
Copy markdownbutton.Other improvements-
enumfor intake work item source instead of using hardcoded values.Type of Change
Summary by CodeRabbit
New Features
Refactor