[polari/wip/fmuellner/combined-gsoc: 84/137] userTracker: Minor cleanup
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [polari/wip/fmuellner/combined-gsoc: 84/137] userTracker: Minor cleanup
- Date: Thu, 28 Jul 2016 16:22:30 +0000 (UTC)
commit e182152a1b14110431e3904a482b37c9f866dff0
Author: Florian Müllner <fmuellner gnome org>
Date: Thu Jul 14 02:52:58 2016 +0200
userTracker: Minor cleanup
A contact is unique within a room, so if we remove a contact from
a room mapping, we can just search by alias and don't need the
room name.
The same doesn't apply when we remove a contact from the global
contacts list, where the same contact can be added for multiple
rooms. But then we only really care about the number of contacts
for a particular baseNick, so it doesn't matter if we just remove
the first match ...
src/userTracker.js | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/src/userTracker.js b/src/userTracker.js
index d55cd3b..db96ac5 100644
--- a/src/userTracker.js
+++ b/src/userTracker.js
@@ -297,8 +297,8 @@ const UserTracker = new Lang.Class({
let baseNick = Polari.util_get_basenick(member.alias);
let contacts = map.get(baseNick) || [];
- /*TODO: maybe use a for loop?*/
- let indexToDelete = contacts.map(c => c.alias + "|" + c._room.channelName).indexOf(member.alias +
"|" + member._room.channelName);
+ /*TODO: i really don't like this search. maybe use a for loop?*/
+ let indexToDelete = contacts.map(c => c.alias.indexOf(member.alias);
if (indexToDelete > -1) {
let removedMember = contacts.splice(indexToDelete, 1)[0];
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]