From 457546d0923aa3b524a93d08df391d7479b0e0a7 Mon Sep 17 00:00:00 2001 From: Jeff Daley Date: Wed, 31 May 2023 20:06:20 -0400 Subject: [PATCH] Fix approver checkmarks --- web/app/components/document/sidebar.hbs | 2 ++ web/app/components/person/approver.hbs | 2 +- web/app/components/person/approver.ts | 2 ++ web/app/helpers/has-approved-doc.ts | 29 ++++++++++++++++++++----- 4 files changed, 28 insertions(+), 7 deletions(-) diff --git a/web/app/components/document/sidebar.hbs b/web/app/components/document/sidebar.hbs index 9203cb612..2da24e5c5 100644 --- a/web/app/components/document/sidebar.hbs +++ b/web/app/components/document/sidebar.hbs @@ -216,6 +216,7 @@ {{#each this.approvers as |approver|}}
  • @@ -241,6 +242,7 @@ {{#each this.approvers as |approver|}}
  • diff --git a/web/app/components/person/approver.hbs b/web/app/components/person/approver.hbs index 0712942ea..7ebfbb773 100644 --- a/web/app/components/person/approver.hbs +++ b/web/app/components/person/approver.hbs @@ -1,5 +1,5 @@ diff --git a/web/app/components/person/approver.ts b/web/app/components/person/approver.ts index 1f0ec0c6d..36fb0fcf6 100644 --- a/web/app/components/person/approver.ts +++ b/web/app/components/person/approver.ts @@ -1,8 +1,10 @@ import Component from "@glimmer/component"; +import { HermesDocument } from "hermes/types/document"; interface PersonApproverComponentSignature { Element: HTMLDivElement; Args: { + document: HermesDocument; email: string; imgURL?: string; }; diff --git a/web/app/helpers/has-approved-doc.ts b/web/app/helpers/has-approved-doc.ts index a221ca4e4..0c7140279 100644 --- a/web/app/helpers/has-approved-doc.ts +++ b/web/app/helpers/has-approved-doc.ts @@ -1,10 +1,27 @@ import { helper } from "@ember/component/helper"; import { HermesDocument } from "hermes/types/document"; -export default helper(([document, approverEmail]: [HermesDocument, string]) => { - if (document.approvedBy) { - return document.approvedBy.some((email) => email === approverEmail); - } else { - return false; +export interface HasApprovedDocSignature { + Args: { + Positional: [HermesDocument, string]; + }; + Return: boolean; +} + +const hasApprovedDoc = helper( + ([document, approverEmail]: [HermesDocument, string]) => { + if (document.approvedBy) { + return document.approvedBy.some((email) => email === approverEmail); + } else { + return false; + } + } +); + +export default hasApprovedDoc; + +declare module "@glint/environment-ember-loose/registry" { + export default interface Registry { + "has-approved-doc": typeof hasApprovedDoc; } -}); +}