Skip to content

Update User and Organization Profiles to support BlueSky instead of twitter #8244

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

Merged
merged 12 commits into from
May 27, 2025

Conversation

bobbykolev
Copy link
Collaborator

@bobbykolev bobbykolev commented May 22, 2025

⚠️dependant on alkem-io/server#5157

  • Update User settings to support social reference to BlueSky instead of twitter;
  • Update the user profile to display BlueSky similar to the other Social icons;

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features

    • Added support for BlueSky social network, including a new BlueSky icon and the ability to display and input BlueSky handles in user and organization forms, social links, and admin components.
    • Enhanced organization form with integrated social network fields (LinkedIn, BlueSky, GitHub) and improved validation and submission handling.
  • Refactor

    • Replaced all Twitter-related fields, icons, and references with BlueSky equivalents across user forms, social components, and admin interfaces.
    • Improved profile validation schema to prevent social network names in references and extracted common validation rules.

Copy link

coderabbitai bot commented May 22, 2025

Warning

Rate limit exceeded

@ccanos has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 6 minutes and 50 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 7181a2b and 888b739.

📒 Files selected for processing (2)
  • src/core/i18n/en/translation.en.json (2 hunks)
  • src/domain/platform/admin/components/Organization/OrganizationForm.tsx (9 hunks)

Walkthrough

The changes replace all references to the Twitter social network with BlueSky (bsky) throughout the codebase. This includes updating model interfaces, form fields, validation, UI components, icon usage, and social network enumerations. A new BlueSky icon component is introduced, and the SocialNetworkEnum is extended to support BlueSky. Additional enhancements include validation schema refactoring, form submission improvements, and localization updates.

Changes

File(s) Change Summary
src/domain/community/user/models/UserModel.ts Replaced twitter property with bsky in the UserFormGenerated interface.
src/domain/community/user/userForm/UserForm.tsx Replaced all Twitter-related logic, variables, and validation with BlueSky equivalents in the UserForm component.
src/domain/platform/admin/components/Common/SocialSegment.tsx Replaced Twitter input field and icon with BlueSky equivalents; added optional fieldNames prop for email field.
src/domain/shared/components/SocialLinks/SocialLinks.tsx Added support for bsky in the social icon mapping and imported the BlueSky icon.
src/domain/shared/components/SocialLinks/icons/BlueSky.tsx Introduced a new BlueSky SVG icon React component.
src/domain/shared/components/SocialLinks/models/SocialNetworks.ts Added bsky to the SocialNetworkEnum enumeration and introduced socialNames array including bsky.
.vscode/settings.json Added "bsky" to the custom spell checker words list.
src/core/i18n/en/translation.en.json Added URL validation message and localized social link names including BlueSky.
src/domain/common/profile/ProfileModelUtils.ts Added braces to conditional block and simplified return in mapProfileModelToUpdateProfileInput.
src/domain/platform/admin/components/Common/ProfileSegment.ts x Refactored validation schema to extract common props and added schema with references excluding social names.
src/domain/platform/admin/components/Organization/OrganizationForm.tsx Added LinkedIn, BlueSky, GitHub social fields with validation; updated form submission to async with UI feedback.
src/domain/platform/admin/components/Organization/OrganizationPage.tsx Updated handleSubmit to return promises explicitly and simplified JSX props.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant UserForm
    participant SocialSegment
    participant SocialLinks
    participant BlueSkyIcon

    User->>UserForm: Fill out user form
    UserForm->>SocialSegment: Render social input fields
    SocialSegment->>BlueSkyIcon: Display BlueSky icon for bsky field
    UserForm->>SocialLinks: Pass bsky handle for display
    SocialLinks->>BlueSkyIcon: Render BlueSky icon if bsky present
Loading

Suggested labels

client, enhancement, UX

Suggested reviewers

  • bobbykolev
✨ Finishing Touches
  • 📝 Generate Docstrings

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.

❤️ 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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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 generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @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.

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.

@bobbykolev bobbykolev marked this pull request as ready for review May 23, 2025 08:04
Copy link

@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)
src/domain/shared/components/SocialLinks/icons/BlueSky.tsx (1)

