From 2704181d1f2f5a74b479945267149700db438092 Mon Sep 17 00:00:00 2001 From: Antariksh Date: Wed, 3 Feb 2021 10:55:28 +0800 Subject: [PATCH] feat: filter deprecated fields from admin panel --- .../directives/edit-form.client.directive.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/public/modules/forms/admin/directives/edit-form.client.directive.js b/src/public/modules/forms/admin/directives/edit-form.client.directive.js index a87dca866f..0ba5418ed3 100644 --- a/src/public/modules/forms/admin/directives/edit-form.client.directive.js +++ b/src/public/modules/forms/admin/directives/edit-form.client.directive.js @@ -7,6 +7,16 @@ const newFields = new Set() // Adding a fieldTypes will add a "new" label. angular.module('forms').directive('editFormDirective', editFormDirective) +// TODO (private #110): remove this variable +const DEPRECATED_MYINFO_ATTRS = [ + 'homeno', + 'billadd', + 'mailadd', + 'edulevel', + 'schoolname', + 'gradyear', +] + function editFormDirective() { return { templateUrl: @@ -453,5 +463,10 @@ function editFormController( // Populate AddField with all available form field types $scope.addField = {} $scope.addField.types = FormFields.basicTypes - $scope.addField.myInfoTypes = FormFields.myInfoTypes + + // TODO (private #110): remove this filtering once the deprecated fields + // are deleted from shared/resources/myinfo + $scope.addField.myInfoTypes = FormFields.myInfoTypes.filter( + (type) => !DEPRECATED_MYINFO_ATTRS.includes(type.name), + ) }