From cbbfb196928f798aedfd731d723b103c59dbfd7b Mon Sep 17 00:00:00 2001 From: Thomas Ip Date: Thu, 22 Aug 2019 19:08:24 +0800 Subject: [PATCH] settings: Remove header_map and lookup section names from DOM. Fixes #13046. --- static/js/settings.js | 30 ++++-------------------------- 1 file changed, 4 insertions(+), 26 deletions(-) diff --git a/static/js/settings.js b/static/js/settings.js index 044719289e..8216404f76 100644 --- a/static/js/settings.js +++ b/static/js/settings.js @@ -3,29 +3,6 @@ var render_settings_tab = require('../templates/settings_tab.hbs'); var settings = (function () { var exports = {}; -var header_map = { - "your-account": i18n.t("Your account"), - "display-settings": i18n.t("Display settings"), - notifications: i18n.t("Notifications"), - "your-bots": i18n.t("Your bots"), - "alert-words": i18n.t("Alert words"), - "uploaded-files": i18n.t("Uploaded files"), - "muted-topics": i18n.t("Muted topics"), - "organization-profile": i18n.t("Organization profile"), - "organization-settings": i18n.t("Organization settings"), - "organization-permissions": i18n.t("Organization permissions"), - "emoji-settings": i18n.t("Emoji settings"), - "auth-methods": i18n.t("Authorization methods"), - "user-list-admin": i18n.t("Active users"), - "deactivated-users-admin": i18n.t("Deactivated users"), - "bot-list-admin": i18n.t("Bot list"), - "default-streams-list": i18n.t("Default streams"), - "filter-settings": i18n.t("Linkifiers"), - "invites-list-admin": i18n.t("Invitations"), - "user-groups-admin": i18n.t("User groups"), - "profile-field-settings": i18n.t("Profile field settings"), - "data-exports-admin": i18n.t("Data exports"), -}; $("body").ready(function () { var $sidebar = $(".form-sidebar"); @@ -158,11 +135,12 @@ exports.launch = function (section) { }; exports.set_settings_header = function (key) { - if (header_map[key]) { - $(".settings-header h1 .section").text(" / " + header_map[key]); + var header_text = $(`#settings_page .sidebar-list [data-section='${key}'] .text`).text(); + if (header_text) { + $(".settings-header h1 .section").text(" / " + header_text); } else { blueslip.warn("Error: the key '" + key + "' does not exist in the settings" + - " header mapping file. Please add it."); + " sidebar list. Please add it."); } };