Node.js based forum software built for the modern web
fix: tx string in room rename modal
Barış Soner Uşaklı316ff580eac7
diff --git a/public/src/client/chats.js b/public/src/client/chats.jsindex b450e007ec..206208bc08 100644--- a/public/src/client/chats.js+++ b/public/src/client/chats.js@@ -20,11 +20,12 @@ define('forum/chats', ['chat','api','uploadHelpers',+ 'translator',], function (components, mousetrap, recentChats, create,manage, messages, userList, messageSearch, pinnedMessages,events, search, autocomplete, hooks, bootbox, alerts,- chatModule, api, uploadHelpers+ chatModule, api, uploadHelpers, translator) {const Chats = {activeAutocomplete: {},@@ -521,9 +522,7 @@ define('forum/chats', [Chats.addRenameHandler = function (roomId, buttonEl) {buttonEl.on('click', async function () {const { roomName } = await api.get(`/chats/${roomId}`);- const html = await app.parseAndTranslate('modals/rename-room', {- name: roomName,- });+ const html = await app.parseAndTranslate('modals/rename-room', {});const modal = bootbox.dialog({title: '[[modules:chat.rename-room]]',message: html,@@ -543,6 +542,13 @@ define('forum/chats', [},},});+ modal.on('show.bs.modal', function () {+ const val = translator.unescape(roomName);+ modal.find('#roomName').val(val).selectRange(0, val.length);+ });+ modal.on('shown.bs.modal', function () {+ modal.find('#roomName').focus();+ });});};diff --git a/public/src/modules/translator.common.js b/public/src/modules/translator.common.jsindex 7c76d8f5c3..81299cbce8 100644--- a/public/src/modules/translator.common.js+++ b/public/src/modules/translator.common.js@@ -263,7 +263,8 @@ module.exports = function (utils, load, warn) {let escaped = arg.replace(/%(?=\d)/g, '%').replace(/\\,/g, ',');// fix double escaped translation keys, see https://github.com/NodeBB/NodeBB/issues/9206escaped = escaped.replace(/&lsqb;/g, '[')- .replace(/&rsqb;/g, ']');+ .replace(/&rsqb;/g, ']')+ .replace(/&#44;/g, ',');out = out.replace(new RegExp('%' + (i + 1), 'g'), escaped);});out = validateHrefAttributes(out);diff --git a/src/views/modals/rename-room.tpl b/src/views/modals/rename-room.tplindex 9a77ca105c..fe797b6b95 100644--- a/src/views/modals/rename-room.tpl+++ b/src/views/modals/rename-room.tpl@@ -1,4 +1,4 @@-<input type="text" class="form-control" id="roomName" placeholder="[[modules:chat.rename-placeholder]]" value="{name}" />+<input type="text" class="form-control" id="roomName" placeholder="[[modules:chat.rename-placeholder]]" /><p class="form-text">[[modules:chat.rename-help]]</p>\ No newline at end of file