From b177a6a7a09e2cedc44601881b68f8f5aa8b22de Mon Sep 17 00:00:00 2001 From: JC Brand Date: Wed, 8 Apr 2015 13:12:29 +0200 Subject: [PATCH] Bugfix for incorrect roster height when allow_contact_requests=false. Also update changelog and fix some linting errors. Fixes #360 --- converse.js | 11 +++++++---- css/converse.css | 4 +++- docs/CHANGES.rst | 2 ++ sass/converse.scss | 6 +++++- 4 files changed, 17 insertions(+), 6 deletions(-) diff --git a/converse.js b/converse.js index 3dc581c72..82e8cf7a5 100644 --- a/converse.js +++ b/converse.js @@ -3810,7 +3810,6 @@ handleIncomingSubscription: function (jid) { var bare_jid = Strophe.getBareJidFromJid(jid); var item = this.get(bare_jid); - if (!converse.allow_contact_requests) { converse.connection.roster.unauthorize(bare_jid); return true; @@ -4148,6 +4147,11 @@ label_contacts: LABEL_CONTACTS, label_groups: LABEL_GROUPS })); + if (!converse.allow_contact_requests) { + // XXX: if we ever support live editing of config then + // we'll need to be able to remove this class on the fly. + this.$el.addClass('no-contact-requests'); + } return this; }, @@ -5546,7 +5550,7 @@ 'rooms': { 'open': function (jids, nick) { if (!nick) { - nick = Strophe.getNodeFromJid(converse.bare_jid) + nick = Strophe.getNodeFromJid(converse.bare_jid); } if (typeof nick !== "string") { throw new TypeError('rooms.open: invalid nick, must be string'); @@ -5555,7 +5559,7 @@ var chatroom = converse.chatboxes.get(jid); converse.log('jid'); if (!chatroom) { - var chatroom = converse.chatboxviews.showChat({ + chatroom = converse.chatboxviews.showChat({ 'id': jid, 'jid': jid, 'name': Strophe.unescapeNode(Strophe.getNodeFromJid(jid)), @@ -5576,7 +5580,6 @@ 'get': function (jids) { if (typeof jids === "undefined") { throw new TypeError("rooms.get: You need to provide at least one JID"); - return null; } else if (typeof jids === "string") { return getWrappedChatBox(jids); } diff --git a/css/converse.css b/css/converse.css index de6fc7416..aa0aa6bee 100644 --- a/css/converse.css +++ b/css/converse.css @@ -677,10 +677,12 @@ position: relative; margin: 0.5em 0 0 0; height: 194px; - height: calc(100% - 68px); + height: calc(100% - 50px - 20px); overflow: hidden; /* (jQ addClass:) if input has value: */ /* (jQ addClass:) if mouse is over the 'x' input area*/ } + #conversejs #converse-roster.no-contact-requests { + height: calc(100% - 25px - 20px); } #conversejs #converse-roster .filter-type { display: table-cell; float: right; diff --git a/docs/CHANGES.rst b/docs/CHANGES.rst index a2520fd03..c5569fff5 100644 --- a/docs/CHANGES.rst +++ b/docs/CHANGES.rst @@ -11,6 +11,8 @@ Changelog * #357 Fix the known bug where a state notification reopens a chat box. [floriancargoet] * #358 Bugfix. Chat rooms show the same occupants bug. [floriancargoet] * #359 Fix a timeout bug in chat state notifications. [floriancargoet] +* #360 Incorrect roster height when ``allow_contact_requests=true``. [floriancargoet, jcbrand] +* #362 Add API for retrieving and opening rooms. [pzia] * #364 Text selection in chat boxes not shown in Firefox. [jcbrand] 0.9.1 (2015-03-26) diff --git a/sass/converse.scss b/sass/converse.scss index a7842f82b..3b1241b98 100644 --- a/sass/converse.scss +++ b/sass/converse.scss @@ -740,9 +740,13 @@ position: relative; margin: 0.5em 0 0 0; height: $roster-height; - height: calc(100% - 68px); + height: calc(100% - #{$controlbox-dropdown-height*2} - 20px); overflow: hidden; + &.no-contact-requests { + height: calc(100% - #{$controlbox-dropdown-height} - 20px); + } + .filter-type { display: table-cell; float: right;