mirror of
https://github.com/pezkuwichain/pwap.git
synced 2026-04-22 02:07:55 +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 appData = (value as any).toJSON() as Record<string, unknown>;
|
||||
|
||||
if (
|
||||
appData.status === 'PendingReferral' &&
|
||||
appData.referrer?.toString() === referrerAddress
|
||||
) {
|
||||
pending.push({
|
||||
applicantAddress,
|
||||
identityHash: (appData.identityHash as string) || ''
|
||||
});
|
||||
// Application struct has { identityHash, referrer } - no status field.
|
||||
// An application is "pending" if it exists in applications but is NOT yet
|
||||
// approved in kycStatuses. Check referrer matches current user, or current
|
||||
// user is the founder (can approve any application).
|
||||
const isReferrer = appData.referrer?.toString() === referrerAddress;
|
||||
const isFounder = referrerAddress === FOUNDER_ADDRESS;
|
||||
|
||||
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