mirror of
https://github.com/pezkuwichain/pwap.git
synced 2026-06-12 23:41:02 +00:00
fix: citizenship pending approvals not showing for founder
Application struct has no status field - was filtering by appData.status === 'PendingReferral' which always returned false. Now checks kycStatuses storage instead, and allows founder to see all pending applications.
This commit is contained in:
@@ -788,14 +788,25 @@ export async function getPendingApprovalsForReferrer(
|
|||||||
const applicantAddress = key.args[0].toString();
|
const applicantAddress = key.args[0].toString();
|
||||||
const appData = (value as any).toJSON() as Record<string, unknown>;
|
const appData = (value as any).toJSON() as Record<string, unknown>;
|
||||||
|
|
||||||
if (
|
// Application struct has { identityHash, referrer } - no status field.
|
||||||
appData.status === 'PendingReferral' &&
|
// An application is "pending" if it exists in applications but is NOT yet
|
||||||
appData.referrer?.toString() === referrerAddress
|
// approved in kycStatuses. Check referrer matches current user, or current
|
||||||
) {
|
// user is the founder (can approve any application).
|
||||||
pending.push({
|
const isReferrer = appData.referrer?.toString() === referrerAddress;
|
||||||
applicantAddress,
|
const isFounder = referrerAddress === FOUNDER_ADDRESS;
|
||||||
identityHash: (appData.identityHash as string) || ''
|
|
||||||
});
|
if (isReferrer || isFounder) {
|
||||||
|
// Check if already approved via kycStatuses
|
||||||
|
const kycStatus = await api.query.identityKyc.kycStatuses(applicantAddress);
|
||||||
|
const statusStr = kycStatus.isEmpty ? null : kycStatus.toString();
|
||||||
|
|
||||||
|
// Pending = not yet approved (no status or PendingReferral)
|
||||||
|
if (!statusStr || statusStr === 'PendingReferral') {
|
||||||
|
pending.push({
|
||||||
|
applicantAddress,
|
||||||
|
identityHash: (appData.identityHash as string) || ''
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user