[WEB-3368] feat: enhance workspace invitations with copyable invite links#6601
[WEB-3368] feat: enhance workspace invitations with copyable invite links#6601sriramveeraghanta merged 3 commits intopreviewfrom
Conversation
WalkthroughThis pull request introduces several modifications across the codebase. In the backend, serializers now include an extra field, Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Frontend
participant API
participant Serializer
User->>Frontend: Request workspace invitation
Frontend->>API: POST /invitations
API->>Serializer: Process invitation data (generate invite_link)
Serializer-->API: Return invitation data with invite_link
API->>Frontend: Return invitation response
Frontend->>User: Display invitation details
sequenceDiagram
participant User
participant UIComponent
participant Clipboard
User->>UIComponent: Click "Copy Invite Link" button
UIComponent->>Clipboard: Copy invite_link to clipboard
Clipboard-->UIComponent: Confirm copy action
UIComponent->>User: Show toast notification ("Copied!")
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
✨ Finishing Touches
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 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 (
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (2)
web/core/components/workspace/settings/invitations-list-item.tsx (1)
71-84: Add error feedback for users.While the function correctly handles copying invite links, it silently logs errors without informing users when something goes wrong.
Apply this diff to improve error handling:
const handleCopyText = () => { try { const inviteLink = new URL(invitationDetails.invite_link, window.location.origin).href; copyTextToClipboard(inviteLink).then(() => { setToast({ type: TOAST_TYPE.SUCCESS, title: t("common.link_copied"), message: t("entity.link_copied_to_clipboard", { entity: t("common.invite") }), }); }); } catch (error) { console.error("Error generating invite link:", error); + setToast({ + type: TOAST_TYPE.ERROR, + title: t("error"), + message: t("something_went_wrong_please_try_again"), + }); } };apiserver/plane/app/serializers/workspace.py (1)
94-97: Fix line length to comply with PEP 8.The
get_invite_linkmethod exceeds the recommended line length of 88 characters.Apply this diff to fix the line length:
- def get_invite_link(self, obj): - return f"/workspace-invitations/?invitation_id={obj.id}&email={obj.email}&slug={obj.workspace.slug}" + def get_invite_link(self, obj): + return ( + f"/workspace-invitations/?invitation_id={obj.id}" + f"&email={obj.email}&slug={obj.workspace.slug}" + )🧰 Tools
🪛 Ruff (0.8.2)
97-97: Line too long (108 > 88)
(E501)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (14)
apiserver/plane/app/serializers/workspace.py(5 hunks)apiserver/plane/app/views/workspace/invite.py(1 hunks)packages/i18n/src/locales/en/translations.json(2 hunks)packages/i18n/src/locales/es/translations.json(2 hunks)packages/i18n/src/locales/fr/translations.json(2 hunks)packages/i18n/src/locales/ja/translations.json(2 hunks)packages/i18n/src/locales/zh-CN/translations.json(2 hunks)packages/types/src/workspace.d.ts(1 hunks)web/app/[workspaceSlug]/(projects)/settings/members/page.tsx(1 hunks)web/app/invitations/page.tsx(2 hunks)web/core/components/account/auth-forms/auth-header.tsx(1 hunks)web/core/components/onboarding/invitations.tsx(2 hunks)web/core/components/workspace/settings/invitations-list-item.tsx(5 hunks)web/core/components/workspace/settings/members-list.tsx(2 hunks)
✅ Files skipped from review due to trivial changes (1)
- web/app/[workspaceSlug]/(projects)/settings/members/page.tsx
🧰 Additional context used
🪛 Ruff (0.8.2)
apiserver/plane/app/serializers/workspace.py
97-97: Line too long (108 > 88)
(E501)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: Analyze (javascript)
🔇 Additional comments (17)
web/core/components/workspace/settings/members-list.tsx (1)
65-65: LGTM! Improved translation key and styling.The changes enhance code clarity by:
- Using a more specific translation key for better context
- Adding proper height styling
- Cleaning up formatting
Also applies to: 69-69, 79-79
web/core/components/account/auth-forms/auth-header.tsx (1)
82-82: LGTM! Consistent property usage.The change properly uses the
logo_urlproperty and updates the size styling to use the more modernsize-9class.web/core/components/onboarding/invitations.tsx (1)
12-12: LGTM! Standardized logo component usage.The changes improve code consistency by using the shared WorkspaceLogo component with proper property names.
Also applies to: 98-102
packages/types/src/workspace.d.ts (1)
43-43: LGTM! Type definitions support new invite link feature.The changes:
- Add
invite_linkproperty to support the new copy invite link feature- Standardize logo property name to
logo_urlfor consistencyAlso applies to: 46-46
web/core/components/workspace/settings/invitations-list-item.tsx (3)
6-6: LGTM!The new imports are correctly organized and necessary for the new copy link functionality.
Also applies to: 10-11
86-103: LGTM!The menu items are well-structured with proper type definitions and conditional rendering based on permissions and availability.
175-211: LGTM!The UI changes improve accessibility with proper keyboard event handling and provide a better user experience with the context menu.
apiserver/plane/app/serializers/workspace.py (1)
62-62: LGTM!The addition of
logo_urlfield aligns with the frontend requirements for displaying workspace logos.web/app/invitations/page.tsx (1)
171-175: LGTM!The use of the
WorkspaceLogocomponent improves code reusability and consistency in logo rendering across the application.apiserver/plane/app/views/workspace/invite.py (1)
254-254: LGTM!The removal of the
total_membersannotation simplifies the queryset by removing unused data.packages/i18n/src/locales/zh-CN/translations.json (1)
845-847: LGTM! The translations are accurate and consistent.The new translations "待处理" for "pending" and "邀请" for "invite" are idiomatic Chinese and maintain consistency with similar terms used elsewhere in the application.
packages/i18n/src/locales/ja/translations.json (2)
845-845: LGTM! Clean JSON formatting.The addition of a trailing comma after the "install" key follows good JSON formatting practices, making future additions cleaner in version control.
846-847: LGTM! Accurate Japanese translations.The new translations are accurate and consistent with Japanese UI conventions:
- "保留中" is the correct translation for "pending"
- "招待" is the correct translation for "invite"
Both translations align well with the existing terminology in the file and are commonly used in Japanese user interfaces.
packages/i18n/src/locales/en/translations.json (1)
675-677: LGTM! The new translation keys are well-structured.The added translation keys for installation and invitation states are concise, follow the existing naming pattern, and align with the PR objectives for the workspace member invitation feature.
packages/i18n/src/locales/es/translations.json (1)
845-847: LGTM! Well-structured translations for the new invite functionality.The new translations for "pending" and "invite" are properly added to the Spanish locale file with correct translations that match the context of the invite link feature.
packages/i18n/src/locales/fr/translations.json (2)
845-845: LGTM! Added trailing comma for better git diffs.The addition of a trailing comma after the "install" translation is a good practice as it results in cleaner git diffs when new items are added.
846-847:Details
✅ Verification successful
Verify the translations in context.
The new translations look correct:
- "pending" → "En attente"
- "invite" → "Inviter"
However, let's verify that these translations are used consistently across the application, particularly in the workspace member invitations context mentioned in the PR objectives.
Run this script to check the usage of these translations:
🏁 Script executed:
#!/bin/bash # Description: Check for usage of pending and invite translations in the codebase # Search for pending translation key usage echo "Checking 'pending' translation usage:" rg -A 2 "t\(['\"]common\.pending['\"]" || rg -A 2 "t\(['\"]pending['\"]" # Search for invite translation key usage echo "Checking 'invite' translation usage:" rg -A 2 "t\(['\"]common\.invite['\"]" || rg -A 2 "t\(['\"]invite['\"]"Length of output: 851
Verified: Translations are Consistently Used
The translations for "pending" and "invite" are correctly integrated across the application. The shell script output confirms that:
t("common.pending")is used in the invitations list component.t("common.invite")is utilized in the notification message.No further action is needed.
…inks (#6601) * feat: invitation link url * feat: copy invite link from workspace invitations list * invitation reponse cleanup and logo url fix --------- Co-authored-by: pablohashescobar <nikhilschacko@gmail.com>
Description
Added an option to copy invite links for workspace member invitations.
Other Fixes
Type of Change
Screenshots and Media (if applicable)
References
WEB-3368
Summary by CodeRabbit
New Features
Style