From 172ce7e0cea7f79bdcd65b068c267c9b78153819 Mon Sep 17 00:00:00 2001 From: JC Brand Date: Tue, 26 Jul 2016 06:59:34 +0000 Subject: [PATCH] Remove the members-list work and keep the nickname form stuff It's not stable yet and XMPP server support is very patchy. However, the nickname form work can be merged into master. --- css/converse.css | 7 +- docs/CHANGES.md | 6 +- sass/_chatrooms.scss | 8 +-- spec/chatroom.js | 19 ++--- src/converse-muc.js | 138 +++--------------------------------- src/templates/occupant.html | 2 +- 6 files changed, 27 insertions(+), 153 deletions(-) diff --git a/css/converse.css b/css/converse.css index 6eeb947dc..719e133e7 100644 --- a/css/converse.css +++ b/css/converse.css @@ -2043,12 +2043,9 @@ padding: 2px 5px; text-overflow: ellipsis; white-space: nowrap; - color: #A8ABA1; width: 100px; } - #conversejs .chatroom .box-flyout .chatroom-body .occupants .occupant-list li.online { - color: #1A9707; } - #conversejs .chatroom .box-flyout .chatroom-body .occupants .occupant-list li.online.moderator { - color: #D24E2B; } + #conversejs .chatroom .box-flyout .chatroom-body .occupants .occupant-list li.moderator { + color: #D24E2B; } #conversejs .chatroom .box-flyout .chatroom-body .chatroom-form-container { background-color: white; border-bottom-left-radius: 4px; diff --git a/docs/CHANGES.md b/docs/CHANGES.md index 2401072bd..be82eb568 100755 --- a/docs/CHANGES.md +++ b/docs/CHANGES.md @@ -1,8 +1,10 @@ # Changelog ## 1.0.5 (Unreleased) -- In case of a nickname conflict when joining a room, allow the user to choose a new nickname. [jcbrand] -- Check whether the user has a reserved nickname before entering a room, and if so, use it. [jcbrand] +- In case of nickname conflict when joining a room, allow the user to choose a new one. + [jcbrand] +- Check whether the user has a reserved nickname before entering a room, and if so, + use it. [jcbrand] ## 1.0.4 (2016-07-26) diff --git a/sass/_chatrooms.scss b/sass/_chatrooms.scss index 25d964f6f..52eba953b 100644 --- a/sass/_chatrooms.scss +++ b/sass/_chatrooms.scss @@ -108,13 +108,9 @@ padding: 2px 5px; text-overflow: ellipsis; white-space: nowrap; - color: $light-text-color; width: 100px; - &.online { - color: $online-color; - &.moderator { - color: $moderator-color; - } + &.moderator { + color: $moderator-color; } } } diff --git a/spec/chatroom.js b/spec/chatroom.js index e8b729c00..1c8014994 100644 --- a/spec/chatroom.js +++ b/spec/chatroom.js @@ -217,7 +217,7 @@ }).nodeTree; converse.connection._dataRecv(test_utils.createRequest(presence)); expect(view.onChatRoomPresence).toHaveBeenCalled(); - expect($occupants.find('li.online').length).toBe(i+1); + expect($occupants.find('li').length).toBe(i+1); } }.bind(converse)); @@ -522,7 +522,7 @@ */ var __ = utils.__.bind(converse); test_utils.openAndEnterChatRoom('lounge', 'localhost', 'oldnick'); - var view = this.chatboxviews.get('lounge@localhost'); + var view = converse.chatboxviews.get('lounge@localhost'); var $chat_content = view.$el.find('.chat-content'); spyOn(view, 'onChatRoomPresence').andCallThrough(); @@ -543,12 +543,11 @@ .c('status').attrs({code:'110'}).up() .c('status').attrs({code:'210'}).nodeTree; - this.connection._dataRecv(test_utils.createRequest(presence)); + converse.connection._dataRecv(test_utils.createRequest(presence)); expect(view.onChatRoomPresence).toHaveBeenCalled(); var $occupants = view.$('.occupant-list'); expect($occupants.children().length).toBe(1); expect($occupants.children().first(0).text()).toBe("oldnick"); - expect($occupants.children().first().hasClass('online')).toBe(true); expect($chat_content.find('div.chat-info').length).toBe(1); expect($chat_content.find('div.chat-info').html()).toBe(__(view.newNicknameMessages["210"], "oldnick")); @@ -569,17 +568,13 @@ .c('status').attrs({code:'303'}).up() .c('status').attrs({code:'110'}).nodeTree; - this.connection._dataRecv(test_utils.createRequest(presence)); + converse.connection._dataRecv(test_utils.createRequest(presence)); expect(view.onChatRoomPresence).toHaveBeenCalled(); expect($chat_content.find('div.chat-info').length).toBe(2); expect($chat_content.find('div.chat-info').last().html()).toBe(__(view.newNicknameMessages["303"], "newnick")); - // The occupant is still listed (because they have affiliation - // of "member"), but they don't have the "online" class - // anymore. $occupants = view.$('.occupant-list'); - expect($occupants.children().length).toBe(1); - expect($occupants.children().first().hasClass('online')).toBe(false); + expect($occupants.children().length).toBe(0); presence = $pres().attrs({ from:'lounge@localhost/newnick', @@ -594,14 +589,14 @@ }).up() .c('status').attrs({code:'110'}).nodeTree; - this.connection._dataRecv(test_utils.createRequest(presence)); + converse.connection._dataRecv(test_utils.createRequest(presence)); expect(view.onChatRoomPresence).toHaveBeenCalled(); expect($chat_content.find('div.chat-info').length).toBe(2); expect($chat_content.find('div.chat-info').last().html()).toBe(__(view.newNicknameMessages["303"], "newnick")); $occupants = view.$('.occupant-list'); expect($occupants.children().length).toBe(1); expect($occupants.children().first(0).text()).toBe("newnick"); - }.bind(converse)); + }); it("informs users if they have been kicked out of the chat room", function () { /* - * - * - * - * - */ - _.each($(iq).find('query item'), function (item) { - var jid = item.getAttribute('jid'); - var occupant = this.model.where({'jid': jid}).pop(); - var data = { - 'jid': item.getAttribute('jid'), - 'affiliation': item.getAttribute('affiliation') - }; - if (occupant) { - occupant.save(data); - } else { - this.model.create(data); - } - }.bind(this)); - return; - }, - initInviteWidget: function () { var $el = this.$('input.invited-contact'); $el.typeahead({ diff --git a/src/templates/occupant.html b/src/templates/occupant.html index 48482eeba..a7b258501 100644 --- a/src/templates/occupant.html +++ b/src/templates/occupant.html @@ -1,4 +1,4 @@ -