Skip to content
This repository has been archived by the owner on Sep 19, 2024. It is now read-only.

Fix : skipped->disabled , since -> because #744

Merged
merged 1 commit into from
Sep 10, 2023
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions src/handlers/comment/action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ export const handleComment = async (): Promise<void> => {
const feature = config.command.find((e) => e.name === id.split("/")[1]);

if (!feature?.enabled && id !== IssueCommentCommands.HELP) {
logger.info(`Skipping '${id}' because it is disabled on this repo`);
await callback(issue.number, `Skipping \`${id}\` because it is disabled on this repo`, payload.action, payload.comment);
logger.info(`Skipping '${id}' because it is disabled on this repo.`);
await callback(issue.number, `Skipping \`${id}\` because it is disabled on this repo.`, payload.action, payload.comment);
continue;
}

Expand Down
2 changes: 1 addition & 1 deletion src/handlers/comment/handlers/assign.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ const getMultiplierInfoToDisplay = async (senderLogin: string, org_id: string, i
} else {
_multiplierToDisplay = multiplier;
_reasonToDisplay = reason;
_bountyToDisplay = `Permit generation skipped since price label is not set`;
_bountyToDisplay = `Permit generation disabled because price label is not set.`;
const issueDetailed = bountyInfo(issue);
if (issueDetailed.priceLabel) {
_bountyToDisplay = (+issueDetailed.priceLabel.substring(7, issueDetailed.priceLabel.length - 4) * value).toString() + " USD";
Expand Down
2 changes: 1 addition & 1 deletion src/handlers/comment/handlers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export const issueCreatedCallback = async (): Promise<void> => {
const { assistivePricing } = config.mode;

if (!assistivePricing) {
logger.info("Skipping adding label to issue because assistive pricing is disabled");
logger.info("Skipping adding label to issue because assistive pricing is disabled.");
return;
}

Expand Down
38 changes: 19 additions & 19 deletions src/handlers/payout/action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export const handleIssueClosed = async () => {
if (accessControl.organization) {
const userHasPermission = await checkUserPermissionForRepoAndOrg(payload.sender.login, context);

if (!userHasPermission) return "Permit generation skipped because this issue has been closed by an external contributor.";
if (!userHasPermission) return "Permit generation disabled because this issue has been closed by an external contributor.";
}

const comments = await getAllIssueComments(issue.number);
Expand Down Expand Up @@ -94,19 +94,19 @@ export const handleIssueClosed = async () => {
return;
}
if (privateKey == "") {
logger.info("Permit generation skipped because wallet private key is not set");
return "Permit generation skipped because wallet private key is not set";
logger.info("Permit generation disabled because wallet private key is not set.");
return "Permit generation disabled because wallet private key is not set.";
}
if (issue.state_reason !== StateReason.COMPLETED) {
logger.info("Permit generation skipped because this is marked as unplanned.");
return "Permit generation skipped because this is marked as unplanned.";
logger.info("Permit generation disabled because this is marked as unplanned.");
return "Permit generation disabled because this is marked as unplanned.";
}

logger.info(`Checking if the issue is a parent issue.`);
if (issue.body && isParentIssue(issue.body)) {
logger.error("Permit generation skipped since the issue is identified as parent issue.");
logger.error("Permit generation disabled because this is a collection of issues.");
await clearAllPriceLabelsOnIssue();
return "Permit generation skipped since the issue is identified as parent issue.";
return "Permit generation disabled because this is a collection of issues.";
}

logger.info(`Handling issues.closed event, issue: ${issue.number}`);
Expand All @@ -118,7 +118,7 @@ export const handleIssueClosed = async () => {
if (res) {
if (res[1] === "false") {
logger.info(`Skipping to generate permit2 url, reason: autoPayMode for this issue: false`);
return `Permit generation skipped since automatic payment for this issue is disabled.`;
return `Permit generation disabled because automatic payment for this issue is disabled.`;
}
break;
}
Expand All @@ -127,25 +127,25 @@ export const handleIssueClosed = async () => {

if (paymentPermitMaxPrice == 0 || !paymentPermitMaxPrice) {
logger.info(`Skipping to generate permit2 url, reason: { paymentPermitMaxPrice: ${paymentPermitMaxPrice}}`);
return `Permit generation skipped since paymentPermitMaxPrice is 0`;
return `Permit generation disabled because paymentPermitMaxPrice is 0.`;
}

const issueDetailed = bountyInfo(issue);
if (!issueDetailed.isBounty) {
logger.info(`Skipping... its not a bounty`);
return `Permit generation skipped since this issue didn't qualify as bounty`;
logger.info(`Skipping... its not a bounty.`);
return `Permit generation disabled because this issue didn't qualify as bounty.`;
}

const assignees = issue?.assignees ?? [];
const assignee = assignees.length > 0 ? assignees[0] : undefined;
if (!assignee) {
logger.info("Skipping to proceed the payment because `assignee` is undefined");
return `Permit generation skipped since assignee is undefined`;
logger.info("Skipping to proceed the payment because `assignee` is undefined.");
return `Permit generation disabled because assignee is undefined.`;
}

if (!issueDetailed.priceLabel) {
logger.info("Skipping to proceed the payment because price not set");
return `Permit generation skipped since price label is not set`;
return `Permit generation disabled because price label is not set.`;
}

const recipient = await getWalletAddress(assignee.login);
Expand All @@ -164,8 +164,8 @@ export const handleIssueClosed = async () => {

let priceInEth = new Decimal(issueDetailed.priceLabel.substring(7, issueDetailed.priceLabel.length - 4)).mul(multiplier);
if (priceInEth.gt(paymentPermitMaxPrice)) {
logger.info("Skipping to proceed the payment because bounty payout is higher than paymentPermitMaxPrice");
return `Permit generation skipped since issue's bounty is higher than ${paymentPermitMaxPrice}`;
logger.info("Skipping to proceed the payment because bounty payout is higher than paymentPermitMaxPrice.");
return `Permit generation disabled because issue's bounty is higher than ${paymentPermitMaxPrice}.`;
}

// if bounty hunter has any penalty then deduct it from the bounty
Expand All @@ -176,7 +176,7 @@ export const handleIssueClosed = async () => {
const bountyAmountAfterPenalty = bountyAmount.sub(penaltyAmount);
if (bountyAmountAfterPenalty.lte(0)) {
await removePenalty(assignee.login, payload.repository.full_name, paymentToken, networkId.toString(), bountyAmount);
const msg = `Permit generation skipped because bounty amount after penalty is 0`;
const msg = `Permit generation disabled because bounty amount after penalty is 0.`;
logger.info(msg);
return msg;
}
Expand All @@ -191,8 +191,8 @@ export const handleIssueClosed = async () => {
`#### Task Assignee Reward\n### [ **[ CLAIM ${priceInEth} ${tokenSymbol.toUpperCase()} ]** ](${payoutUrl})\n` + "```" + shortenRecipient + "```";
const permitComments = comments.filter((content) => content.body.includes("https://pay.ubq.fi?claim=") && content.user.type == UserType.Bot);
if (permitComments.length > 0) {
logger.info(`Skip to generate a permit url because it has been already posted`);
return `Permit generation skipped because it was already posted to this issue.`;
logger.info(`Skip to generate a permit url because it has been already posted.`);
return `Permit generation disabled because it was already posted to this issue.`;
}
await deleteLabel(issueDetailed.priceLabel);
await addLabelToIssue("Permitted");
Expand Down
4 changes: 2 additions & 2 deletions src/handlers/payout/post.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const incentivizeComments = async () => {
}

if (issue.state_reason !== StateReason.COMPLETED) {
logger.info("incentivizeComments: comment incentives skipped because the issue was not closed as completed");
logger.info("incentivizeComments: comment incentives disabled because the issue was not closed as completed.");
return;
}

Expand Down Expand Up @@ -143,7 +143,7 @@ export const incentivizeCreatorComment = async () => {
}

if (issue.state_reason !== StateReason.COMPLETED) {
logger.info("incentivizeCreatorComment: comment incentives skipped because the issue was not closed as completed");
logger.info("incentivizeCreatorComment: comment incentives disabled because the issue was not closed as completed.");
return;
}

Expand Down