Skip to content

Commit b782893

Browse files
authored
fix(admin): Fix the Admin Resolve Report function - the Profile types are mismatched with the existing Firestore dev data, but the type check is extraneous since all we need it an (optional) name from the profile. This simply removes the check (the mismatch was on a Timestamp field, so not relevant to the functionality here). (#2097)
1 parent 8bcd797 commit b782893

1 file changed

Lines changed: 5 additions & 8 deletions

File tree

functions/src/testimony/resolveReport.ts

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import { fail, checkRequestZod, checkAuth, checkAdmin } from "../common"
55
// import { performDeleteTestimony } from "./deleteTestimony"
66
import { first } from "lodash"
77
import { Testimony } from "./types"
8-
import { Profile } from "../profile/types"
98

109
export type Request = z.infer<typeof Request>
1110
const Request = z.object({
@@ -45,12 +44,10 @@ export const resolveReport = functions.https.onCall(
4544

4645
// 3. Get the moderator's profile document
4746
const moderatorUid = context.auth!.uid
48-
const moderator = Profile.check(
49-
await db
50-
.doc(`profiles/${moderatorUid}`)
51-
.get()
52-
.then(d => d.data())
53-
)
47+
const moderatorName = await db
48+
.doc(`profiles/${moderatorUid}`)
49+
.get()
50+
.then(d => d.data()?.fullName)
5451

5552
// ***archived testiomny Id === published testimony Id***
5653

@@ -76,7 +73,7 @@ export const resolveReport = functions.https.onCall(
7673
archivedTestimonyId: testimonyId
7774
}
7875
if (reason) resolutionObj.reason = reason
79-
if (moderator.fullName) resolutionObj.moderatorName = moderator.fullName
76+
if (moderatorName) resolutionObj.moderatorName = moderatorName
8077

8178
await reportRef.update({
8279
resolution: resolutionObj

0 commit comments

Comments
 (0)