Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix!: omit name, avatar_url and last_seen_at from responses when empty#18005

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
BrunoQuaresma merged 1 commit intomainfrombq/fix-user-response
May 23, 2025
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix: omit name and avatar_url from responses when empty
  • Loading branch information
@BrunoQuaresma
BrunoQuaresma committedMay 23, 2025
commitf86b3e44f9b08c9498cda3d8846bb4c3886fbdf3
1 change: 0 additions & 1 deletioncli/testdata/coder_list_--output_json.golden
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -24,7 +24,6 @@
"workspace_name": "test-workspace",
"workspace_owner_id": "==========[first user ID]===========",
"workspace_owner_name": "testuser",
"workspace_owner_avatar_url": "",
"template_version_id": "============[version ID]============",
"template_version_name": "===========[version name]===========",
"build_number": 1,
Expand Down
3 changes: 0 additions & 3 deletionscli/testdata/coder_users_list_--output_json.golden
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,7 +2,6 @@
{
"id": "==========[first user ID]===========",
"username": "testuser",
"avatar_url": "",
"name": "Test User",
"email": "testuser@coder.com",
"created_at": "====[timestamp]=====",
Expand All@@ -23,8 +22,6 @@
{
"id": "==========[second user ID]==========",
"username": "testuser2",
"avatar_url": "",
"name": "",
"email": "testuser2@coder.com",
"created_at": "====[timestamp]=====",
"updated_at": "====[timestamp]=====",
Expand Down
4 changes: 2 additions & 2 deletionscodersdk/organizations.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -74,8 +74,8 @@ type OrganizationMember struct {

type OrganizationMemberWithUserData struct {
Username string `table:"username,default_sort" json:"username"`
Name string `table:"name" json:"name"`
AvatarURL string `json:"avatar_url"`
Name string `table:"name" json:"name,omitempty"`
AvatarURL string `json:"avatar_url,omitempty"`
Email string `json:"email"`
GlobalRoles []SlimRole `json:"global_roles"`
OrganizationMember `table:"m,recursive_inline"`
Expand Down
6 changes: 3 additions & 3 deletionscodersdk/users.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -40,7 +40,7 @@ type UsersRequest struct {
type MinimalUser struct {
ID uuid.UUID `json:"id" validate:"required" table:"id" format:"uuid"`
Username string `json:"username" validate:"required" table:"username,default_sort"`
AvatarURL string `json:"avatar_url" format:"uri"`
AvatarURL string `json:"avatar_url,omitempty" format:"uri"`
}

// ReducedUser omits role and organization information. Roles are deduced from
Expand All@@ -49,11 +49,11 @@ type MinimalUser struct {
// required by the frontend.
type ReducedUser struct {
MinimalUser `table:"m,recursive_inline"`
Name string `json:"name"`
Name string `json:"name,omitempty"`
Email string `json:"email" validate:"required" table:"email" format:"email"`
CreatedAt time.Time `json:"created_at" validate:"required" table:"created at" format:"date-time"`
UpdatedAt time.Time `json:"updated_at" table:"updated at" format:"date-time"`
LastSeenAt time.Time `json:"last_seen_at" format:"date-time"`
LastSeenAt time.Time `json:"last_seen_at,omitempty" format:"date-time"`

Status UserStatus `json:"status" table:"status" enums:"active,suspended"`
LoginType LoginType `json:"login_type"`
Expand Down
2 changes: 1 addition & 1 deletioncodersdk/workspacebuilds.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -58,7 +58,7 @@ type WorkspaceBuild struct {
WorkspaceName string `json:"workspace_name"`
WorkspaceOwnerID uuid.UUID `json:"workspace_owner_id" format:"uuid"`
WorkspaceOwnerName string `json:"workspace_owner_name"`
WorkspaceOwnerAvatarURL string `json:"workspace_owner_avatar_url"`
WorkspaceOwnerAvatarURL string `json:"workspace_owner_avatar_url,omitempty"`
TemplateVersionID uuid.UUID `json:"template_version_id" format:"uuid"`
TemplateVersionName string `json:"template_version_name"`
BuildNumber int32 `json:"build_number"`
Expand Down
12 changes: 6 additions & 6 deletionssite/src/api/typesGenerated.ts
View file
Open in desktop

Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.

View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -20,7 +20,7 @@ import { prepareQuery } from "utils/filters";

// The common properties between users and org members that we need.
export type SelectedUser = {
avatar_url: string;
avatar_url?: string;
email: string;
username: string;
};
Expand Down
2 changes: 1 addition & 1 deletionsite/src/pages/ChatPage/ChatLanding.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -62,7 +62,7 @@ const ChatLanding: FC = () => {
textAlign: "center",
}}
>
Good evening, {user?.name.split(" ")[0]}
Good evening, {(user.name ?? user.username).split(" ")[0]}
</h1>
<p
css={{
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -13,7 +13,7 @@ describe("AccountForm", () => {
// Given
const mockInitialValues: UpdateUserProfileRequest = {
username: MockUserMember.username,
name: MockUserMember.name,
name: MockUserMember.name ?? MockUserMember.username,
};

// When
Expand DownExpand Up@@ -44,7 +44,7 @@ describe("AccountForm", () => {
// Given
const mockInitialValues: UpdateUserProfileRequest = {
username: MockUserMember.username,
name: MockUserMember.name,
name: MockUserMember.name ?? MockUserMember.username,
};

// When
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -29,7 +29,7 @@ const AccountPage: FC = () => {
email={me.email}
updateProfileError={updateProfileError}
isLoading={isUpdatingProfile}
initialValues={{ username: me.username, name: me.name }}
initialValues={{ username: me.username, name: me.name?? ""}}
onSubmit={updateProfile}
/>
</Section>
Expand Down
8 changes: 4 additions & 4 deletionssite/src/testHelpers/entities.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -539,8 +539,8 @@ export const MockOrganizationMember: TypesGen.OrganizationMemberWithUserData = {
user_id: MockUserOwner.id,
username: MockUserOwner.username,
email: MockUserOwner.email,
created_at: "",
updated_at: "",
updated_at: "2025-05-22T17:51:49.49745Z",
created_at: "2025-05-22T17:51:49.497449Z",
name: MockUserOwner.name,
avatar_url: MockUserOwner.avatar_url,
global_roles: MockUserOwner.roles,
Expand All@@ -553,8 +553,8 @@ export const MockOrganizationMember2: TypesGen.OrganizationMemberWithUserData =
user_id: MockUserMember.id,
username: MockUserMember.username,
email: MockUserMember.email,
created_at: "",
updated_at: "",
updated_at: "2025-05-22T17:51:49.49745Z",
created_at: "2025-05-22T17:51:49.497449Z",
name: MockUserMember.name,
avatar_url: MockUserMember.avatar_url,
global_roles: MockUserMember.roles,
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp