All files / app/service reporting.ts

27.27% Statements 3/11
100% Branches 0/0
0% Functions 0/1
27.27% Lines 3/11

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25117x   117x                 116x                          
import { ReportReq } from "proto/reporting_pb";
 
import client from "./client";
 
export interface ReportInput {
  reason: string;
  description: string;
  contentRef: string;
  authorUser: string | number;
}
 
export function reportContent({ reason, description, contentRef, authorUser }: ReportInput) {
  const req = new ReportReq();
  req.setReason(reason);
  req.setDescription(description);
  req.setContentRef(contentRef);
  // authorUser can be string or the string representation of a number
  req.setAuthorUser(authorUser.toString());
 
  req.setUserAgent(navigator.userAgent);
  req.setPage(window.location.href);
 
  return client.reporting.report(req);
}