Skip to content

Commit 1dec1d2

Browse files
mustard-mhjeanp413
authored andcommitted
Fix dashboard
1 parent f85b4f7 commit 1dec1d2

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

components/dashboard/src/admin/BlockedEmailDomains.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import { AdminPageHeader } from "./AdminPageHeader";
1717
import Pagination from "../Pagination/Pagination";
1818
import { Button } from "@podkit/buttons/Button";
1919
import { installationClient } from "../service/public-api";
20+
import { ListBlockedEmailDomainsResponse } from "@gitpod/public-api/lib/gitpod/v1/installation_pb";
2021

2122
export function BlockedEmailDomains() {
2223
return (
@@ -39,20 +40,19 @@ function useUpdateBlockedEmailDomainMutation() {
3940
async (blockedDomain: EmailDomainFilterEntry) => {
4041
await installationClient.createBlockedEmailDomain({
4142
domain: blockedDomain.domain,
42-
negative: blockedDomain.negative,
43+
negative: blockedDomain.negative ?? false,
4344
});
4445
},
4546
{
4647
onSuccess: (_, blockedDomain) => {
47-
const updated = [];
48-
for (const entry of blockedEmailDomains.data?.blockedEmailDomains || []) {
48+
const data = new ListBlockedEmailDomainsResponse(blockedEmailDomains.data);
49+
data.blockedEmailDomains.map((entry) => {
4950
if (entry.domain !== blockedDomain.domain) {
50-
updated.push(entry);
51-
} else {
52-
updated.push(blockedDomain);
51+
return entry;
5352
}
54-
}
55-
queryClient.setQueryData(["blockedEmailDomains"], updated);
53+
return blockedDomain;
54+
});
55+
queryClient.setQueryData(["blockedEmailDomains"], data);
5656
blockedEmailDomains.refetch();
5757
},
5858
},

components/dashboard/src/service/json-rpc-installation-client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export class JsonRpcInstallationClient implements PromiseClient<typeof Installat
5050
if (!request.urlRegexp) {
5151
throw new ApplicationError(ErrorCodes.BAD_REQUEST, "urlRegexp is required");
5252
}
53-
if (!request.blockUser) {
53+
if (request.blockUser === undefined) {
5454
throw new ApplicationError(ErrorCodes.BAD_REQUEST, "blockUser is required");
5555
}
5656
const info = await getGitpodService().server.adminCreateBlockedRepository(request.urlRegexp, request.blockUser);

0 commit comments

Comments
 (0)