فهرست منبع

Merge pull request #428 from thierrytiti/chat-with-pending

Enhancement #394 Option to allow chatting with pending contacts
JC Brand 10 سال پیش
والد
کامیت
98f6ea8a3f
5فایلهای تغییر یافته به همراه27 افزوده شده و 3 حذف شده
  1. 5 2
      converse.js
  2. 1 0
      docs/CHANGES.rst
  3. 7 0
      docs/source/configuration.rst
  4. 8 1
      src/templates/pending_contact.html
  5. 6 0
      src/templates/requesting_contact.html

+ 5 - 2
converse.js

@@ -303,6 +303,7 @@
         // Default configuration values
         // ----------------------------
         this.default_settings = {
+            allow_chat_pending_contacts: false,
             allow_contact_removal: true,
             allow_contact_requests: true,
             allow_dragresize: true,
@@ -3879,7 +3880,8 @@
                     this.$el.addClass('pending-xmpp-contact');
                     this.$el.html(converse.templates.pending_contact(
                         _.extend(item.toJSON(), {
-                            'desc_remove': __('Click to remove this contact')
+                            'desc_remove': __('Click to remove this contact'),
+                            'allow_chat_pending_contacts': converse.allow_chat_pending_contacts
                         })
                     ));
                 } else if (requesting === true) {
@@ -3887,7 +3889,8 @@
                     this.$el.html(converse.templates.requesting_contact(
                         _.extend(item.toJSON(), {
                             'desc_accept': __("Click to accept this contact request"),
-                            'desc_decline': __("Click to decline this contact request")
+                            'desc_decline': __("Click to decline this contact request"),
+                            'allow_chat_pending_contacts': converse.allow_chat_pending_contacts
                         })
                     ));
                     converse.controlboxtoggle.showControlBox();

+ 1 - 0
docs/CHANGES.rst

@@ -6,6 +6,7 @@ Changelog
 
 * #144 Add Ping funcionnality and Pong Handler [thierrytiti]
 * #389 Allow login panel placeholders and roster item 'Name' translations. [gbonvehi]
+* #394 Option to allow chatting with pending contacts [thierrytiti]
 * #396 Add automatic Away mode and XEP-0352 support [thierrytiti]
 * #400, #410 Allow offline pretty status and placeholder for "Insert a smiley" to be translated [thierrytiti]
 * #401 Updated French translation [thierrytiti]

+ 7 - 0
docs/source/configuration.rst

@@ -98,6 +98,13 @@ Here's an example of converse.js being initialized with these three options:
     });
 
 
+allow_chat_pending_contacts
+---------------------------
+
+* Default:  ``false``
+
+Allow the user to chat with pending contacts.
+
 allow_contact_removal
 ---------------------
 

+ 8 - 1
src/templates/pending_contact.html

@@ -1,2 +1,9 @@
+{[ if (allow_chat_pending_contacts)  { ]}
+<a class="open-chat"href="#">
+{[ } ]}
 <span class="pending-contact-name" title="Name: {{fullname}}
-JID: {{jid}}">{{fullname}}</span> <a class="remove-xmpp-contact icon-remove" title="{{desc_remove}}" href="#"></a>
+JID: {{jid}}">{{fullname}}</span> 
+{[ if (allow_chat_pending_contacts)  { ]}
+</a>
+{[ } ]}
+<a class="remove-xmpp-contact icon-remove" title="{{desc_remove}}" href="#"></a>

+ 6 - 0
src/templates/requesting_contact.html

@@ -1,5 +1,11 @@
+{[ if (allow_chat_pending_contacts)  { ]}
+<a class="open-chat"href="#">
+{[ } ]}
 <span class="req-contact-name" title="Name: {{fullname}}
 JID: {{jid}}">{{fullname}}</span>
+{[ if (allow_chat_pending_contacts)  { ]}
+</a>
+{[ } ]}
 <span class="request-actions">
     <a class="accept-xmpp-request icon-checkmark" title="{{desc_accept}}" href="#"></a>
     <a class="decline-xmpp-request icon-close" title="{{desc_decline}}" href="#"></a>