Browse Source

Hide invite widget if the room is not open

or if the room is members-only and the user is not the owner.
JC Brand 8 years ago
parent
commit
a5bfd7fa57
2 changed files with 18 additions and 14 deletions
  1. 13 11
      docs/CHANGES.md
  2. 5 3
      src/templates/chatroom_sidebar.html

+ 13 - 11
docs/CHANGES.md

@@ -18,6 +18,8 @@
   [jcbrand]
   [jcbrand]
 - Chat room features are shown in the sidebar. [jcbrand]
 - Chat room features are shown in the sidebar. [jcbrand]
 - Show the chat room occupant's JID in the tooltip (if you're allowed to see it). [jcbrand]
 - Show the chat room occupant's JID in the tooltip (if you're allowed to see it). [jcbrand]
+- Hide the chat room invite widget if the room is not open or if the room is members-only
+  and the user is not the owner. [jcbrand]
 - Created a new non-core plugin `converse-muc-embedded` which embeds a single
 - Created a new non-core plugin `converse-muc-embedded` which embeds a single
   chat room into a page. An example can be found at https://conversejs.org/demo/embedded.html
   chat room into a page. An example can be found at https://conversejs.org/demo/embedded.html
   [jcbrand]
   [jcbrand]
@@ -42,7 +44,7 @@
   Backbone.View object. This means the API of the returned object has changed.
   Backbone.View object. This means the API of the returned object has changed.
   You're still able to do everything from before but now also much more.
   You're still able to do everything from before but now also much more.
   [jcbrand]
   [jcbrand]
-- Allow JIDs not on the roster to be invited to a chatroom. [jcbrand]
+- Allow JIDs not on the roster to be invited to a chat room. [jcbrand]
 - Bugfix. `TypeError: this.sendConfiguration(...).then is not a function` when
 - Bugfix. `TypeError: this.sendConfiguration(...).then is not a function` when
   an instant room is created. [jcbrand]
   an instant room is created. [jcbrand]
 - Ensure consistent behavior from `show_controlbox_by_default` [jcbrand]
 - Ensure consistent behavior from `show_controlbox_by_default` [jcbrand]
@@ -109,7 +111,7 @@
 
 
 ## 2.0.1 (2016-11-07)
 ## 2.0.1 (2016-11-07)
 - #203 New configuration setting [muc_domain](https://conversejs.org/docs/html/configuration.html#muc-domain) [jcbrand]
 - #203 New configuration setting [muc_domain](https://conversejs.org/docs/html/configuration.html#muc-domain) [jcbrand]
-- #705 White content after submitting password on chatrooms [jcbrand]
+- #705 White content after submitting password on chat rooms [jcbrand]
 - #712 Controlbox clicks stop responding after auto-reconnect [jcbrand]
 - #712 Controlbox clicks stop responding after auto-reconnect [jcbrand]
 - Removed shared state between tests. All tests are now isolated. [jcbrand]
 - Removed shared state between tests. All tests are now isolated. [jcbrand]
 - Allow the context (i.e. `this` value) to be passed in when registering event
 - Allow the context (i.e. `this` value) to be passed in when registering event
