Răsfoiți Sursa

Fixes #953 MUC "Features" displayed when exiting configuration

JC Brand 7 ani în urmă
părinte
comite
41ca34a051
6 a modificat fișierele cu 30 adăugiri și 39 ștergeri
  1. 1 0
      CHANGES.md
  2. 1 4
      css/converse.css
  3. 2 8
      css/inverse.css
  4. 1 3
      sass/_chatrooms.scss
  5. 0 2
      sass/inverse/_chatrooms.scss
  6. 25 22
      src/converse-muc.js

+ 1 - 0
CHANGES.md

@@ -5,6 +5,7 @@
 ### Bugfixes
 - #800 Could not register successfully in ejabberd 17.01
 - #949 Don't flash the roster contacts filter (i.e. hide by default)
+- #953 MUC "Features" displayed when exiting configuration
 - Don't require `auto_login` to be `true` when using the API to log in.
 - Moment locale wasn't being set to the value passed via the `i18n` option.
 - In the chat heading, two avatars sometimes get rendered.

+ 1 - 4
css/converse.css

@@ -2595,11 +2595,8 @@
           font-weight: bold; }
         #converse-embedded-chat .chatroom .box-flyout .chatroom-body .occupants .chatroom-features,
         #conversejs .chatroom .box-flyout .chatroom-body .occupants .chatroom-features {
-          position: absolute;
           bottom: 0.5em;
-          width: 25%;
-          width: -webkit-calc(30% - 1em);
-          width: calc(30% - 1em); }
+          width: 100%; }
         #converse-embedded-chat .chatroom .box-flyout .chatroom-body .occupants .awesomplete ul,
         #conversejs .chatroom .box-flyout .chatroom-body .occupants .awesomplete ul {
           padding: 0; }

+ 2 - 8
css/inverse.css

@@ -2757,11 +2757,8 @@ body {
           font-weight: bold; }
         #converse-embedded-chat .chatroom .box-flyout .chatroom-body .occupants .chatroom-features,
         #conversejs .chatroom .box-flyout .chatroom-body .occupants .chatroom-features {
-          position: absolute;
           bottom: 0.5em;
-          width: 25%;
-          width: -webkit-calc(30% - 1em);
-          width: calc(30% - 1em); }
+          width: 100%; }
         #converse-embedded-chat .chatroom .box-flyout .chatroom-body .occupants .awesomplete ul,
         #conversejs .chatroom .box-flyout .chatroom-body .occupants .awesomplete ul {
           padding: 0; }
@@ -2906,10 +2903,7 @@ body {
         #conversejs .chatroom .box-flyout .chatroom-body .occupants .occupants-heading {
           font-size: 18px; }
         #conversejs .chatroom .box-flyout .chatroom-body .occupants .chatroom-features {
-          bottom: 1em;
-          width: 25%;
-          width: -webkit-calc(30% - 2em);
-          width: calc(30% - 2em); }
+          bottom: 1em; }
         #conversejs .chatroom .box-flyout .chatroom-body .occupants ul.occupant-list {
           height: -webkit-calc(100% - 212px);
           height: calc(100% - 212px); }

+ 1 - 3
sass/_chatrooms.scss

@@ -119,10 +119,8 @@
                         font-weight: bold;
                     }
                     .chatroom-features {
-                        position: absolute;
                         bottom: 0.5em;
-                        width: 25%;
-                        @include calc(width, '30% - 1em');
+                        width: 100%;
                     }
                     .awesomplete {
                         ul {

+ 0 - 2
sass/inverse/_chatrooms.scss

@@ -46,8 +46,6 @@
                     }
                     .chatroom-features {
                         bottom: $padding;
-                        width: 25%;
-                        @include calc(width, '30% - 2em');
                     }
                     ul {
                         &.occupant-list {

+ 25 - 22
src/converse-muc.js

@@ -573,6 +573,27 @@
                     this.leave();
                 },
 
+                setOccupantsVisibility () {
+                    if (this.model.get('hidden_occupants')) {
+                        const icon_el = this.el.querySelector('.icon-show-users');
+                        if (!_.isNull(icon_el)) {
+                            icon_el.classList.remove('icon-show-users');
+                            icon_el.classList.add('icon-hide-users');
+                        }
+                        this.el.querySelector('.chat-area').classList.remove('full');
+                        this.el.querySelector('.occupants').classList.remove('hidden');
+                    } else {
+                        const icon_el = this.el.querySelector('.icon-hide-users');
+                        if (!_.isNull(icon_el)) {
+                            icon_el.classList.remove('icon-hide-users');
+                            icon_el.classList.add('icon-show-users');
+                        }
+                        this.el.querySelector('.chat-area').classList.add('full');
+                        u.hideElement(this.el.querySelector('.occupants'));
+                    }
+                    this.occupantsview.setOccupantsHeight();
+                },
+
                 toggleOccupants (ev, preserve_state) {
                     /* Show or hide the right sidebar containing the chat
                      * occupants (and the invite widget).
@@ -581,27 +602,10 @@
                         ev.preventDefault();
                         ev.stopPropagation();
                     }
-                    if (preserve_state) {
-                        // Bit of a hack, to make sure that the sidebar's state doesn't change
+                    if (!preserve_state) {
                         this.model.set({hidden_occupants: !this.model.get('hidden_occupants')});
                     }
-                    if (!this.model.get('hidden_occupants')) {
-                        this.model.save({hidden_occupants: true});
-                        const icon_el = this.el.querySelector('.icon-hide-users');
-                        icon_el.classList.remove('icon-hide-users');
-                        icon_el.classList.add('icon-show-users');
-                        this.el.querySelector('.chat-area').classList.add('full');
-                        u.hideElement(this.el.querySelector('.occupants'));
-                    } else {
-                        this.model.save({hidden_occupants: false});
-                        const icon_el = this.el.querySelector('.icon-show-users');
-                        if (!_.isNull(icon_el)) {
-                            icon_el.classList.remove('icon-show-users');
-                            icon_el.classList.add('icon-hide-users');
-                        }
-                        this.el.querySelector('.chat-area').classList.remove('full');
-                        this.el.querySelector('.occupants').classList.remove('hidden');
-                    }
+                    this.setOccupantsVisibility();
                     this.scrollDown();
                 },
 
@@ -1862,9 +1866,8 @@
                     } else if (this.model.get('connection_status') == converse.ROOMSTATUS.PASSWORD_REQUIRED) {
                         this.renderPasswordForm();
                     } else {
-                        this.$el.find('.chat-area').removeClass('hidden');
-                        this.$el.find('.occupants').removeClass('hidden');
-                        this.occupantsview.setOccupantsHeight();
+                        this.el.querySelector('.chat-area').classList.remove('hidden');
+                        this.setOccupantsVisibility();
                         this.scrollDown();
                     }
                 },