From 08796b5cee8bf555f5a97513c85320c14dbacbe1 Mon Sep 17 00:00:00 2001 From: Arit Amana <32520970+msarit@users.noreply.github.com> Date: Fri, 6 Nov 2020 18:19:34 -0500 Subject: [PATCH] [Team Email Login] Refactor Authentication Provider Enable/Disable (#11185) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Starting out * Building away... * Hooking buttons up * Hook Auth Provider buttons to Array Field * trying to fix NoNameError * Remains InviteOnlyMode disable and tests * Smashing remaining tasks * Last of tasks * add tests * Complete specs and tests 😅 * Fix bug * Additional guard * pass event to functions * Position Email Auth first * Fix bug in Email Auth Modal * Fix spacing issue * Update docs for adminModal.js * Show/hide Enabled Indicator with Enable/Undo buttons * Complete Auth Providers functionality * Update app/javascript/admin/controllers/config_controller.js Co-authored-by: Vaidehi Joshi * Update app/javascript/admin/controllers/config_controller.js Co-authored-by: Vaidehi Joshi * Update app/controllers/admin/configs_controller.rb Co-authored-by: Vaidehi Joshi * Update helper names * better implementation of EnabledIndicator show/hide * Small copy changes * Update spec/helpers/authentication_helper_spec.rb Co-authored-by: Vaidehi Joshi * Update app/views/admin/configs/show.html.erb Co-authored-by: Vaidehi Joshi * Update app/helpers/authentication_helper.rb Co-authored-by: Vaidehi Joshi Co-authored-by: Vaidehi Joshi --- .../utilities/showUserAlertModal.js | 62 +++--- app/assets/stylesheets/admin.scss | 11 + app/controllers/admin/configs_controller.rb | 27 ++- app/helpers/authentication_helper.rb | 42 +++- app/javascript/admin/adminModal.js | 7 +- .../admin/controllers/config_controller.js | 179 +++++++++++++--- .../configs/_auth_provider_settings.html.erb | 54 +++++ app/views/admin/configs/show.html.erb | 193 ++++++------------ spec/helpers/authentication_helper_spec.rb | 61 ++++++ spec/requests/admin/configs_spec.rb | 10 +- spec/requests/admin/podcasts_spec.rb | 4 +- .../comments/user_fills_out_comment_spec.rb | 1 - 12 files changed, 446 insertions(+), 205 deletions(-) create mode 100644 app/views/admin/configs/_auth_provider_settings.html.erb diff --git a/app/assets/javascripts/utilities/showUserAlertModal.js b/app/assets/javascripts/utilities/showUserAlertModal.js index 1e7bd30fd..ed28b9a1e 100644 --- a/app/assets/javascripts/utilities/showUserAlertModal.js +++ b/app/assets/javascripts/utilities/showUserAlertModal.js @@ -5,8 +5,8 @@ * @param {string} title The title/heading text to be displayed * @param {string} text The body text to be displayed * @param {string} confirm_text Text of the confirmation button - * - * @example + * + * @example * showUserAlertModal('Warning', 'You must wait', 'OK', '/faq/why-must-i-wait', 'Why must I wait?'); */ function showUserAlertModal(title, text, confirm_text) { @@ -14,44 +14,54 @@ function showUserAlertModal(title, text, confirm_text) { toggleUserAlertModal(); } /** - * Displays a user rate limit alert modal letting the user know what they did that exceeded a rate limit, + * Displays a user rate limit alert modal letting the user know what they did that exceeded a rate limit, * and gives them links to explain why they must wait * * @function showUserAlertModal * @param {string} action_text Description of the action taken by the user * @param {string} next_action_text Description of the next action that can be taken - * - * @example + * + * @example * showRateLimitModal('Made a comment', 'comment again'); */ function showRateLimitModal(action_text, next_action_text) { let rateLimitText = buildRateLimitText(action_text, next_action_text); - let rateLimitLink = "/faq"; - showUserAlertModal('Wait a Moment...', rateLimitText, 'Got it', rateLimitLink, "Why do I have to wait?") + let rateLimitLink = '/faq'; + showUserAlertModal( + 'Wait a Moment...', + rateLimitText, + 'Got it', + rateLimitLink, + 'Why do I have to wait?', + ); } /** * HTML ID for modal DOM node - * + * * @private - * @constant modalId * + * @constant modalId * * @type {string} */ const modalId = 'user-alert-modal'; /** * HTML template for modal - * + * * @private * @function getModalHtml - * + * * @param {string} title The title/heading text to be displayed * @param {string} text The body text to be displayed * @param {string} confirm_text Text of the confirmation button - * + * * @returns {string} HTML for the modal */ -const getModalHtml = (title, text, confirm_text) => `