Skip to content

Commit

Permalink
fix: ignore review audits altogether
Browse files Browse the repository at this point in the history
  • Loading branch information
double-beep authored Jun 10, 2024
1 parent 76e720a commit 8c2b7be
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/review.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ interface ReviewQueueResponse {
isAudit: boolean; // detect audits & avoid sending feedback to bots
}

let audit = false;

async function runOnNewTask(xhr: XMLHttpRequest): Promise<void> {
const regex = /\/review\/(next-task|task-reviewed\/)/;

Expand All @@ -24,6 +26,7 @@ async function runOnNewTask(xhr: XMLHttpRequest): Promise<void> {
) return;

const response = JSON.parse(xhr.responseText) as ReviewQueueResponse;
audit = response.isAudit;
if (response.isAudit) return; // audit

const page = new Page();
Expand Down Expand Up @@ -98,6 +101,7 @@ export function setupReview(): void {
xhr.status !== 200 // request failed
|| !regex.test(xhr.responseURL) // didn't vote to delete
|| !document.querySelector('#answer') // answer element not found
|| audit // don't run on review audits
) return;

// the submit button
Expand Down

0 comments on commit 8c2b7be

Please sign in to comment.