From 7f7a32df0ccb890f5073a7392c2dad060f1ee0e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lorenz=20H=C3=BCbschle-Schneider?= Date: Thu, 20 Nov 2014 14:09:49 +0100 Subject: [PATCH 1/2] Close the correct tag --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index 512b424..112d994 100644 --- a/index.html +++ b/index.html @@ -360,7 +360,7 @@ $ openssl req -nodes -newkey rsa:4096 -keyout relay.pem -x509 -days 365 -out rel
From d783d0e91b679eb9f88aac32eb00d98eb225bbc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lorenz=20H=C3=BCbschle-Schneider?= Date: Thu, 20 Nov 2014 21:12:18 +0100 Subject: [PATCH 2/2] Fix display of buffers without a short_name --- js/handlers.js | 5 ++++- js/models.js | 6 ++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/js/handlers.js b/js/handlers.js index 4418389..e1dfe9d 100644 --- a/js/handlers.js +++ b/js/handlers.js @@ -74,7 +74,10 @@ weechat.factory('handlers', ['$rootScope', '$log', 'models', 'plugins', 'notific var old = models.getBuffer(buffer); old.fullName = obj.full_name; old.shortName = obj.short_name; - old.trimmedName = obj.short_name.replace(/^[#&+]/, '') || ' '; + // If it's a channel, trim away the prefix (#, &, or +). If that is empty and the buffer + // has a short name, use a space (because the prefix will be displayed separately, and we don't want + // prefix + fullname, which would happen otherwise). Else, use null so that full_name is used + old.trimmedName = obj.short_name.replace(/^[#&+]/, '') || (obj.short_name ? ' ' : null); old.prefix = ['#', '&', '+'].indexOf(obj.short_name.charAt(0)) >= 0 ? obj.short_name.charAt(0) : ''; }; diff --git a/js/models.js b/js/models.js index 559950c..8f576f8 100644 --- a/js/models.js +++ b/js/models.js @@ -15,8 +15,10 @@ models.service('models', ['$rootScope', '$filter', function($rootScope, $filter) // weechat properties var fullName = message.full_name; var shortName = message.short_name; - // just use a space if the rest of the channel name is empty ('#') - var trimmedName = shortName.replace(/^[#&+]/, '') || ' '; + // If it's a channel, trim away the prefix (#, &, or +). If that is empty and the buffer + // has a short name, use a space (because the prefix will be displayed separately, and we don't want + // prefix + fullname, which would happen otherwise). Else, use null so that full_name is used + var trimmedName = shortName.replace(/^[#&+]/, '') || (shortName ? ' ' : null); // get channel identifier var prefix = ['#', '&', '+'].indexOf(shortName.charAt(0)) >= 0 ? shortName.charAt(0) : ''; var title = message.title;