Skip to content

Commit 5cadd1b

Browse files
authored
update roles to lowercase (#3790)
1 parent 79fc7e0 commit 5cadd1b

File tree

7 files changed

+30
-29
lines changed

7 files changed

+30
-29
lines changed

packages/builder/src/actions/grantsMetadata.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,9 @@ export const transformAndDispatchProject =
9696
};
9797

9898
// todo: should we lowercase the owner addresses?
99+
console.log("project.projectRoles", project.projectRoles);
99100
const ownerAddresses: string[] = project.projectRoles
100-
.filter((role: AddressAndRole) => role.role === "OWNER")
101+
.filter((role: AddressAndRole) => role.role === "owner")
101102
.map((role) => ethers.utils.getAddress(role.address));
102103

103104
dispatch(projectOwnersLoaded(id, ownerAddresses));

packages/data-layer/src/data-layer.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ const mockProjects: v2Project[] = [
4242
projectRoles: [
4343
{
4444
address: "0xe849b2a694184b8739a04c915518330757cdb18b",
45-
role: "OWNER",
45+
role: "owner",
4646
createdAtBlock: "5146499",
4747
},
4848
],

packages/grant-explorer/src/features/projects/ViewProject.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,7 @@ export default function ViewProject() {
474474
const poolId = directAllocationPoolId.toString();
475475

476476
const recipient = project?.projectRoles?.filter(
477-
(role) => role.role === "OWNER"
477+
(role) => role.role === "owner"
478478
)[0].address;
479479

480480
const nonce = project?.nonce;

packages/round-manager/src/features/api/__tests__/program.test.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ describe("listPrograms", () => {
2626
// createdByAddress: expectedProgram.operatorWallets[0],
2727
// };
2828
// const expectedPrograms: Program[] = [expectedProgram];
29-
3029
// const actualPrograms = await listPrograms("0x0", 1, {
3130
// getProgramsByUser: jest.fn().mockResolvedValue({
3231
// programs: [
@@ -48,7 +47,6 @@ describe("listPrograms", () => {
4847
// ],
4948
// }),
5049
// } as unknown as DataLayer);
51-
5250
// expect(actualPrograms).toEqual(expectedPrograms);
5351
// });
5452
});
@@ -70,7 +68,7 @@ describe("getProgramById", () => {
7068
roles: [
7169
{
7270
address: expectedProgram.operatorWallets[0],
73-
role: "OWNER",
71+
role: "owner",
7472
createdAtBlock: "0",
7573
},
7674
],

packages/round-manager/src/features/program/ViewManageProgram.tsx

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ import { PlusIcon } from "@heroicons/react/solid";
1818

1919
const sortDataByRole = (data: AddressAndRole[]): AddressAndRole[] => {
2020
return data.sort((a, b) => {
21-
if (a.role === "OWNER") return -1;
22-
if (b.role === "OWNER") return 1;
21+
if (a.role === "owner") return -1;
22+
if (b.role === "owner") return 1;
2323
return a.role.localeCompare(b.role);
2424
});
2525
};
@@ -35,8 +35,8 @@ const filterRoles = (data: AddressAndRole[]): AddressAndRole[] => {
3535
// If not included, simply add the current item
3636
acc.push(current);
3737
} else if (
38-
acc[existingIndex].role !== "OWNER" &&
39-
current.role === "OWNER"
38+
acc[existingIndex].role !== "owner" &&
39+
current.role === "owner"
4040
) {
4141
// If the existing item is not an Owner but the current is, replace it
4242
acc[existingIndex] = current;
@@ -64,7 +64,7 @@ export function ViewManageProgram(props: {
6464
const isOwner = props.program?.roles?.some(
6565
(role) =>
6666
role.address.toLowerCase() === props.userAddress.toLowerCase() &&
67-
role.role === "OWNER"
67+
role.role === "owner"
6868
);
6969

7070
// Show Owner role first, then Operator
@@ -84,7 +84,7 @@ export function ViewManageProgram(props: {
8484
name: "Updating",
8585
description: `Updating the team members for the profile`,
8686
status: contractUpdatingStatus,
87-
}
87+
},
8888
];
8989

9090
const handleUpdateTeam = async () => {
@@ -192,9 +192,9 @@ export function ViewManageProgram(props: {
192192
<tr key={index}>
193193
<AddressRow address={item.address} />
194194
<td className="w-1/4 px-6 py-4 whitespace-nowrap text-sm text-gray-400">
195-
{item.role === "OWNER" ? "Owner" : "Member"}
195+
{item.role === "owner" ? "Owner" : "Member"}
196196
</td>
197-
{isOwner && item.role !== "OWNER" ? (
197+
{isOwner && item.role !== "owner" ? (
198198
<td>
199199
<XIcon
200200
className="text-red-100 w-6 cursor-pointer"
@@ -205,8 +205,9 @@ export function ViewManageProgram(props: {
205205
}}
206206
/>
207207
</td>
208-
) :
209-
<td className="bg-white"></td>}
208+
) : (
209+
<td className="bg-white"></td>
210+
)}
210211
</tr>
211212
))}
212213
</tbody>

packages/round-manager/src/features/round/ViewManageTeam.tsx

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ import { PlusIcon } from "@heroicons/react/solid";
1919

2020
const sortDataByRole = (data: AddressAndRole[]): AddressAndRole[] => {
2121
return data.sort((a, b) => {
22-
if (a.role === "ADMIN") return -1;
23-
if (b.role === "ADMIN") return 1;
22+
if (a.role === "admin") return -1;
23+
if (b.role === "admin") return 1;
2424
return a.role.localeCompare(b.role);
2525
});
2626
};
@@ -36,8 +36,8 @@ const filterRoles = (data: AddressAndRole[]): AddressAndRole[] => {
3636
// If not included, simply add the current item
3737
acc.push(current);
3838
} else if (
39-
acc[existingIndex].role !== "ADMIN" &&
40-
current.role === "ADMIN"
39+
acc[existingIndex].role !== "admin" &&
40+
current.role === "admin"
4141
) {
4242
// If the existing item is not an Admin but the current is, replace it
4343
acc[existingIndex] = current;
@@ -75,7 +75,7 @@ export default function ViewManageTeam(props: {
7575
const isAdmin = props.round?.roles?.some(
7676
(role) =>
7777
role.address.toLowerCase() === props.userAddress.toLowerCase() &&
78-
role.role === "ADMIN"
78+
role.role === "admin"
7979
);
8080

8181
// Show Admin role first, then Operator
@@ -90,7 +90,6 @@ export default function ViewManageTeam(props: {
9090

9191
const isTeamMembersLoading = indexingStatus == ProgressStatus.IN_PROGRESS;
9292

93-
9493
const progressSteps: ProgressStep[] = [
9594
{
9695
name: "Updating",
@@ -257,9 +256,9 @@ export default function ViewManageTeam(props: {
257256
<tr key={index}>
258257
<AddressRow address={item.address} />
259258
<td className="w-1/4 px-6 py-4 whitespace-nowrap text-sm text-gray-400">
260-
{item.role === "ADMIN" ? "Admin" : "Operator"}
259+
{item.role === "admin" ? "Admin" : "Operator"}
261260
</td>
262-
{editMode && item.role !== "ADMIN" && (
261+
{editMode && item.role !== "admin" && (
263262
<td>
264263
<XIcon
265264
className="text-red-100 w-6 cursor-pointer"

packages/round-manager/src/test-utils.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export const makeProgramData = (overrides: Partial<Program> = {}): Program => ({
5555
roles: [
5656
{
5757
address: mockedOperatorWallet,
58-
role: "OWNER",
58+
role: "owner",
5959
createdAtBlock: "0",
6060
},
6161
],
@@ -72,7 +72,8 @@ export const makeRoundData = (overrides: Partial<Round> = {}): Round => {
7272
const protocolFeePercentage = 10000;
7373
return {
7474
id: faker.finance.ethereumAddress(),
75-
strategyName: "allov2.DonationVotingMerkleDistributionDirectTransferStrategy",
75+
strategyName:
76+
"allov2.DonationVotingMerkleDistributionDirectTransferStrategy",
7677
chainId: 1,
7778
roundMetadata: {
7879
name: faker.company.name(),
@@ -113,7 +114,7 @@ export const makeRoundData = (overrides: Partial<Round> = {}): Round => {
113114
roles: [
114115
{
115116
address: mockedOperatorWallet,
116-
role: "OWNER",
117+
role: "owner",
117118
createdAtBlock: "0",
118119
},
119120
],
@@ -140,7 +141,8 @@ export const makeDirectGrantRoundData = (
140141
const protocolFeePercentage = 10000;
141142
return {
142143
id: faker.finance.ethereumAddress(),
143-
strategyName: "allov2.DonationVotingMerkleDistributionDirectTransferStrategy",
144+
strategyName:
145+
"allov2.DonationVotingMerkleDistributionDirectTransferStrategy",
144146
chainId: 1,
145147
roundMetadata: {
146148
name: faker.company.name(),
@@ -181,7 +183,7 @@ export const makeDirectGrantRoundData = (
181183
roles: [
182184
{
183185
address: mockedOperatorWallet,
184-
role: "OWNER",
186+
role: "owner",
185187
createdAtBlock: "0",
186188
},
187189
],

0 commit comments

Comments
 (0)