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

People Chain migration: filter FeePaid judgements #4909

Merged
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,13 @@ const migrateIdentity = async (key, data, api) => {
}
});

let judgements = [];
decodedJson.judgements.forEach((judgement) => {
if (!('feePaid' in judgement[1])) {
judgements.push(judgement);
}
});
Comment on lines +62 to +67
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Suggested change
let judgements = [];
decodedJson.judgements.forEach((judgement) => {
if (!('feePaid' in judgement[1])) {
judgements.push(judgement);
}
});
let judgements = [];
console.log("before: ", decodedJson.judgements);
decodedJson.judgements.forEach((judgement) => {
if (!('feePaid' in judgement[1])) {
judgements.push(judgement);
}
});
console.log("after: ", judgements);

if you log it like ^, you get https://gist.github.com/muharem/41748f9ffb7cc8c58162d7fc0eb9c992

Copy link
Contributor

Choose a reason for hiding this comment

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

Looks good, both for accounts that only have FeePaid and those that have other judgements.


// Migrate `IdentityInfo` data to the new format:
// - remove `additional` field
// - add `discord` field
Expand All @@ -68,7 +75,7 @@ const migrateIdentity = async (key, data, api) => {
'(RegistrationNew, Option<Username>)',
[
{
judgements: decodedJson.judgements,
judgements: judgements,
deposit: 0,
info: {
display: decodedJson.info.display,
Expand Down
Loading