From 5e59bf54f5101af2189b6b4664d84de6baf869df Mon Sep 17 00:00:00 2001 From: Jack Allnutt Date: Thu, 26 Sep 2013 19:46:08 +0100 Subject: [PATCH] Fix bug where nicks could be missing the first char(s) in the nicklist When a nick contains a PREFIX symbol that isn't at the beginning of the nick, the _kiwi.model.Member#stripPrefix function would still count it as a part of the prefix and remove an unrelated character from the front of the nick. --- client/assets/src/models/member.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/client/assets/src/models/member.js b/client/assets/src/models/member.js index 4e1f580..70bf75e 100644 --- a/client/assets/src/models/member.js +++ b/client/assets/src/models/member.js @@ -76,7 +76,7 @@ _kiwi.model.Member = Backbone.Model.extend({ return prefix; }, stripPrefix: function (nick) { - var tmp = nick, i, j, k; + var tmp = nick, i, j, k, cont = false; var user_prefixes = _kiwi.gateway.get('user_prefixes'); i = 0; @@ -84,9 +84,14 @@ _kiwi.model.Member = Backbone.Model.extend({ for (k = 0; k < user_prefixes.length; k++) { if (nick.charAt(j) === user_prefixes[k].symbol) { i++; + cont = true; break; } } + if (!cont) { + break; + } + cont = false; } return tmp.substr(i); -- 2.25.1