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

fix: use bot penalty #749

Merged
merged 6 commits into from
Sep 18, 2023
Merged
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
8 changes: 7 additions & 1 deletion src/handlers/wildcard/unassign.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import {
listAllIssuesForRepo,
removeAssignees,
} from "../../helpers";
import { Comment, Issue, IssueType, Payload } from "../../types";
import { Comment, Issue, IssueType, Payload, UserType } from "../../types";
import { deadLinePrefix } from "../shared";

/**
* @dev Check out the bounties which haven't been completed within the initial timeline
Expand Down Expand Up @@ -99,6 +100,11 @@ const lastActivityTime = async (issue: Issue, comments: Comment[]): Promise<Date
const assignees = issue.assignees.map((i) => i.login);
const activities: Date[] = [new Date(issue.created_at)];

const lastAssignCommentOfHunter = comments
.filter((comment) => comment.user.type === UserType.Bot && comment.body.includes(assignees[0]) && comment.body.includes(deadLinePrefix))
.sort((a: Comment, b: Comment) => new Date(b.created_at).getTime() - new Date(a.created_at).getTime());
if (lastAssignCommentOfHunter.length > 0) activities.push(new Date(lastAssignCommentOfHunter[0].created_at));

// get last comment on the issue
const lastCommentsOfHunterForIssue = comments
.filter((comment) => assignees.includes(comment.user.login))
Expand Down
Loading