Skip to content

Comments

[WEB-3368] feat: enhance workspace invitations with copyable invite links#6601

Merged
sriramveeraghanta merged 3 commits intopreviewfrom
feat-invitation-link
Feb 13, 2025
Merged

[WEB-3368] feat: enhance workspace invitations with copyable invite links#6601
sriramveeraghanta merged 3 commits intopreviewfrom
feat-invitation-link

Conversation

@prateekshourya29
Copy link
Member

@prateekshourya29 prateekshourya29 commented Feb 13, 2025

Description

Added an option to copy invite links for workspace member invitations.

Other Fixes

  • Refined workspace member invitation API response.
  • Fixed workspace logo in onboarding and invitation flows.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • Feature (non-breaking change which adds functionality)
  • Improvement (change that would cause existing functionality to not work as expected)
  • Code refactoring
  • Performance improvements
  • Documentation update

Screenshots and Media (if applicable)

image

References

WEB-3368

Summary by CodeRabbit

  • New Features

    • Workspaces now display logos across the app.
    • Invitations include a direct invite link for easy sharing.
    • New translation keys for statuses like “Invite” and “Pending” enhance localization.
  • Style

    • Updated layouts now utilize full-height sections for improved screen consistency.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 13, 2025

Walkthrough

This pull request introduces several modifications across the codebase. In the backend, serializers now include an extra field, logo_url, and a new invite_link generated via a serializer method, while invitation views have been simplified by removing membership count annotations. Localization JSON files for multiple languages have been updated with new keys for pending actions and invitations. Type definitions have been revised to match new field names. On the frontend, the workspace logo rendering is now encapsulated in a dedicated component, and UI components handling invitations have been updated with additional interaction capabilities such as copying invite links.

Changes

File(s) Change Summary
apiserver/.../serializers/workspace.py - Updated WorkspaceLiteSerializer to include logo_url.
- Modified WorkSpaceMemberInviteSerializer: switched to WorkspaceLiteSerializer, removed total_members, added invite_link as a SerializerMethodField, and updated read_only_fields.
apiserver/.../views/workspace/invite.py - Removed annotation for total members in get_queryset.
- Streamlined logic in the create method for workspace invitation handling (bulk creation, conflict ignoring).
packages/i18n/src/locales/{en,es,fr,ja,zh-CN}/translations.json - Added new keys pending and invite in each locale.
- Updated the existing install key formatting/text in some locales.
packages/types/src/workspace.d.ts - Added new property invite_link: string to IWorkspaceMemberInvitation.
- Renamed the logo property to logo_url: string in the same interface.
web/app/[workspaceSlug]/(projects)/settings/members/page.tsx - Modified <section> element's className to include h-full.
web/app/invitations/page.tsx - Replaced inline workspace logo rendering with the new WorkspaceLogo component.
web/core/components/account/auth-forms/auth-header.tsx - Changed reference from workspace?.logo to workspace?.logo_url.
- Updated styling class from "w-8 h-9 flex-shrink-0" to "size-9 flex-shrink-0".
web/core/components/onboarding/invitations.tsx - Imported and used WorkspaceLogo component instead of inline conditional rendering for workspace logos.
web/core/components/workspace/settings/invitations-list-item.tsx - Added handleCopyText method to copy invite links with toast feedback.
- Introduced MENU_ITEMS with new icons (LinkIcon, Trash2) for context menu actions.
web/core/components/workspace/settings/members-list.tsx - Adjusted UI styling: updated the Collapsible component to include h-full and refined the translation key for pending invites.

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
Loading
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!")
Loading

Possibly related PRs

Suggested labels

🌟enhancement, 🌐frontend

Suggested reviewers

  • sriramveeraghanta
  • anmolsinghbhatia
  • rahulramesha

Poem

I'm a rabbit with code so bright,
Hopping through changes in morning light,
Logos now bloom with a splash of flair,
Invite links sparkle, floating in the air,
With every line, my heart does delight,
Hop on, fellow devs—our garden's in sight!
🐇✨

✨ Finishing Touches
  • 📝 Generate Docstrings (Beta)

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?

❤️ Share
🪧 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. (Beta)
  • @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 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.

@prateekshourya29 prateekshourya29 changed the title [WEB-3368] feat: In [WEB-3368] feat: enhance workspace invitations with copyable invite links Feb 13, 2025
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 (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_link method 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

📥 Commits

Reviewing files that changed from the base of the PR and between b88ae11 and 3f13cde.

📒 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_url property and updates the size styling to use the more modern size-9 class.

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_link property to support the new copy invite link feature
  • Standardize logo property name to logo_url for consistency

Also 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_url field aligns with the frontend requirements for displaying workspace logos.

web/app/invitations/page.tsx (1)

171-175: LGTM!

The use of the WorkspaceLogo component 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_members annotation 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.

@sriramveeraghanta sriramveeraghanta merged commit 3528d2c into preview Feb 13, 2025
5 of 6 checks passed
@sriramveeraghanta sriramveeraghanta deleted the feat-invitation-link branch February 13, 2025 18:05
lifeiscontent pushed a commit that referenced this pull request Aug 18, 2025
…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>
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.

4 participants