Permalink
Browse files

Workaround for Queries duplicating and sent replies disappearing.

As the user may be initiating a query with the incorrect case on a
username, it appears that the chat view was created as a lowercase
of the username. When a query reply was received, it had the proper
case, and would duplicate the window. Similarly, when sending a
reply to a query we received, we would look up a non-existant
stream due to an inconsistency of case.
This workaround forces all query views to have a lower-case name.
Proper resolution would be retrieving the correct username before
creating the view on both the sending and receiving ends.
  • Loading branch information...
1 parent 5bfefdc commit b9eabfe265e08209897ca0284289cea5048c1244 @SpenserJ committed Dec 23, 2012
Showing with 4 additions and 4 deletions.
  1. +4 −4 assets/js/client.js
View
@@ -184,12 +184,12 @@ $(function() {
});
irc.socket.on('pm', function(data) {
- var chatWindow = irc.chatWindows.getByName(data.nick);
+ var chatWindow = irc.chatWindows.getByName(data.nick.toLowerCase());
if (typeof chatWindow === 'undefined') {
- irc.chatWindows.add({name: data.nick, type: 'pm'})
+ irc.chatWindows.add({name: data.nick.toLowerCase(), type: 'pm'})
.trigger('forMe', 'newPm');
- irc.socket.emit('getOldMessages',{channelName: data.nick, skip:0, amount: 50});
- chatWindow = irc.chatWindows.getByName(data.nick);
+ irc.socket.emit('getOldMessages',{channelName: data.nick.toLowerCase(), skip:0, amount: 50});
+ chatWindow = irc.chatWindows.getByName(data.nick.toLowerCase());
}
chatWindow.stream.add({sender: data.nick, raw: data.text, type: 'pm'});
});

0 comments on commit b9eabfe

Please sign in to comment.