-
Notifications
You must be signed in to change notification settings - Fork 438
fix: add detailed invitation error messages #1677
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
Conversation
…r handling - Refactored the `activateInvitationCode` method to return a `BaseResponse` instead of `void`, improving response handling. - Updated error handling to return specific error messages instead of throwing exceptions for invalid or already used invitation codes. - Adjusted the `InvitationModal` and `ActivationCodeInput` components to handle new response structure and display appropriate error messages. - Added new i18n translations for error messages related to invitation code activation.
WalkthroughConvert invitation activation from exception-based errors to structured Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
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. 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.
Actionable comments posted: 1
🧹 Nitpick comments (1)
packages/ai-workspace-common/src/components/settings/activation-code-input.tsx (1)
32-42: Add defensive null safety checks for the response structure.While the TypeScript types may guarantee the response structure, adding explicit null safety checks would make the code more defensive and prevent potential runtime errors if the API contract changes.
Apply this diff to add null safety:
const response = await getClient().activateInvitationCode({ body: { code: activationCode.trim() }, }); - if (!response.data.success) { - const errorMessage = response.data.errMsg - ? t(response.data.errMsg) + if (!response?.data?.success) { + const errorMessage = response?.data?.errMsg + ? t(response.data.errMsg) : t('settings.account.activateInvitationCodeFailed'); message.error(errorMessage); return; }Alternatively, you can add an early validation:
const response = await getClient().activateInvitationCode({ body: { code: activationCode.trim() }, }); + + if (!response?.data) { + message.error(t('settings.account.activateInvitationCodeFailed')); + return; + } if (!response.data.success) {
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (6)
apps/api/src/modules/invitation/invitation.controller.ts(1 hunks)apps/api/src/modules/invitation/invitation.service.ts(5 hunks)packages/ai-workspace-common/src/components/settings/activation-code-input.tsx(1 hunks)packages/ai-workspace-common/src/components/settings/invitation-modal.tsx(1 hunks)packages/i18n/src/en-US/ui.ts(1 hunks)packages/i18n/src/zh-Hans/ui.ts(1 hunks)
🧰 Additional context used
📓 Path-based instructions (24)
**/*.{js,ts,jsx,tsx}
📄 CodeRabbit inference engine (.cursorrules)
**/*.{js,ts,jsx,tsx}: Always use optional chaining (?.) when accessing object properties
Always use nullish coalescing (??) or default values for potentially undefined values
Always check array existence before using array methods
Always validate object properties before destructuring
Always use single quotes for string literals in JavaScript/TypeScript code
**/*.{js,ts,jsx,tsx}: Use semicolons at the end of statements
Include spaces around operators (e.g.,a + binstead ofa+b)
Always use curly braces for control statements
Place opening braces on the same line as their statement
**/*.{js,ts,jsx,tsx}: Group import statements in order: React/framework libraries, third-party libraries, internal modules, relative path imports, type imports, style imports
Sort imports alphabetically within each import group
Leave a blank line between import groups
Extract complex logic into custom hooks
Use functional updates for state (e.g.,setCount(prev => prev + 1))
Split complex state into multiple state variables rather than single large objects
Use useReducer for complex state logic instead of multiple useState calls
Files:
packages/i18n/src/zh-Hans/ui.tspackages/i18n/src/en-US/ui.tspackages/ai-workspace-common/src/components/settings/invitation-modal.tsxapps/api/src/modules/invitation/invitation.service.tspackages/ai-workspace-common/src/components/settings/activation-code-input.tsxapps/api/src/modules/invitation/invitation.controller.ts
**/*.{js,ts,tsx,jsx,py,java,cpp,c,cs,rb,go,rs,php,swift,kt,scala,r,m,mm,sql}
📄 CodeRabbit inference engine (.cursor/rules/00-language-priority.mdc)
**/*.{js,ts,tsx,jsx,py,java,cpp,c,cs,rb,go,rs,php,swift,kt,scala,r,m,mm,sql}: All code comments MUST be written in English
All variable names, function names, class names, and other identifiers MUST use English words
Comments should be concise and explain 'why' rather than 'what'
Use proper grammar and punctuation in comments
Keep comments up-to-date when code changes
Document complex logic, edge cases, and important implementation details
Use clear, descriptive names that indicate purpose
Avoid abbreviations unless they are universally understood
Files:
packages/i18n/src/zh-Hans/ui.tspackages/i18n/src/en-US/ui.tspackages/ai-workspace-common/src/components/settings/invitation-modal.tsxapps/api/src/modules/invitation/invitation.service.tspackages/ai-workspace-common/src/components/settings/activation-code-input.tsxapps/api/src/modules/invitation/invitation.controller.ts
**/*.{js,ts,tsx,jsx}
📄 CodeRabbit inference engine (.cursor/rules/00-language-priority.mdc)
Use JSDoc style comments for functions and classes in JavaScript/TypeScript
Files:
packages/i18n/src/zh-Hans/ui.tspackages/i18n/src/en-US/ui.tspackages/ai-workspace-common/src/components/settings/invitation-modal.tsxapps/api/src/modules/invitation/invitation.service.tspackages/ai-workspace-common/src/components/settings/activation-code-input.tsxapps/api/src/modules/invitation/invitation.controller.ts
**/{i18n,locales,translations,lang}/**/*.{json,ts,tsx,js,jsx,properties}
📄 CodeRabbit inference engine (.cursor/rules/00-language-priority.mdc)
Use Chinese for all user-facing communication
Files:
packages/i18n/src/zh-Hans/ui.tspackages/i18n/src/en-US/ui.ts
**/*.{js,jsx,ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/01-code-style.mdc)
**/*.{js,jsx,ts,tsx}: Use single quotes for string literals in TypeScript/JavaScript
Always use optional chaining (?.) when accessing object properties in TypeScript/JavaScript
Always use nullish coalescing (??) or default values for potentially undefined values in TypeScript/JavaScript
Always check array existence before using array methods in TypeScript/JavaScript
Validate object properties before destructuring in TypeScript/JavaScript
Use ES6+ features like arrow functions, destructuring, and spread operators in TypeScript/JavaScript
Avoid magic numbers and strings - use named constants in TypeScript/JavaScript
Use async/await instead of raw promises for asynchronous code in TypeScript/JavaScript
Files:
packages/i18n/src/zh-Hans/ui.tspackages/i18n/src/en-US/ui.tspackages/ai-workspace-common/src/components/settings/invitation-modal.tsxapps/api/src/modules/invitation/invitation.service.tspackages/ai-workspace-common/src/components/settings/activation-code-input.tsxapps/api/src/modules/invitation/invitation.controller.ts
**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/03-typescript-guidelines.mdc)
**/*.{ts,tsx}: Avoid usinganytype whenever possible - useunknowntype instead with proper type guards
Always define explicit return types for functions, especially for public APIs
Prefer extending existing types over creating entirely new types
Use TypeScript utility types (Partial<T>,Pick<T, K>,Omit<T, K>,Readonly<T>,Record<K, T>) to derive new types
Use union types and intersection types to combine existing types
Always import types explicitly using theimport typesyntax
Group type imports separately from value imports
Minimize creating local type aliases for imported types
Files:
packages/i18n/src/zh-Hans/ui.tspackages/i18n/src/en-US/ui.tspackages/ai-workspace-common/src/components/settings/invitation-modal.tsxapps/api/src/modules/invitation/invitation.service.tspackages/ai-workspace-common/src/components/settings/activation-code-input.tsxapps/api/src/modules/invitation/invitation.controller.ts
**/*.{js,ts,jsx,tsx,css,json}
📄 CodeRabbit inference engine (.cursor/rules/04-code-formatting.mdc)
Maximum line length of 100 characters
Files:
packages/i18n/src/zh-Hans/ui.tspackages/i18n/src/en-US/ui.tspackages/ai-workspace-common/src/components/settings/invitation-modal.tsxapps/api/src/modules/invitation/invitation.service.tspackages/ai-workspace-common/src/components/settings/activation-code-input.tsxapps/api/src/modules/invitation/invitation.controller.ts
**/*.{js,ts,jsx,tsx,css,json,yml,yaml}
📄 CodeRabbit inference engine (.cursor/rules/04-code-formatting.mdc)
Use 2 spaces for indentation, no tabs
Files:
packages/i18n/src/zh-Hans/ui.tspackages/i18n/src/en-US/ui.tspackages/ai-workspace-common/src/components/settings/invitation-modal.tsxapps/api/src/modules/invitation/invitation.service.tspackages/ai-workspace-common/src/components/settings/activation-code-input.tsxapps/api/src/modules/invitation/invitation.controller.ts
**/*.{js,ts,jsx,tsx,css,json,yml,yaml,md}
📄 CodeRabbit inference engine (.cursor/rules/04-code-formatting.mdc)
No trailing whitespace at the end of lines
Files:
packages/i18n/src/zh-Hans/ui.tspackages/i18n/src/en-US/ui.tspackages/ai-workspace-common/src/components/settings/invitation-modal.tsxapps/api/src/modules/invitation/invitation.service.tspackages/ai-workspace-common/src/components/settings/activation-code-input.tsxapps/api/src/modules/invitation/invitation.controller.ts
**/*.{css,scss,sass,less,js,jsx,ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/09-design-system.mdc)
**/*.{css,scss,sass,less,js,jsx,ts,tsx}: Primary color (#155EEF) should be used for main brand color in buttons, links, and accents
Error color (#F04438) should be used for error states and destructive actions
Success color (#12B76A) should be used for success states and confirmations
Warning color (#F79009) should be used for warnings and important notifications
Info color (#0BA5EC) should be used for informational elements
Files:
packages/i18n/src/zh-Hans/ui.tspackages/i18n/src/en-US/ui.tspackages/ai-workspace-common/src/components/settings/invitation-modal.tsxapps/api/src/modules/invitation/invitation.service.tspackages/ai-workspace-common/src/components/settings/activation-code-input.tsxapps/api/src/modules/invitation/invitation.controller.ts
packages/i18n/src/{en-US,zh-Hans}/**
📄 CodeRabbit inference engine (.cursor/rules/09-i18n-guidelines.mdc)
Add new translation keys to both language files (en-US and zh-Hans)
Files:
packages/i18n/src/zh-Hans/ui.tspackages/i18n/src/en-US/ui.ts
packages/i18n/src/**
📄 CodeRabbit inference engine (.cursor/rules/09-i18n-guidelines.mdc)
packages/i18n/src/**: Maintain consistency in translation key naming conventions
Use descriptive translation keys that reflect the content
Group related translation keys together in the translation file structure
Use namespaces for different sections of the application in translation keys
Follow a hierarchical structure for nested components in translation key organization
Files:
packages/i18n/src/zh-Hans/ui.tspackages/i18n/src/en-US/ui.ts
**/*.{tsx,ts}
📄 CodeRabbit inference engine (.cursor/rules/09-i18n-guidelines.mdc)
**/*.{tsx,ts}: Use the translation wrapper component and useTranslation hook in components
Ensure all user-facing text is translatable
Files:
packages/i18n/src/zh-Hans/ui.tspackages/i18n/src/en-US/ui.tspackages/ai-workspace-common/src/components/settings/invitation-modal.tsxapps/api/src/modules/invitation/invitation.service.tspackages/ai-workspace-common/src/components/settings/activation-code-input.tsxapps/api/src/modules/invitation/invitation.controller.ts
**/*.{tsx,ts,json}
📄 CodeRabbit inference engine (.cursor/rules/09-i18n-guidelines.mdc)
Support dynamic content with placeholders in translations
Files:
packages/i18n/src/zh-Hans/ui.tspackages/i18n/src/en-US/ui.tspackages/ai-workspace-common/src/components/settings/invitation-modal.tsxapps/api/src/modules/invitation/invitation.service.tspackages/ai-workspace-common/src/components/settings/activation-code-input.tsxapps/api/src/modules/invitation/invitation.controller.ts
**/*.{tsx,ts,jsx,js,vue,css,scss,less}
📄 CodeRabbit inference engine (.cursor/rules/11-ui-design-patterns.mdc)
**/*.{tsx,ts,jsx,js,vue,css,scss,less}: Use the primary blue (#155EEF) for main UI elements, CTAs, and active states
Use red (#F04438) only for errors, warnings, and destructive actions
Use green (#12B76A) for success states and confirmations
Use orange (#F79009) for warning states and important notifications
Use blue (#0BA5EC) for informational elements
Primary buttons should be solid with the primary color
Secondary buttons should have a border with transparent or light background
Danger buttons should use the error color
Use consistent padding, border radius, and hover states for all buttons
Follow fixed button sizes based on their importance and context
Use consistent border radius (rounded-lg) for all cards
Apply light shadows (shadow-sm) for card elevation
Maintain consistent padding inside cards (p-4orp-6)
Use subtle borders for card separation
Ensure proper spacing between card elements
Apply consistent styling to all form inputs
Use clear visual indicators for focus, hover, and error states in form elements
Apply proper spacing between elements using 8px, 16px, 24px increments
Ensure proper alignment of elements (left, center, or right)
Use responsive layouts that work across different device sizes
Maintain a minimum contrast ratio of 4.5:1 for text
Files:
packages/i18n/src/zh-Hans/ui.tspackages/i18n/src/en-US/ui.tspackages/ai-workspace-common/src/components/settings/invitation-modal.tsxapps/api/src/modules/invitation/invitation.service.tspackages/ai-workspace-common/src/components/settings/activation-code-input.tsxapps/api/src/modules/invitation/invitation.controller.ts
**/*.{tsx,ts,jsx,js,vue}
📄 CodeRabbit inference engine (.cursor/rules/11-ui-design-patterns.mdc)
**/*.{tsx,ts,jsx,js,vue}: Include appropriate loading states for async actions in buttons
Group related form elements with appropriate spacing
Provide clear validation feedback for forms
Ensure proper labeling and accessibility for form elements
Ensure all interactive elements are keyboard accessible
Include appropriate ARIA attributes for complex components
Provide alternative text for images and icons
Support screen readers with semantic HTML elements
Files:
packages/i18n/src/zh-Hans/ui.tspackages/i18n/src/en-US/ui.tspackages/ai-workspace-common/src/components/settings/invitation-modal.tsxapps/api/src/modules/invitation/invitation.service.tspackages/ai-workspace-common/src/components/settings/activation-code-input.tsxapps/api/src/modules/invitation/invitation.controller.ts
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (.cursor/rules/08-contributing-guidelines.mdc)
**/*.{ts,tsx,js,jsx}: Follow the TypeScript/JavaScript style guidelines
Ensure code is well-tested and documented
Files:
packages/i18n/src/zh-Hans/ui.tspackages/i18n/src/en-US/ui.tspackages/ai-workspace-common/src/components/settings/invitation-modal.tsxapps/api/src/modules/invitation/invitation.service.tspackages/ai-workspace-common/src/components/settings/activation-code-input.tsxapps/api/src/modules/invitation/invitation.controller.ts
**/*.{jsx,tsx}
📄 CodeRabbit inference engine (.cursorrules)
**/*.{jsx,tsx}: Always use tailwind css to style the component
Always wrap pure components with React.memo to prevent unnecessary re-renders
Always use useMemo for expensive computations or complex object creation
Always use useCallback for function props to maintain referential equality
Always specify proper dependency arrays in useEffect to prevent infinite loops
Always avoid inline object/array creation in render to prevent unnecessary re-renders
Always use proper key props when rendering lists
Always split nested components with closures into separate components to avoid performance issues and improve code maintainability
**/*.{jsx,tsx}: Always wrap pure components with React.memo to prevent unnecessary re-renders
Always use useMemo for expensive computations or complex object creation in React
Always use useCallback for function props to maintain referential equality in React
Always specify proper dependency arrays in useEffect to prevent infinite loops in React
Always avoid inline object/array creation in render to prevent unnecessary re-renders in React
Always use proper key props when rendering lists in React (avoid using index when possible)
Always split nested components with closures into separate components in React
Use lazy loading for components that are not immediately needed in React
Debounce handlers for events that might fire rapidly (resize, scroll, input) in React
Implement fallback UI for components that might fail in React
Use error boundaries to catch and handle runtime errors in React
**/*.{jsx,tsx}: Place each attribute on a new line when a component has multiple attributes in JSX
Use self-closing tags for elements without children in JSX
Keep JSX expressions simple, extract complex logic to variables
Put closing brackets for multi-line JSX on a new line
**/*.{jsx,tsx}: Component file names should match the component name
Organize function components in order: imports, type definitions, constants, component function, hook calls, e...
Files:
packages/ai-workspace-common/src/components/settings/invitation-modal.tsxpackages/ai-workspace-common/src/components/settings/activation-code-input.tsx
**/*.{jsx,tsx,css}
📄 CodeRabbit inference engine (.cursor/rules/01-code-style.mdc)
**/*.{jsx,tsx,css}: Use Tailwind CSS for styling components
Follow the utility-first approach with Tailwind CSS
Group related utility classes together in Tailwind CSS
Prefer Tailwind utilities over custom CSS when possible
Files:
packages/ai-workspace-common/src/components/settings/invitation-modal.tsxpackages/ai-workspace-common/src/components/settings/activation-code-input.tsx
**/*.{jsx,tsx,js}
📄 CodeRabbit inference engine (.cursor/rules/05-code-organization.mdc)
Each component file should contain only one main component
Files:
packages/ai-workspace-common/src/components/settings/invitation-modal.tsxpackages/ai-workspace-common/src/components/settings/activation-code-input.tsx
**/*.tsx
📄 CodeRabbit inference engine (.cursor/rules/05-code-organization.mdc)
Explicitly type props with interfaces or types in React components
Files:
packages/ai-workspace-common/src/components/settings/invitation-modal.tsxpackages/ai-workspace-common/src/components/settings/activation-code-input.tsx
**/*.{tsx,jsx}
📄 CodeRabbit inference engine (.cursor/rules/08-contributing-guidelines.mdc)
Use React best practices for frontend code
Files:
packages/ai-workspace-common/src/components/settings/invitation-modal.tsxpackages/ai-workspace-common/src/components/settings/activation-code-input.tsx
apps/api/src/**/*.{controller,service}.ts
📄 CodeRabbit inference engine (.cursor/rules/06-api-structure.mdc)
Implement proper error handling in API modules
Files:
apps/api/src/modules/invitation/invitation.service.tsapps/api/src/modules/invitation/invitation.controller.ts
apps/api/src/**/*.controller.ts
📄 CodeRabbit inference engine (.cursor/rules/06-api-structure.mdc)
Document APIs with OpenAPI specifications
Files:
apps/api/src/modules/invitation/invitation.controller.ts
🧠 Learnings (3)
📚 Learning: 2025-11-25T03:04:41.334Z
Learnt from: CR
Repo: refly-ai/refly PR: 0
File: .cursor/rules/09-i18n-guidelines.mdc:0-0
Timestamp: 2025-11-25T03:04:41.334Z
Learning: Applies to packages/i18n/src/{en-US,zh-Hans}/** : Add new translation keys to both language files (en-US and zh-Hans)
Applied to files:
packages/i18n/src/zh-Hans/ui.tspackages/i18n/src/en-US/ui.ts
📚 Learning: 2025-11-25T03:03:19.158Z
Learnt from: CR
Repo: refly-ai/refly PR: 0
File: .cursor/rules/00-language-priority.mdc:0-0
Timestamp: 2025-11-25T03:03:19.158Z
Learning: Applies to **/{i18n,locales,translations,lang}/**/*.{json,ts,tsx,js,jsx,properties} : Use Chinese for all user-facing communication
Applied to files:
packages/i18n/src/zh-Hans/ui.ts
📚 Learning: 2025-11-25T03:04:12.836Z
Learnt from: CR
Repo: refly-ai/refly PR: 0
File: .cursor/rules/06-api-structure.mdc:0-0
Timestamp: 2025-11-25T03:04:12.836Z
Learning: Applies to apps/api/src/{auth,user,project,canvas,rag,knowledge,search,skill,share,code-artifact}/**/*.{controller,service}.ts : Use dependency injection for module dependencies in NestJS
Applied to files:
apps/api/src/modules/invitation/invitation.service.ts
🧬 Code graph analysis (1)
apps/api/src/modules/invitation/invitation.service.ts (3)
packages/ai-workspace-common/src/requests/types.gen.ts (1)
BaseResponse(2446-2467)packages/openapi-schema/src/types.gen.ts (1)
BaseResponse(2446-2467)packages/request/src/requests/types.gen.ts (1)
BaseResponse(2446-2467)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: build / Build
🔇 Additional comments (5)
packages/i18n/src/en-US/ui.ts (1)
2632-2652: Invitation activation error keys correctly mirror backend errMsg valuesThe new invitation-code error translations under
settings.accountcover all backenderrMsgvariants and keep wording consistent with the existing generic failure message; duplication withactivateInvitationCodeFailedlooks intentional for backward compatibility. Parity withzh-Hansis also in place.Based on learnings, both en-US and zh-Hans locales define the same keys.
packages/i18n/src/zh-Hans/ui.ts (1)
2603-2620: 新增邀请码错误文案与英文版及后端键值保持一致5 个新的邀请码错误提示键与后端
errMsg键名一一对应,文案表达清晰,语义与 en-US 版本一致,满足双语与 i18n 规范。Based on learnings, zh-Hans has been kept in sync with en-US for these keys.
apps/api/src/modules/invitation/invitation.service.ts (2)
1-7: UsingBaseResponsefrom shared schema keeps invitation APIs consistentImporting
BaseResponsefrom@refly/openapi-schemaand using it as the service return type aligns this module with the shared OpenAPI-generated types and other APIs.Please confirm the OpenAPI schema for the invitation module now declares
/v1/invitation/activateresponses asBaseResponseso generators stay in sync with this change.
132-214: StructuredBaseResponsehandling for invitation activation looks correctThe refactor cleanly maps each business rule to a specific translation key:
- Invalid code →
settings.account.activateInvitationCodeInvalid- Non-pending / already used →
settings.account.activateInvitationCodeUsed- Invitee already invited by anyone →
settings.account.activateInvitationCodeAlreadyInvited- Self-invite →
settings.account.activateInvitationCodeOwnCode- Already accepted with same inviter/invitee →
settings.account.activateInvitationCodeAlreadyActivatedand only returns
{ success: true }after updating the code, markinghasBeenInvited, and issuing credits, which matches the intended flow.Please verify that the frontend (e.g.,
activation-code-input.tsx) is usingresponse.data.errMsgas a translation key (rather than raw text), and that all 5 keys exist in both locales, matching these string literals.apps/api/src/modules/invitation/invitation.controller.ts (1)
19-26: Controller now correctly propagates the serviceBaseResponsefor activationReturning the
InvitationService.activateInvitationCoderesult directly lets clients see thesuccessflag and anyerrMsgwithout extra wrapping, matching the new service contract.Please double-check that the OpenAPI response type for
POST /v1/invitation/activatematchesBaseResponseso generated client methods and this controller signature stay consistent.
| const handleCopyInvitationCode = async (invitationCode: string) => { | ||
| try { | ||
| const invitationText = `* Join Refly and start your AI automation journey.\n\n* Invitation code: ${invitationCode}\n\n* Click the link and enter the code to join: https://refly.ai`; | ||
| const invitationText = `Unlock Refly.ai's vibe-workflow and supercharge your automation with Banana, Gemini, and other top-tier AI models — plus 3,000 free credits to get you started! Invitation code: ${invitationCode} Join here → https://refly.ai`; |
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.
Hardcoded text violates internationalization guidelines.
The invitation text is hardcoded in English and not using the translation system. Per coding guidelines, all user-facing text must be translatable using the t() function.
Additionally, this line exceeds the 100-character limit, and there are double spaces before "Join here".
Apply this diff to fix the internationalization issue:
- const invitationText = `Unlock Refly.ai's vibe-workflow and supercharge your automation with Banana, Gemini, and other top-tier AI models — plus 3,000 free credits to get you started! Invitation code: ${invitationCode} Join here → https://refly.ai`;
+ const invitationText = t('settings.account.invitationMessage', {
+ code: invitationCode,
+ url: 'https://refly.ai',
+ });Then add the corresponding translation keys in the i18n files:
packages/i18n/src/en-US/ui.ts:
invitationMessage:
'Unlock Refly.ai\'s vibe-workflow and supercharge your automation with ' +
'Banana, Gemini, and other top-tier AI models — plus 3,000 free credits ' +
'to get you started! Invitation code: {{code}} Join here → {{url}}',packages/i18n/src/zh-Hans/ui.ts:
invitationMessage:
'解锁 Refly.ai 的 vibe-workflow,使用 Banana、Gemini 和其他顶级 AI 模型增强您的自动化能力' +
'——还有 3,000 免费积分助您开始!邀请码:{{code}} 点击加入 → {{url}}',Note: Please verify if "Banana" is correct or if it should be "Claude" or another AI model name.
🤖 Prompt for AI Agents
In packages/ai-workspace-common/src/components/settings/invitation-modal.tsx
around line 50, the invitation string is hardcoded in English, exceeds 100
characters, and contains double spaces; replace it with a translatable call
using t('invitationMessage', { code: invitationCode, url: 'https://refly.ai' })
(ensure no double spaces and wrap arguments to satisfy line length), and then
add the provided translation keys to packages/i18n/src/en-US/ui.ts and
packages/i18n/src/zh-Hans/ui.ts (confirm the AI model name "Banana" is correct
before committing).
Summary
Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.
Tip
Close issue syntax:
Fixes #<issue number>orResolves #<issue number>, see documentation for more details.Impact Areas
Please check the areas this PR affects:
Screenshots/Videos
Checklist
Important
Please review the checklist below before submitting your pull request.
dev/reformat(backend) andcd web && npx lint-staged(frontend) to appease the lint godsSummary by CodeRabbit
Bug Fixes
Improvements
Documentation
✏️ Tip: You can customize this high-level summary in your review settings.