settings: Remove header_map and lookup section names from DOM.

Fixes #13046.
This commit is contained in:
Thomas Ip 2019-08-22 19:08:24 +08:00 committed by Tim Abbott
parent 3d7b9a1349
commit cbbfb19692
1 changed files with 4 additions and 26 deletions

View File

@ -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.");
}
};