Skip to content

Commit

Permalink
feat: disable permit gen for users in non collaborative issues
Browse files Browse the repository at this point in the history
  • Loading branch information
ishowvel committed Nov 7, 2024
1 parent 7ee3654 commit ac5a724
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/parser/permit-generation-module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ export class PermitGenerationModule implements Module {
readonly _supabase = createClient<Database>(process.env.SUPABASE_URL, process.env.SUPABASE_KEY);

async transform(data: Readonly<IssueActivity>, result: Result): Promise<Result> {
const canGeneratePermits = await this._canGeneratePermit(data);
if (!canGeneratePermits) return result;

const payload: Context["payload"] & Payload = {
...context.payload.inputs,
issueUrl: program.eventPayload.issue.html_url,
Expand Down Expand Up @@ -131,11 +134,8 @@ export class PermitGenerationModule implements Module {
},
config.permitRequests
);
const canGeneratePermits = await this._canGeneratePermit(data);
if (canGeneratePermits) {
result[key].permitUrl = `https://pay.ubq.fi?claim=${encodePermits(permits)}`;
await this._savePermitsToDatabase(result[key].userId, { issueUrl: payload.issueUrl, issueId }, permits);
}
result[key].permitUrl = `https://pay.ubq.fi?claim=${encodePermits(permits)}`;
await this._savePermitsToDatabase(result[key].userId, { issueUrl: payload.issueUrl, issueId }, permits);
} catch (e) {
logger.error(`[PermitGenerationModule] Failed to generate permits for user ${key}`, { e });
}
Expand Down

0 comments on commit ac5a724

Please sign in to comment.