Skip to content
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

Fall back to email if name is empty #1606

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

stnguyen90
Copy link
Contributor

What does this PR do?

The fetch avatar API won't render properly if an empty string is provided for the name so we should fall back to the email if the name is empty.

Fixes #1598

Test Plan

Manually tested before:

Screenshot 2025-01-09 at 12 43 43 PM

After:

Screenshot 2025-01-09 at 12 49 50 PM

Related PRs and Issues

Have you read the Contributing Guidelines on issues?

Yes

@coolify-appwrite-org
Copy link

coolify-appwrite-org bot commented Jan 9, 2025

The preview deployment is ready. 🟢

Open Preview | Open Build Logs

Last updated at: 2025-01-10 03:39:17 CET

@coolify-appwrite-org
Copy link

coolify-appwrite-org bot commented Jan 9, 2025

The preview deployment is ready. 🟢

Open Preview | Open Build Logs

Last updated at: 2025-01-10 03:39:13 CET

@coolify-appwrite-org
Copy link

coolify-appwrite-org bot commented Jan 9, 2025

The preview deployment is ready. 🟢

Open Preview | Open Build Logs

Last updated at: 2025-01-10 03:39:18 CET

@coolify-appwrite-org
Copy link

coolify-appwrite-org bot commented Jan 9, 2025

The preview deployment is ready. 🟢

Open Preview | Open Build Logs

Last updated at: 2025-01-10 03:39:14 CET

@stnguyen90 stnguyen90 requested a review from ChiragAgg5k January 9, 2025 20:52
@@ -28,7 +28,7 @@
const getMemberships = async (teamId: string) => {
const memberships = await sdk.forConsole.teams.listMemberships(teamId);
return memberships.memberships.map((team) => team.userName);
return memberships.memberships.map((team) => team.userName || team.userEmail);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch!

@@ -58,7 +58,7 @@
} else newOrgModal.set(true);
}
$: avatars = $members.memberships?.map((m) => m.userName) ?? [];
$: avatars = $members.memberships?.map((m) => m.userName || m.userEmail) ?? [];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we should also update it to team.userName instead of just m? this looks pretty inconsistent

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's m for membership, not team

The fetch avatar API won't render properly if an empty string is
provided for the name so we should fall back to the email if the name
is empty.
@stnguyen90 stnguyen90 force-pushed the fix-1598-fix-console-avatar branch from bd22abf to f8712c3 Compare January 10, 2025 03:36
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.

🐛 Bug Report: Broken/Missing Icon for User Avatar After GitHub Login
2 participants