Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(feature-manager): remove feature toggles from frontend #2118

Merged
merged 3 commits into from
Jun 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions src/public/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,6 @@ require('./modules/core/controllers/edit-contact-number-modal.client.controller'
// Core directives
require('./modules/core/directives/on-click-outside.client.directive')
require('./modules/core/directives/route-loading-indicator.client.directive.js')
require('./modules/core/services/features.client.factory.js')
require('./modules/core/directives/feature-toggle.client.directive.js')

// Core config
require('./modules/core/config/core.client.routes.js')
Expand Down
6 changes: 1 addition & 5 deletions src/public/modules/core/componentViews/avatar-dropdown.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,7 @@
</li>
<!-- End user details block -->
<!-- Emergency contact block -->
<li
feature-toggle
feature-name="sms"
class="navbar__dropdown__user__contact"
>
<li class="navbar__dropdown__user__contact">
<div
ng-show="!vm.user.contact"
class="navbar__dropdown__user__contact--missing"
Expand Down
2 changes: 0 additions & 2 deletions src/public/modules/core/componentViews/navbar.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@
ui-sref="billing"
class="form-navbar__link"
ng-class="vm.activeTab==='billing' ? 'form-navbar__link--active' : ''"
feature-toggle
feature-name="spcp-myinfo"
>
Billing
</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ angular.module('core').component('avatarDropdownComponent', {
'$uibModal',
'$window',
'Auth',
'Features',
'Toastr',
avatarDropdownController,
],
Expand All @@ -22,7 +21,6 @@ function avatarDropdownController(
$uibModal,
$window,
Auth,
Features,
Toastr,
) {
const vm = this
Expand Down Expand Up @@ -50,13 +48,8 @@ function avatarDropdownController(
// Early return if user already has contact information.
if (trueUser.contact) return

const features = await Features.getFeatureStates()

// Only show exclamation mark in avatar if sms feature is enabled.
vm.showExclamation = features.sms && !vm.user.contact

// Do not proceed if sms feature is not available.
if (!features.sms) return
vm.showExclamation = !vm.user.contact

// If retrieved user does not have contact, prompt user to add one.
// If user has the key in the browser's storage the modal will not be
Expand Down

This file was deleted.

18 changes: 0 additions & 18 deletions src/public/modules/core/services/features.client.factory.js

This file was deleted.

2 changes: 1 addition & 1 deletion src/public/modules/core/views/landing.client.view.html
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@
/>
</div>

<div class="feature feature3" feature-toggle feature-name="spcp-myinfo">
<div class="feature feature3">
<img
src="/public/modules/core/img/landing/restricted__feature3.png"
class="feature-img"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="row" feature-toggle feature-name="verified-fields">
<div class="row">
<div class="toggle-option">
<div class="col-xs-8 label-custom label-medium label-bottom">
OTP verification
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
</uib-tab>

<!-- MyInfo Fields -->
<uib-tab feature-toggle feature-name="spcp-myinfo">
<uib-tab>
<uib-tab-heading> MyInfo </uib-tab-heading>
<!-- Only show fields if form type is not storage form -->
<div
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@
</div>

<!-- Form Options -->
<div feature-toggle feature-name="spcp-myinfo">
<div>
<div class="settings-divider"></div>
<fieldset>
<div id="enable-auth">
Expand Down Expand Up @@ -315,7 +315,7 @@
</fieldset>
</div>

<div feature-toggle feature-name="captcha">
<div>
<edit-captcha-directive
temp-form="tempForm"
update-settings="updateSettingsByPath"
Expand Down Expand Up @@ -359,11 +359,7 @@
<div class="settings-divider feature-divider"></div>

<!-- Webhooks for encrypted forms -->
<div
ng-if="isFormEncrypt()"
feature-toggle
feature-name="webhook-verified-content"
>
<div ng-if="isFormEncrypt()">
<div class="row enable-features">
<label
for="settings-webhook-url"
Expand Down
16 changes: 2 additions & 14 deletions src/public/modules/forms/admin/views/edit-fields.client.modal.html
Original file line number Diff line number Diff line change
Expand Up @@ -556,12 +556,7 @@ <h2 class="modal-title">
<!-- End table -->

<!-- Email -->
<div
class="row"
ng-if="vm.field.fieldType === 'email'"
feature-toggle
feature-name="verified-fields"
>
<div class="row" ng-if="vm.field.fieldType === 'email'">
<br />
<div class="toggle-option">
<div class="col-xs-8 label-custom label-medium">
Expand Down Expand Up @@ -593,12 +588,7 @@ <h2 class="modal-title">
</div>
</div>

<div
class="row"
ng-show="vm.field.fieldType === 'email'"
feature-toggle
feature-name="verified-fields"
>
<div class="row" ng-show="vm.field.fieldType === 'email'">
<br />
<div class="toggle-option">
<div
Expand Down Expand Up @@ -861,8 +851,6 @@ <h2 class="modal-title">
field="vm.field"
name="'SMS'"
character-limit="300"
feature-toggle
feature-name="sms"
>
</configure-mobile-directive>
<!-- End mobile field directive ---->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
</div>
</uib-tab>

<uib-tab feature-toggle feature-name="spcp-myinfo">
<uib-tab>
<uib-tab-heading> MyInfo </uib-tab-heading>
<!-- Unlike the non-mobile view, no overlay is shown. Thus, fields are -->
<!-- disabled instead if they do not fulfil a certain criteria. -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
</div>
<div class="row">
<div class="col-md-10 col-md-offset-1 col-sm-12">
<div feature-toggle feature-name="captcha">
<div>
<div
vc-recaptcha
key="captchaService.publicKey"
Expand Down
2 changes: 1 addition & 1 deletion tests/end-to-end/helpers/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ myInfoTypes.forEach((type) => {
// Admin tab contents
const buildTab = {
basicTab: Selector('#add-field .nav-tabs li[heading="Basic"]'),
myInfoTab: Selector('#add-field .nav-tabs li[feature-name="spcp-myinfo"]'),
myInfoTab: Selector('#add-field .nav-tabs li').withText('MyInfo'),
getFieldPanel: (fieldType) =>
// We need withExactText otherwise Mobile Number will match Number
Selector('.add-field-panel .add-field-text').withExactText(
Expand Down