46 lines · 1.4 KB
export const ABUSE_CATEGORIES = ["phishing", "malware", "spam", "illegal", "harassment", "copyright", "other"] as const;
export type AbuseCategory = (typeof ABUSE_CATEGORIES)[number];
export type AbuseStatus = "open" | "actioned" | "dismissed";
export const ABUSE_ACTIONS = ["pause", "restore", "hide", "unhide", "dismiss", "resolve"] as const;
export type AbuseAction = (typeof ABUSE_ACTIONS)[number];
export const ABUSE_TARGET_KINDS = [
  "site",
  "repo",
  "user",
  "issue",
  "comment",
  "review_comment",
  "discussion_comment",
] as const;
export type AbuseTargetKind = (typeof ABUSE_TARGET_KINDS)[number];
/** Targets an admin can hide individually. */
export const HIDEABLE_KINDS: ReadonlySet<AbuseTargetKind> = new Set([
  "repo",
  "issue",
  "comment",
  "review_comment",
  "discussion_comment",
]);

export const ABUSE_TARGET_LABELS: Record<AbuseTargetKind, string> = {
  site: "Hosted site",
  repo: "Repository",
  user: "Account",
  issue: "Issue or pull request",
  comment: "Comment",
  review_comment: "Review comment",
  discussion_comment: "Discussion comment",
};

export const ABUSE_CATEGORY_LABELS: Record<AbuseCategory, string> = {
  phishing: "Phishing or credential theft",
  malware: "Malware or malicious downloads",
  spam: "Spam or SEO abuse",
  illegal: "Illegal content",
  harassment: "Harassment or threats",