Skip to content

Node.js based forum software built for the modern web

fix: chat ip button not doing anything if clicked outside of icon

Barış Soner Uşaklıf974c230efb4
diff --git a/install/package.json b/install/package.json
index b8325f4745..5cbb66926c 100644
--- a/install/package.json
+++ b/install/package.json
@@ -100,10 +100,10 @@
"nodebb-plugin-ntfy": "1.0.15",
"nodebb-plugin-spam-be-gone": "2.0.7",
"nodebb-rewards-essentials": "0.2.3",
- "nodebb-theme-harmony": "1.0.18",
+ "nodebb-theme-harmony": "1.0.19",
"nodebb-theme-lavender": "7.0.9",
- "nodebb-theme-peace": "2.0.21",
- "nodebb-theme-persona": "13.0.63",
+ "nodebb-theme-peace": "2.0.22",
+ "nodebb-theme-persona": "13.0.64",
"nodebb-widget-essentials": "7.0.12",
"nodemailer": "6.9.1",
"nprogress": "0.2.0",
diff --git a/public/src/client/chats.js b/public/src/client/chats.js
index 246754add5..98833e1e92 100644
--- a/public/src/client/chats.js
+++ b/public/src/client/chats.js
@@ -103,20 +103,18 @@ define('forum/chats', [
};
Chats.addIPHandler = function (container) {
- container.on('click', '.chat-ip-button', function () {
- const ipEl = $(this).parent();
+ container.on('click', '.chat-ip-button', async function () {
+ const ipEl = $(this);
+ let ip = ipEl.attr('data-ip');
+ if (ip) {
+ navigator.clipboard.writeText(ip);
+ ipEl.translateText('[[global:copied]]');
+ setTimeout(() => ipEl.text(ip), 2000);
+ return;
+ }
const mid = ipEl.parents('[data-mid]').attr('data-mid');
- socket.emit('modules.chats.getIP', mid, function (err, ip) {
- if (err) {
- return alerts.error(err);
- }
- ipEl.text(ip);
- ipEl.on('click', () => {
- navigator.clipboard.writeText(ip);
- ipEl.translateText('[[global:copied]]');
- setTimeout(() => ipEl.text(ip), 2000);
- });
- });
+ ip = await socket.emit('modules.chats.getIP', mid);
+ ipEl.text(ip).attr('data-ip', ip);
});
};