Skip to content

Commit

Permalink
Fix IdentityOf tuple introduced in v1.2.0 (#119)
Browse files Browse the repository at this point in the history
Fixed `Identity` object now being a tuple of type `[IdentityOf,
BoundedVec]` introduced as as breaking change in v1.2.0

Fixes #118
  • Loading branch information
Bullrich committed Apr 23, 2024
1 parent 6134083 commit 29e944c
Show file tree
Hide file tree
Showing 4 changed files with 206 additions and 124 deletions.
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ outputs:

runs:
using: 'docker'
image: 'docker://ghcr.io/paritytech/review-bot/action:2.4.0'
image: 'docker://ghcr.io/paritytech/review-bot/action:2.4.1'
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "review-bot",
"version": "2.4.0",
"version": "2.4.1",
"description": "Have custom review rules for PRs with auto assignment",
"main": "src/index.ts",
"scripts": {
Expand Down Expand Up @@ -38,7 +38,7 @@
"@actions/core": "^1.10.1",
"@actions/github": "^6.0.0",
"@eng-automation/js": "^1.0.2",
"@polkadot/api": "^10.11.2",
"@polkadot/api": "^10.13.1",
"joi": "^17.6.4",
"yaml": "^2.3.4"
}
Expand Down
9 changes: 4 additions & 5 deletions src/polkadot/fellows.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,9 @@ export class PolkadotFellows implements TeamApi {
const users: Map<string, number> = new Map<string, number>();
for (const fellow of fellows) {
this.logger.debug(`Fetching identity of '${fellow.address}', rank: ${fellow.rank}`);
const fellowData = (await api.query.identity.identityOf(fellow.address)).toHuman() as
| Record<string, unknown>
| undefined;

const identityQuery = await api.query.identity.identityOf(fellow.address);
// If the identity is null, we check if there is a super identity.
if (!fellowData) {
if (identityQuery.isEmpty) {
this.logger.debug("Identity is null. Checking for super identity");
const superIdentity = (await api.query.identity.superOf(fellow.address)).toHuman() as
| [string, { Raw: string }]
Expand All @@ -59,6 +56,8 @@ export class PolkadotFellows implements TeamApi {
continue;
}

const [fellowData] = identityQuery.toHuman() as [Record<string, unknown>, unknown];

// @ts-ignore
const additional = fellowData.info?.additional as [{ Raw: string }, { Raw: string }][] | undefined;

Expand Down
Loading

0 comments on commit 29e944c

Please sign in to comment.