Skip to content

Commit

Permalink
Workaround for Queries duplicating and sent replies disappearing.
Browse files Browse the repository at this point in the history
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
SpenserJ committed Dec 24, 2012
1 parent 5bfefdc commit b9eabfe
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions assets/js/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'});
});
Expand Down

5 comments on commit b9eabfe

@hoxca
Copy link

@hoxca hoxca commented on b9eabfe Dec 26, 2012

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did subway force the channel name and nick to lower case ?

I did the opposite, i remove those annoying toLowerCase() in client.js socket.js, irclink.js
and it work without side effect....

@thedjpetersen
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason is in the commit message. There were instances of windows duplicating.

@hoxca
Copy link

@hoxca hoxca commented on b9eabfe Dec 26, 2012 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SpenserJ
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Proper resolution would be retrieving the correct username before
creating the view on both the sending and receiving ends.

After removing all of the toLowerCase(), what happens if you open two windows and connect as TestUser and TestUser2, and then run "/msg testuser2 Hello" from TestUser. It should open a chat for "testuser2", but when TestUser2 replies, it will create another chat for "TestUser2".

If you will always use the proper case of the username when sending a query, you will never have an issue with this, but the vast majority of people will ignore case and let the application figure out what they want. Until we have a function built to retrieve the proper case of a username, this is the next best solution.

@hoxca
Copy link

@hoxca hoxca commented on b9eabfe Dec 26, 2012 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.