@@ -128,7 +130,7 @@
 - Continuously attempt to resurrect dead connections when `auto_reconnect` is `true`. [jcbrand]
 - Continuously attempt to resurrect dead connections when `auto_reconnect` is `true`. [jcbrand]
 - Update the 'rooms' API to allow user to pass in room attributes. [jcbrand]
 - Update the 'rooms' API to allow user to pass in room attributes. [jcbrand]
 - New configuration setting [message_storage](https://conversejs.org/docs/html/configuration.html#message-storage) [jcbrand]
 - New configuration setting [message_storage](https://conversejs.org/docs/html/configuration.html#message-storage) [jcbrand]
-- Hardcode the storage for roster contacts and chatroom occupants to `sessionStorage`. [jcbrand]
+- Hardcode the storage for roster contacts and chat room occupants to `sessionStorage`. [jcbrand]
 - Fixed wrong chat state value, should be `chat`, not `chatty`.
 - Fixed wrong chat state value, should be `chat`, not `chatty`.
   See [RFC 3921](https://xmpp.org/rfcs/rfc3921.html#rfc.section.2.1.2.2). [jcbrand]
   See [RFC 3921](https://xmpp.org/rfcs/rfc3921.html#rfc.section.2.1.2.2). [jcbrand]
 - Adds support for SASL-EXTERNAL. [jcbrand]
 - Adds support for SASL-EXTERNAL. [jcbrand]
@@ -159,7 +161,7 @@
 
 
 ## 1.0.4 (2016-07-26)
 ## 1.0.4 (2016-07-26)
 
 
-- Restrict occupants sidebar to 30% chatroom width. [jcbrand]
+- Restrict occupants sidebar to 30% chat room width. [jcbrand]
 - Made requesting contacts more visible, by placing them at the top of the roster. [jcbrand]
 - Made requesting contacts more visible, by placing them at the top of the roster. [jcbrand]
 - `insertIntoPage` method of `ChatBoxView` has been renamed to `insertIntoDOM`,
 - `insertIntoPage` method of `ChatBoxView` has been renamed to `insertIntoDOM`,
   to make it the same as the method of `ChatRoomView`. [jcbrand]
   to make it the same as the method of `ChatRoomView`. [jcbrand]
@@ -244,7 +246,7 @@
 - #352 When the user has manually scrolled up in a chat window, don't scroll
 - #352 When the user has manually scrolled up in a chat window, don't scroll
   down on chat event notifications. [jcbrand]
   down on chat event notifications. [jcbrand]
 - #524 Added [auto_join_on_invite](https://conversejs.org/docs/html/configuration.html#auto_join_on_invite)
 - #524 Added [auto_join_on_invite](https://conversejs.org/docs/html/configuration.html#auto_join_on_invite)
-  parameter for automatically joining chatrooms. [ben]
+  parameter for automatically joining chat rooms. [ben]
 - #520 Set specific domain. Two new options [default_domain](https://conversejs.org/docs/html/configuration.html#default_domain)
 - #520 Set specific domain. Two new options [default_domain](https://conversejs.org/docs/html/configuration.html#default_domain)
   and [locked_domain](https://conversejs.org/docs/html/configuration.html#locked_domain). [jcbrand]
   and [locked_domain](https://conversejs.org/docs/html/configuration.html#locked_domain). [jcbrand]
 - #521 Not sending presence when connecting after disconnection. [jcbrand]
 - #521 Not sending presence when connecting after disconnection. [jcbrand]
@@ -253,7 +255,7 @@
 - #540 `bind is not a function` error for plugins without `initialize` method. [jcbrand]
 - #540 `bind is not a function` error for plugins without `initialize` method. [jcbrand]
 - #547 By default the `offline` state is no longer choosable.
 - #547 By default the `offline` state is no longer choosable.
   See [include_offline_state](https://conversejs.org/docs/html/configuration.html#include-offline-state) for details. [jcbrand]
   See [include_offline_state](https://conversejs.org/docs/html/configuration.html#include-offline-state) for details. [jcbrand]
-- A chatroom invite might come from someone not in your roster list. [ben]
+- A chat room invite might come from someone not in your roster list. [ben]
 - #487 Empty the resources array when the resource is null [rlanvin]
 - #487 Empty the resources array when the resource is null [rlanvin]
 - #534 Updated Russian translation [LaconicTranslator]
 - #534 Updated Russian translation [LaconicTranslator]
 - #555 The status restored from sessionStorage is never updated [jcbrand]
 - #555 The status restored from sessionStorage is never updated [jcbrand]
@@ -651,9 +653,9 @@ versions of the 0.6 branch.*
 
 
 ## 0.4.0 (2013-06-03)
 ## 0.4.0 (2013-06-03)
 
 
-- CSS tweaks: fixed overflowing text in status message and chatrooms list. [jcbrand]
-- Bugfix: Couldn't join chatroom when clicking from a list of rooms. [jcbrand]
-- Add better support for kicking or banning users from chatrooms. [jcbrand]
+- CSS tweaks: fixed overflowing text in status message and chat rooms list. [jcbrand]
+- Bugfix: Couldn't join chat room when clicking from a list of rooms. [jcbrand]
+- Add better support for kicking or banning users from chat rooms. [jcbrand]
 - Fixed alignment of chat messages in Firefox. [jcbrand]
 - Fixed alignment of chat messages in Firefox. [jcbrand]
 - More intelligent fetching of vCards. [jcbrand]
 - More intelligent fetching of vCards. [jcbrand]
 - Fixed a race condition bug. Make sure that the roster is populated before sending initial presence. [jcbrand]
 - Fixed a race condition bug. Make sure that the roster is populated before sending initial presence. [jcbrand]
@@ -670,9 +672,9 @@ versions of the 0.6 branch.*
 - Separate messages according to day in chats. [jcbrand]
 - Separate messages according to day in chats. [jcbrand]
 - Add support for specifying the BOSH bind URL as configuration setting. [jcbrand]
 - Add support for specifying the BOSH bind URL as configuration setting. [jcbrand]
 - #8 Improve the message counter to only increment when the window is not focused [witekdev]
 - #8 Improve the message counter to only increment when the window is not focused [witekdev]
-- Make fetching of list of chatrooms on a server a configuration option. [jcbrand]
+- Make fetching of list of chat rooms on a server a configuration option. [jcbrand]
 - Use service discovery to show all available features on a room. [jcbrand]
 - Use service discovery to show all available features on a room. [jcbrand]
-- Multi-user chatrooms are now configurable. [jcbrand]
+- Multi-user chat rooms are now configurable. [jcbrand]
 
 
 ## 0.2.0 (2013-03-28)
 ## 0.2.0 (2013-03-28)
 
 

+ 5 - 3
src/templates/chatroom_sidebar.html

@@ -1,10 +1,12 @@
 <!-- <div class="occupants"> -->
 <!-- <div class="occupants"> -->
 <p class="occupants-heading">{{{label_occupants}}}</p>
 <p class="occupants-heading">{{{label_occupants}}}</p>
-{[ if (allow_muc_invitations) { ]}
-<form class="pure-form room-invite">
+<form class="pure-form room-invite
+    {[ if (!allow_muc_invitations || (!open && affiliation !== "owner")) { ]}
+        hidden
+    {[ } ]}
+    ">
     <input class="invited-contact" placeholder="{{{label_invitation}}}" type="text"/>
     <input class="invited-contact" placeholder="{{{label_invitation}}}" type="text"/>
 </form>
 </form>
-{[ } ]}
 <ul class="occupant-list"></ul>
 <ul class="occupant-list"></ul>
 
 
 <p class="occupants-heading">{{{label_features}}}</p>
 <p class="occupants-heading">{{{label_features}}}</p>