Преглед изворни кода

Bugfix for incorrect roster height when allow_contact_requests=false.

Also update changelog and fix some linting errors.

Fixes #360
JC Brand пре 10 година
родитељ
комит
b177a6a7a0
4 измењених фајлова са 17 додато и 6 уклоњено
  1. 7 4
      converse.js
  2. 3 1
      css/converse.css
  3. 2 0
      docs/CHANGES.rst
  4. 5 1
      sass/converse.scss

+ 7 - 4
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);
                 }

+ 3 - 1
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;

+ 2 - 0
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)

+ 5 - 1
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;