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

fix: stale bounty #670

Merged
merged 12 commits into from
Sep 7, 2023
3 changes: 2 additions & 1 deletion src/bindings/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export const loadConfig = async (context: Context): Promise<BotConfig> => {
commandSettings,
assistivePricing,
registerWalletWithVerification,
staleBountyTime,
} = await getWideConfig(context);

const publicKey = await getScalarKey(process.env.X25519_PRIVATE_KEY);
Expand Down Expand Up @@ -76,7 +77,7 @@ export const loadConfig = async (context: Context): Promise<BotConfig> => {
command: commandSettings,
assign: {
bountyHunterMax: bountyHunterMax,
staleBountyTime: ms(STALE_BOUNTY_TIME),
staleBountyTime: staleBountyTime ? staleBountyTime : ms(STALE_BOUNTY_TIME),
},
sodium: {
privateKey: process.env.X25519_PRIVATE_KEY ?? "",
Expand Down
2 changes: 1 addition & 1 deletion src/configs/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const ASSIGN_COMMAND_ENABLED = true;
*/
export const DEFAULT_FOLLOWUP_TIME = "4 days"; // 4 days
export const DEFAULT_DISQUALIFY_TIME = "7 days"; // 7 days
export const STALE_BOUNTY_TIME = "30d"; // 2 minutes
export const STALE_BOUNTY_TIME = "30d"; // 30 days

export const DEFAULT_NETWORK_ID = 1; // ethereum
export const DEFAULT_RPC_ENDPOINT = "https://rpc-bot.ubq.fi/v1/mainnet";
Expand Down
1 change: 0 additions & 1 deletion src/handlers/comment/handlers/assign.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { tableComment } from "./table";
import { bountyInfo } from "../../wildcard";
import { ASSIGN_COMMAND_ENABLED, GLOBAL_STRINGS } from "../../../configs";
import { isParentIssue } from "../../pricing";
import ms from "ms";

export const assign = async (body: string) => {
const { payload: _payload } = getBotContext();
Expand Down
6 changes: 5 additions & 1 deletion src/handlers/comment/handlers/table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ export const tableComment = ({
<table>
<tr>
<td>Ready to begin?</td>
${!isBountyStale ? `<td>You can start right away!</td>` : `<td>This task was created over ${days} days ago. Please verify that it is still current.</td>`}
${
!isBountyStale
? `<td>You can start right away!</td>`
: `<td>This task was created over ${days} days ago. Please verify that it is still current before starting work.</td>`
}
</tr>
<tr>
<td>Deadline</td>
Expand Down
3 changes: 3 additions & 0 deletions src/utils/private.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {
} from "./helpers";

import DEFAULT_CONFIG_JSON from "../../ubiquibot-config-default.json";
import { STALE_BOUNTY_TIME } from "../configs";
import ms from "ms";

const CONFIG_REPO = "ubiquibot-config";
Expand Down Expand Up @@ -83,6 +84,7 @@ export interface WideConfig {
"comment-incentives"?: boolean;
"assistive-pricing"?: boolean;
"max-concurrent-assigns"?: number;
"stale-bounty-time"?: string;
incentives?: Incentives;
"default-labels"?: string[];
"register-wallet-with-verification"?: boolean;
Expand Down Expand Up @@ -185,6 +187,7 @@ export const getWideConfig = async (context: Context) => {
defaultLabels: getDefaultLabels(configs),
promotionComment: getPromotionComment(configs),
registerWalletWithVerification: getRegisterWalletWithVerification(configs),
staleBountyTime: parsedDefault["stale-bounty-time"] == "0" ? ms(STALE_BOUNTY_TIME) : parsedDefault["stale-bounty-time"],
};

return configData;
Expand Down
6 changes: 1 addition & 5 deletions ubiquibot-config-default.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"disable-analytics": false,
"comment-incentives": false,
"register-wallet-with-verification": false,
"stale-bounty-time": 42060,
rndquu marked this conversation as resolved.
Show resolved Hide resolved
"promotion-comment": "\n<h6>If you enjoy the DevPool experience, please follow <a href='https://github.com/ubiquity'>Ubiquity on GitHub</a> and star <a href='https://github.com/ubiquity/devpool-directory'>this repo</a> to show your support. It helps a lot!</h6>",
"default-labels": [],
"time-labels": [
Expand Down Expand Up @@ -91,11 +92,6 @@
{
"name": "autopay",
"enabled": true
},
{
"name": "assign",
"enabled": true,
"staleBountyTime": 120000
}
],
"incentives": {
Expand Down