1-14: Consider theming support and accessibility improvements.

The icon implementation is solid, but there are a couple of enhancement opportunities:

  1. Theming: The hardcoded color #0085ff might not adapt well to theme changes (light/dark mode).
  2. Accessibility: Consider adding accessibility props for screen readers.

Here's an enhanced version that addresses these concerns:

-const BlueSky = (props: SvgIconProps) => {
+const BlueSky = (props: SvgIconProps) => {
   return (
-    <SvgIcon viewBox="0 -3.268 64 68.414" width="24" height="24" {...props}>
+    <SvgIcon 
+      viewBox="0 -3.268 64 68.414" 
+      width="24" 
+      height="24" 
+      aria-label="BlueSky"
+      {...props}
+    >
       <path
-        fill="#0085ff"
+        fill={props.sx?.color || "#0085ff"}
         d="M13.873 3.805C21.21 9.332 29.103 20.537 32 26.55v15.882c0-.338-.13.044-.41.867-1.512 4.456-7.418 21.847-20.923 7.944-7.111-7.32-3.819-14.64 9.125-16.85-7.405 1.264-15.73-.825-18.014-9.015C1.12 23.022 0 8.51 0 6.55 0-3.268 8.579-.182 13.873 3.805zm36.254 0C42.79 9.332 34.897 20.537 32 26.55v15.882c0-.338.13.044.41.867 1.512 4.456 7.418 21.847 20.923 7.944 7.111-7.32 3.819-14.64-9.125-16.85 7.405 1.264 15.73-.825 18.014-9.015C62.88 23.022 64 8.51 64 6.55c0-9.818-8.578-6.732-13.873-2.745z"
       />
     </SvgIcon>
   );
 };
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6b7c4b2 and f99eebc.

📒 Files selected for processing (6)
  • src/domain/community/user/models/UserModel.ts (1 hunks)
  • src/domain/community/user/userForm/UserForm.tsx (6 hunks)
  • src/domain/platform/admin/components/Common/SocialSegment.tsx (2 hunks)
  • src/domain/shared/components/SocialLinks/SocialLinks.tsx (2 hunks)
  • src/domain/shared/components/SocialLinks/icons/BlueSky.tsx (1 hunks)
  • src/domain/shared/components/SocialLinks/models/SocialNetworks.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
`src/**/*.{ts,tsx,js}`: Review the React.js/TypeScript/JavaScript code for best practices and potential bugs. Ensure that the code adheres to TypeScript's typing system and modern ...

src/**/*.{ts,tsx,js}: Review the React.js/TypeScript/JavaScript code for best practices and potential bugs.
Ensure that the code adheres to TypeScript's typing system and modern standards.
Use the following code guide documentation in the codebase: 'docs/code-guidelines.md'.
Ensure sufficient error handling and logging is present, but note:

  • We have a global error handler in place. So local try/catch blocks are not required unless they provide value beyond what the global error handler already covers.
  • Avoid flagging the absence of local error handling in cases where the global error handler suffices.
  • Avoid flagging the absence of logging in cases where the global logger is already in place (graphql usage).

Inform about the recommendation of not using non-null assertion,
except on GraphQL queries where the variable is asserted non-null and followed by a
skip: with the same variable.
Examples:

  • Not Required: there's a skip
    {
    variables: { templateId: templateId! },
    skip: !templateId,
    }

Check for common security vulnerabilities such as:

  • SQL Injection
  • XSS (Cross-Site Scripting)
  • CSRF (Cross-Site Request Forgery)
  • Insecure dependencies
  • Sensitive data exposure
  • src/domain/shared/components/SocialLinks/models/SocialNetworks.ts
  • src/domain/platform/admin/components/Common/SocialSegment.tsx
  • src/domain/community/user/models/UserModel.ts
  • src/domain/shared/components/SocialLinks/SocialLinks.tsx
  • src/domain/shared/components/SocialLinks/icons/BlueSky.tsx
  • src/domain/community/user/userForm/UserForm.tsx
🧬 Code Graph Analysis (1)
src/domain/community/user/userForm/UserForm.tsx (1)
src/core/apollo/generated/graphql-schema.ts (1)
  • Reference (5369-5385)
🔇 Additional comments (13)
src/domain/shared/components/SocialLinks/SocialLinks.tsx (2)

8-8: LGTM: BlueSky import follows the established pattern.

The import statement correctly follows the same pattern as other social network icon imports.


27-28: LGTM: BlueSky case implementation is consistent.

The implementation follows the exact same pattern as other social network cases in the switch statement, maintaining consistency and following established conventions.

src/domain/shared/components/SocialLinks/models/SocialNetworks.ts (1)

7-7: LGTM: BlueSky enum addition with sort order consideration.

The addition of bsky to the enum is correct. Note that since enum field order determines link sorting (as mentioned in the comment), BlueSky links will now appear after Twitter and before email in the social links display.

src/domain/community/user/models/UserModel.ts (1)

71-71:

✅ Verification successful

LGTM: Form interface updated for BlueSky migration.

The property name change from twitter to bsky in the UserFormGenerated interface is consistent with the migration to BlueSky. This change should be coordinated with form validation rules and UI components that reference this field.

Let me verify that form validation and related components are properly updated:


🏁 Script executed:

#!/bin/bash
# Description: Verify that form validation and components are updated to use bsky instead of twitter

# Check for any remaining twitter references in user form validation
rg -A 5 -B 5 "twitter.*yup|yup.*twitter" src/domain/community/user/

# Check for twitter field references in user form components
rg -A 3 -B 3 "field.*twitter|twitter.*field" src/domain/community/user/

# Verify bsky validation is properly implemented
rg -A 5 -B 5 "bsky.*yup|yup.*bsky" src/domain/community/user/

Length of output: 1286


Approve BlueSky Migration for UserForm

The twitter field has been fully replaced by bsky in the UserFormGenerated interface and all form validation rules and UI bindings have been updated. No residual twitter references remain.

• src/domain/community/user/models/UserModel.ts: UserFormGenerated now uses bsky: string;
• src/domain/community/user/userForm/UserForm.tsx: validation updated to

bsky: yup.string().url('BlueSky url must be a valid URL'),
src/domain/platform/admin/components/Common/SocialSegment.tsx (3)

8-8: LGTM: BlueSky icon import properly replaces Twitter.

The import change is correct and maintains consistency with the migration to BlueSky.


41-42: LGTM: Form field properties updated consistently.

The field name and title changes from Twitter to BlueSky are properly implemented and follow the established pattern of other social media fields in the component.


48-48: LGTM: Icon component properly updated.

The BlueSky icon component replacement maintains the same structure and positioning as the previous Twitter icon implementation.

src/domain/community/user/userForm/UserForm.tsx (6)

31-31: LGTM: Social network enum updated correctly.

The socialNames array has been properly updated to use BlueSky instead of Twitter.


78-81: LGTM: Reference lookup updated consistently.

The memoized reference lookup has been correctly updated from twitterRef to blueSkyRef with the appropriate enum value.


98-98: LGTM: Initial values updated appropriately.

The form initial values correctly use the bsky field instead of twitter.


121-121: LGTM: Validation message is user-friendly.

The validation message clearly indicates "BlueSky url must be a valid URL", which provides good user experience.


177-177: LGTM: Dependency array updated correctly.

The dependency array for the handleSubmit callback has been properly updated to include blueSkyRef instead of twitterRef.


145-157:

✅ Verification successful

Verify UserModel interface supports the bsky field.

The form submission logic has been properly updated to use bsky instead of twitter. Please ensure that the UserFormGenerated interface in the UserModel has been updated accordingly.


🏁 Script executed:

#!/bin/bash
# Description: Verify that the UserModel interface supports the bsky field instead of twitter
# Expected: Should find bsky field definition and no twitter field in UserFormGenerated interface

# Search for the UserFormGenerated interface definition
ast-grep --pattern 'interface UserFormGenerated {
  $$$
}'

