瀏覽代碼

Add new configuration setting "allow_contact_removal".

JC Brand 10 年之前
父節點
當前提交
90e4d6cba6
共有 4 個文件被更改,包括 20 次插入1 次删除
  1. 4 1
      converse.js
  2. 6 0
      docs/CHANGES.rst
  3. 8 0
      docs/source/configuration.rst
  4. 2 0
      src/templates/roster_item.html

+ 4 - 1
converse.js

@@ -244,6 +244,7 @@
         // Default configuration values
         // ----------------------------
         this.default_settings = {
+            allow_contact_removal: true,
             allow_contact_requests: true,
             allow_dragresize: true,
             allow_logout: true,
@@ -3572,7 +3573,8 @@
                         _.extend(item.toJSON(), {
                             'desc_status': STATUSES[chat_status||'offline'],
                             'desc_chat': __('Click to chat with this contact'),
-                            'desc_remove': __('Click to remove this contact')
+                            'desc_remove': __('Click to remove this contact'),
+                            'allow_contact_removal': converse.allow_contact_removal
                         })
                     ));
                 }
@@ -3586,6 +3588,7 @@
 
             removeContact: function (ev) {
                 if (ev && ev.preventDefault) { ev.preventDefault(); }
+                if (!converse.allow_contact_removal) { return; }
                 var result = confirm(__("Are you sure you want to remove this contact?"));
                 if (result === true) {
                     var bare_jid = this.model.get('jid');

+ 6 - 0
docs/CHANGES.rst

@@ -1,6 +1,12 @@
 Changelog
 =========
 
+0.9.1 (Unreleased)
+------------------
+
+* Set the JID input field in the login form to ``type=email``. [chatme]
+* New configuration setting ``allow_contact_removal``. [jcbrand]
+
 0.9.0 (2015-03-06)
 ------------------
 

+ 8 - 0
docs/source/configuration.rst

@@ -28,6 +28,14 @@ JS file so that it will include the new settings. Please refer to the
 Configuration variables
 =======================
 
+allow_contact_removal
+---------------------
+
+Default:  ``true``
+
+Allow the user to remove roster contacts by clicking on the delete icon
+(i.e. traschcan) next to a contact's name in the roster.
+
 allow_contact_requests
 ----------------------
 

+ 2 - 0
src/templates/roster_item.html

@@ -1,4 +1,6 @@
 <a class="open-chat" title="Name: {{fullname}}
 JID: {{jid}}
 {{desc_chat}}" href="#"><span class="icon-{{chat_status}}" title="{{desc_status}}"></span>{{fullname}}</a>
+{[ if (allow_contact_removal) { ]}
 <a class="remove-xmpp-contact icon-remove" title="{{desc_remove}}" href="#"></a>
+{[ } ]}