# Search for any remaining twitter field references in user model files
rg -A 2 -B 2 "twitter" src/domain/community/user/models/

Length of output: 1291


Verified: UserFormGenerated interface includes bsky and no longer includes twitter
The UserFormGenerated interface (src/domain/community/user/models/UserModel.ts) defines bsky: string and there are no remaining twitter fields.

@bobbykolev bobbykolev changed the title Update User Profile to support blue sky instead of twitter Update User Profile to support BlueSky instead of twitter May 23, 2025
@ccanos ccanos self-requested a review May 27, 2025 08:38
Copy link

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

🧹 Nitpick comments (3)
src/core/i18n/en/translation.en.json (1)

932-933: Ensure i18n completeness and consistency
We’ve added two new validation keys (duplicateEmail and url) in the English bundle.

  1. Please propagate these keys (with appropriate translations) to all other locale files under src/core/i18n/*/translation.*.json to avoid fallback on missing keys.
  2. For consistency with the existing Invalid Email address message, consider capitalizing “Email” in the duplicate-email message:
- "duplicateEmail": "Duplicated email address",
+ "duplicateEmail": "Duplicated Email address",
src/domain/platform/admin/components/Common/ProfileSegment.tsx (1)

26-32: Consider enhancing the validation error message.

The validation correctly prevents social network names in references (case-insensitive). However, the error message "Use the social section" could be more descriptive.

Consider providing a more informative error message:

         .test(
           'includesSocial',
-          'Use the social section',
+          'Please use the dedicated social links section for social network profiles',
           value => !value || !socialNames.includes(value.toLowerCase())
         ),
src/domain/platform/admin/components/Organization/OrganizationForm.tsx (1)

119-123: Consider extracting social network validation messages.

The validation messages for social networks follow the same pattern and could be simplified.

Consider creating a helper function:

const socialUrlValidation = (fieldName: string) => 
  yup.string().url(t('forms.validations.url', { name: t(`components.profileSegment.socialLinks.${fieldName}`) }));

// Then use it:
linkedin: socialUrlValidation('linkedin'),
bsky: socialUrlValidation('bsky'),
github: socialUrlValidation('github'),
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 363f353 and b72dbd0.

📒 Files selected for processing (9)
  • .vscode/settings.json (1 hunks)
  • src/core/i18n/en/translation.en.json (2 hunks)
  • src/domain/common/profile/ProfileModelUtils.ts (2 hunks)
  • src/domain/community/user/userForm/UserForm.tsx (6 hunks)
  • src/domain/platform/admin/components/Common/ProfileSegment.tsx (1 hunks)
  • src/domain/platform/admin/components/Common/SocialSegment.tsx (3 hunks)
  • src/domain/platform/admin/components/Organization/OrganizationForm.tsx (9 hunks)
  • src/domain/platform/admin/components/Organization/OrganizationPage.tsx (3 hunks)
  • src/domain/shared/components/SocialLinks/models/SocialNetworks.ts (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • .vscode/settings.json
🚧 Files skipped from review as they are similar to previous changes (3)
  • src/domain/platform/admin/components/Common/SocialSegment.tsx
  • src/domain/community/user/userForm/UserForm.tsx
  • src/domain/shared/components/SocialLinks/models/SocialNetworks.ts
🧰 Additional context used
📓 Path-based instructions (2)
`src/**/*.{ts,tsx,js}`: Review the React.js/TypeScript/JavaScript code for best practices and potential bugs. Ensure that the code adheres to TypeScript's typing system and modern ...

src/**/*.{ts,tsx,js}: Review the React.js/TypeScript/JavaScript code for best practices and potential bugs.
Ensure that the code adheres to TypeScript's typing system and modern standards.
Use the following code guide documentation in the codebase: 'docs/code-guidelines.md'.
Ensure sufficient error handling and logging is present, but note:

  • We have a global error handler in place. So local try/catch blocks are not required unless they provide value beyond what the global error handler already covers.
  • Avoid flagging the absence of local error handling in cases where the global error handler suffices.
  • Avoid flagging the absence of logging in cases where the global logger is already in place (graphql usage).

Inform about the recommendation of not using non-null assertion,
except on GraphQL queries where the variable is asserted non-null and followed by a
skip: with the same variable.
Examples:

  • Not Required: there's a skip
    {
    variables: { templateId: templateId! },
    skip: !templateId,
    }

Check for common security vulnerabilities such as:

  • SQL Injection
  • XSS (Cross-Site Scripting)
  • CSRF (Cross-Site Request Forgery)
  • Insecure dependencies
  • Sensitive data exposure
  • src/domain/common/profile/ProfileModelUtils.ts
  • src/domain/platform/admin/components/Organization/OrganizationPage.tsx
  • src/domain/platform/admin/components/Common/ProfileSegment.tsx
  • src/domain/platform/admin/components/Organization/OrganizationForm.tsx
`src/**/*.json`: Review the JSON files for correct syntax and structure. Ensure that the configuration and data are accurate and follow the project's standards. Check for sensitive...

src/**/*.json: Review the JSON files for correct syntax and structure.
Ensure that the configuration and data are accurate and follow the project's standards.
Check for sensitive data exposure and ensure that the data is properly validated.

  • src/core/i18n/en/translation.en.json
🧬 Code Graph Analysis (2)
src/domain/platform/admin/components/Common/ProfileSegment.tsx (2)
src/domain/platform/admin/components/Common/ReferenceSegment.tsx (1)
  • referenceSegmentValidationObject (36-60)
src/domain/shared/components/SocialLinks/models/SocialNetworks.ts (1)
  • socialNames (11-15)
src/domain/platform/admin/components/Organization/OrganizationForm.tsx (9)
src/domain/community/organization/model/OrganizationModel.ts (2)
  • OrganizationModel (7-33)
  • EmptyOrganizationModel (35-70)
src/core/apollo/generated/graphql-schema.ts (2)
  • CreateOrganizationInput (1894-1902)
  • UpdateOrganizationInput (6931-6941)
src/domain/common/profile/ProfileModel.ts (1)
  • EmptyProfileModel (22-31)
src/domain/shared/components/SocialLinks/models/SocialNetworks.ts (1)
  • socialNames (11-15)
src/domain/platform/admin/components/Common/ProfileSegment.tsx (1)
  • profileSegmentSchemaWithReferences (22-35)
src/domain/common/reference/ReferenceModel.ts (1)
  • ReferenceModel (3-8)
src/domain/common/profile/ProfileModelUtils.ts (1)
  • mapProfileModelToUpdateProfileInput (11-33)
src/domain/platform/admin/components/Common/TagsetSegment.tsx (1)
  • TagsetSegment (24-50)
src/domain/platform/admin/components/Common/ProfileReferenceSegment.tsx (1)
  • ProfileReferenceSegment (12-38)
🔇 Additional comments (6)
src/domain/common/profile/ProfileModelUtils.ts (2)

14-23: Good refactoring: Adding braces improves code consistency.

Adding braces around the if statement block improves readability and follows TypeScript/JavaScript best practices for consistent code formatting.


25-32: Good refactoring: Direct return eliminates unnecessary variable.

Removing the intermediate variable and returning the object directly makes the code more concise while maintaining the same functionality.

src/domain/platform/admin/components/Organization/OrganizationPage.tsx (1)

67-88: Good improvement for async form submission handling!

The explicit Promise<unknown> return type and returning the mutation results enable proper promise handling in the form component. This allows the form to track submission state and handle errors appropriately.

src/domain/platform/admin/components/Common/ProfileSegment.tsx (1)

12-20: Well-structured validation schema refactoring!

Good use of DRY principle by extracting common validation properties. This makes the schemas more maintainable.

src/domain/platform/admin/components/Organization/OrganizationForm.tsx (2)

86-93: Good use of memoization for social network references!

The extraction of social network references is efficient and prevents unnecessary recalculations.


190-196: Excellent async form submission handling!

Proper use of try/finally to ensure setSubmitting(false) is called even if the submission fails. This prevents the form from getting stuck in a loading state.

ccanos
ccanos previously approved these changes May 27, 2025
@ccanos ccanos changed the title Update User Profile to support BlueSky instead of twitter Update User and Organization Profiles to support BlueSky instead of twitter May 27, 2025
@bobbykolev bobbykolev merged commit 641e34b into develop May 27, 2025
3 checks passed
@bobbykolev bobbykolev deleted the client-7782-bsky-no-twitter branch May 27, 2025 13:26
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.

2 participants