Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
converse.js
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
converse.js
Commits
37f43989
Commit
37f43989
authored
Oct 26, 2018
by
JC Brand
Committed by
GitHub
Oct 26, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1269 from conversejs/async-await
Async await
parents
c583678c
ad27edb2
Changes
24
Show whitespace changes
Inline
Side-by-side
Showing
24 changed files
with
1183 additions
and
1202 deletions
+1183
-1202
css/converse.css
css/converse.css
+6
-3
dist/converse.js
dist/converse.js
+305
-288
sass/_chatbox.scss
sass/_chatbox.scss
+11
-1
spec/bookmarks.js
spec/bookmarks.js
+214
-209
spec/chatbox.js
spec/chatbox.js
+80
-106
spec/chatroom.js
spec/chatroom.js
+25
-26
spec/http-file-upload.js
spec/http-file-upload.js
+259
-263
spec/notification.js
spec/notification.js
+42
-39
spec/roster.js
spec/roster.js
+18
-31
spec/spoilers.js
spec/spoilers.js
+3
-0
src/converse-bookmarks.js
src/converse-bookmarks.js
+19
-27
src/converse-chatview.js
src/converse-chatview.js
+33
-24
src/converse-minimize.js
src/converse-minimize.js
+26
-27
src/converse-muc-views.js
src/converse-muc-views.js
+2
-2
src/converse-oauth.js
src/converse-oauth.js
+9
-12
src/converse-profile.js
src/converse-profile.js
+0
-1
src/converse-rosterview.js
src/converse-rosterview.js
+4
-5
src/headless/converse-chatboxes.js
src/headless/converse-chatboxes.js
+18
-16
src/headless/converse-disco.js
src/headless/converse-disco.js
+53
-60
src/headless/converse-muc.js
src/headless/converse-muc.js
+46
-52
src/headless/utils/core.js
src/headless/utils/core.js
+0
-8
src/templates/alert.html
src/templates/alert.html
+1
-1
src/utils/html.js
src/utils/html.js
+9
-0
tests/runner.js
tests/runner.js
+0
-1
No files found.
css/converse.css
View file @
37f43989
...
@@ -9569,12 +9569,15 @@ body.reset {
...
@@ -9569,12 +9569,15 @@ body.reset {
max-height
:
200px
;
}
max-height
:
200px
;
}
#conversejs
.converse-overlayed
.emoji-picker
{
#conversejs
.converse-overlayed
.emoji-picker
{
height
:
100px
;
}
height
:
100px
;
}
#conversejs
.converse-overlayed
.chatbox
form
.sendXMPPMessage
.chat-toolbar
li
.toolbar-menu
{
#conversejs
.converse-overlayed
.chatbox
.sendXMPPMessage
.chat-toolbar
li
.toolbar-menu
{
min-width
:
235px
;
}
min-width
:
235px
;
}
#conversejs
.converse-overlayed
.chatbox
form
.sendXMPPMessage
.chat-toolbar
li
.toolbar-menu
ul
.emoji-toolbar
{
#conversejs
.converse-overlayed
.chatbox
.sendXMPPMessage
.chat-toolbar
li
.toolbar-menu
ul
.emoji-toolbar
{
width
:
100%
;
}
width
:
100%
;
}
#conversejs
.converse-overlayed
.chatbox
form
.sendXMPPMessage
.chat-toolbar
li
.toolbar-menu
ul
.emoji-toolbar
.emoji-category
{
#conversejs
.converse-overlayed
.chatbox
.sendXMPPMessage
.chat-toolbar
li
.toolbar-menu
ul
.emoji-toolbar
.emoji-category
{
float
:
left
;
}
float
:
left
;
}
#conversejs
.converse-overlayed
.chatbox
.sendXMPPMessage
.chat-toolbar
li
.toggle-smiley
.emoji-toolbar
.emoji-category-picker
ul
{
flex-wrap
:
wrap
;
justify-content
:
flex-start
;
}
@media
(
max-width
:
767.98px
)
{
@media
(
max-width
:
767.98px
)
{
#conversejs
.converse-overlayed
>
.row
{
#conversejs
.converse-overlayed
>
.row
{
...
...
dist/converse.js
View file @
37f43989
...
@@ -57833,17 +57833,17 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins
...
@@ -57833,17 +57833,17 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins
close_button.insertAdjacentHTML('afterend', bookmark_button);
close_button.insertAdjacentHTML('afterend', bookmark_button);
},
},
renderHeading() {
async
renderHeading() {
this.__super__.renderHeading.apply(this, arguments);
this.__super__.renderHeading.apply(this, arguments);
const _converse = this.__super__._converse;
const _converse = this.__super__._converse;
if (_converse.allow_bookmarks) {
if (_converse.allow_bookmarks) {
_converse.checkBookmarksSupport().then(supported => {
const supported = await _converse.checkBookmarksSupport();
if (supported) {
if (supported) {
this.renderBookmarkToggle();
this.renderBookmarkToggle();
}
}
}).catch(_.partial(_converse.log, _, Strophe.LogLevel.FATAL));
}
}
},
},
...
@@ -58343,31 +58343,27 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins
...
@@ -58343,31 +58343,27 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins
});
});
_converse.checkBookmarksSupport = function () {
_converse.checkBookmarksSupport = async function () {
return new Promise((resolve, reject) => {
const args = await Promise.all([_converse.api.disco.getIdentity('pubsub', 'pep', _converse.bare_jid), _converse.api.disco.supports(Strophe.NS.PUBSUB + '#publish-options', _converse.bare_jid)]);
Promise.all([_converse.api.disco.getIdentity('pubsub', 'pep', _converse.bare_jid), _converse.api.disco.supports(Strophe.NS.PUBSUB + '#publish-options', _converse.bare_jid)]).then(args => {
return args[0] && (args[1].length || _converse.allow_public_bookmarks);
resolve(args[0] && (args[1].length || _converse.allow_public_bookmarks));
}).catch(_.partial(_converse.log, _, Strophe.LogLevel.FATAL));
}).catch(_.partial(_converse.log, _, Strophe.LogLevel.FATAL));
};
};
const initBookmarks = function initBookmarks() {
const initBookmarks =
async
function initBookmarks() {
if (!_converse.allow_bookmarks) {
if (!_converse.allow_bookmarks) {
return;
return;
}
}
_converse.checkBookmarksSupport().then(supported => {
const supported = await _converse.checkBookmarksSupport();
if (supported) {
if (supported) {
_converse.bookmarks = new _converse.Bookmarks();
_converse.bookmarks = new _converse.Bookmarks();
_converse.bookmarksview = new _converse.BookmarksView({
_converse.bookmarksview = new _converse.BookmarksView({
'model': _converse.bookmarks
'model': _converse.bookmarks
});
});
await _converse.bookmarks.fetchBookmarks();
}
_converse.bookmarks.fetchBookmarks().catch(_.partial(_converse.log, _, Strophe.LogLevel.FATAL)).then(() => _converse.emit('bookmarksInitialized'));
} else {
_converse.emit('bookmarksInitialized');
_converse.emit('bookmarksInitialized');
}
});
};
};
u.onMultipleEvents([{
u.onMultipleEvents([{
...
@@ -58693,37 +58689,39 @@ __webpack_require__.r(__webpack_exports__);
...
@@ -58693,37 +58689,39 @@ __webpack_require__.r(__webpack_exports__);
/* harmony import */ var bootstrap__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! bootstrap */ "./node_modules/bootstrap.native/dist/bootstrap-native-v4.js");
/* harmony import */ var bootstrap__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! bootstrap */ "./node_modules/bootstrap.native/dist/bootstrap-native-v4.js");
/* harmony import */ var bootstrap__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(bootstrap__WEBPACK_IMPORTED_MODULE_4__);
/* harmony import */ var bootstrap__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(bootstrap__WEBPACK_IMPORTED_MODULE_4__);
/* harmony import */ var _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @converse/headless/converse-core */ "./src/headless/converse-core.js");
/* harmony import */ var _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @converse/headless/converse-core */ "./src/headless/converse-core.js");
/* harmony import */ var templates_chatbox_html__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! templates/chatbox.html */ "./src/templates/chatbox.html");
/* harmony import */ var templates_alert_html__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! templates/alert.html */ "./src/templates/alert.html");
/* harmony import */ var templates_chatbox_html__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(templates_chatbox_html__WEBPACK_IMPORTED_MODULE_6__);
/* harmony import */ var templates_alert_html__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(templates_alert_html__WEBPACK_IMPORTED_MODULE_6__);
/* harmony import */ var templates_chatbox_head_html__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! templates/chatbox_head.html */ "./src/templates/chatbox_head.html");
/* harmony import */ var templates_chatbox_html__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! templates/chatbox.html */ "./src/templates/chatbox.html");
/* harmony import */ var templates_chatbox_head_html__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(templates_chatbox_head_html__WEBPACK_IMPORTED_MODULE_7__);
/* harmony import */ var templates_chatbox_html__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(templates_chatbox_html__WEBPACK_IMPORTED_MODULE_7__);
/* harmony import */ var templates_chatbox_message_form_html__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! templates/chatbox_message_form.html */ "./src/templates/chatbox_message_form.html");
/* harmony import */ var templates_chatbox_head_html__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! templates/chatbox_head.html */ "./src/templates/chatbox_head.html");
/* harmony import */ var templates_chatbox_message_form_html__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(templates_chatbox_message_form_html__WEBPACK_IMPORTED_MODULE_8__);
/* harmony import */ var templates_chatbox_head_html__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(templates_chatbox_head_html__WEBPACK_IMPORTED_MODULE_8__);
/* harmony import */ var templates_emojis_html__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! templates/emojis.html */ "./src/templates/emojis.html");
/* harmony import */ var templates_chatbox_message_form_html__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! templates/chatbox_message_form.html */ "./src/templates/chatbox_message_form.html");
/* harmony import */ var templates_emojis_html__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(templates_emojis_html__WEBPACK_IMPORTED_MODULE_9__);
/* harmony import */ var templates_chatbox_message_form_html__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(templates_chatbox_message_form_html__WEBPACK_IMPORTED_MODULE_9__);
/* harmony import */ var templates_error_message_html__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! templates/error_message.html */ "./src/templates/error_message.html");
/* harmony import */ var templates_emojis_html__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! templates/emojis.html */ "./src/templates/emojis.html");
/* harmony import */ var templates_error_message_html__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(templates_error_message_html__WEBPACK_IMPORTED_MODULE_10__);
/* harmony import */ var templates_emojis_html__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(templates_emojis_html__WEBPACK_IMPORTED_MODULE_10__);
/* harmony import */ var templates_help_message_html__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! templates/help_message.html */ "./src/templates/help_message.html");
/* harmony import */ var templates_error_message_html__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! templates/error_message.html */ "./src/templates/error_message.html");
/* harmony import */ var templates_help_message_html__WEBPACK_IMPORTED_MODULE_11___default = /*#__PURE__*/__webpack_require__.n(templates_help_message_html__WEBPACK_IMPORTED_MODULE_11__);
/* harmony import */ var templates_error_message_html__WEBPACK_IMPORTED_MODULE_11___default = /*#__PURE__*/__webpack_require__.n(templates_error_message_html__WEBPACK_IMPORTED_MODULE_11__);
/* harmony import */ var templates_info_html__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! templates/info.html */ "./src/templates/info.html");
/* harmony import */ var templates_help_message_html__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! templates/help_message.html */ "./src/templates/help_message.html");
/* harmony import */ var templates_info_html__WEBPACK_IMPORTED_MODULE_12___default = /*#__PURE__*/__webpack_require__.n(templates_info_html__WEBPACK_IMPORTED_MODULE_12__);
/* harmony import */ var templates_help_message_html__WEBPACK_IMPORTED_MODULE_12___default = /*#__PURE__*/__webpack_require__.n(templates_help_message_html__WEBPACK_IMPORTED_MODULE_12__);
/* harmony import */ var templates_new_day_html__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! templates/new_day.html */ "./src/templates/new_day.html");
/* harmony import */ var templates_info_html__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! templates/info.html */ "./src/templates/info.html");
/* harmony import */ var templates_new_day_html__WEBPACK_IMPORTED_MODULE_13___default = /*#__PURE__*/__webpack_require__.n(templates_new_day_html__WEBPACK_IMPORTED_MODULE_13__);
/* harmony import */ var templates_info_html__WEBPACK_IMPORTED_MODULE_13___default = /*#__PURE__*/__webpack_require__.n(templates_info_html__WEBPACK_IMPORTED_MODULE_13__);
/* harmony import */ var templates_spinner_html__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! templates/spinner.html */ "./src/templates/spinner.html");
/* harmony import */ var templates_new_day_html__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! templates/new_day.html */ "./src/templates/new_day.html");
/* harmony import */ var templates_spinner_html__WEBPACK_IMPORTED_MODULE_14___default = /*#__PURE__*/__webpack_require__.n(templates_spinner_html__WEBPACK_IMPORTED_MODULE_14__);
/* harmony import */ var templates_new_day_html__WEBPACK_IMPORTED_MODULE_14___default = /*#__PURE__*/__webpack_require__.n(templates_new_day_html__WEBPACK_IMPORTED_MODULE_14__);
/* harmony import */ var templates_spoiler_button_html__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! templates/spoiler_button.html */ "./src/templates/spoiler_button.html");
/* harmony import */ var templates_spinner_html__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! templates/spinner.html */ "./src/templates/spinner.html");
/* harmony import */ var templates_spoiler_button_html__WEBPACK_IMPORTED_MODULE_15___default = /*#__PURE__*/__webpack_require__.n(templates_spoiler_button_html__WEBPACK_IMPORTED_MODULE_15__);
/* harmony import */ var templates_spinner_html__WEBPACK_IMPORTED_MODULE_15___default = /*#__PURE__*/__webpack_require__.n(templates_spinner_html__WEBPACK_IMPORTED_MODULE_15__);
/* harmony import */ var templates_status_message_html__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! templates/status_message.html */ "./src/templates/status_message.html");
/* harmony import */ var templates_spoiler_button_html__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! templates/spoiler_button.html */ "./src/templates/spoiler_button.html");
/* harmony import */ var templates_status_message_html__WEBPACK_IMPORTED_MODULE_16___default = /*#__PURE__*/__webpack_require__.n(templates_status_message_html__WEBPACK_IMPORTED_MODULE_16__);
/* harmony import */ var templates_spoiler_button_html__WEBPACK_IMPORTED_MODULE_16___default = /*#__PURE__*/__webpack_require__.n(templates_spoiler_button_html__WEBPACK_IMPORTED_MODULE_16__);
/* harmony import */ var templates_toolbar_html__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! templates/toolbar.html */ "./src/templates/toolbar.html");
/* harmony import */ var templates_status_message_html__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! templates/status_message.html */ "./src/templates/status_message.html");
/* harmony import */ var templates_toolbar_html__WEBPACK_IMPORTED_MODULE_17___default = /*#__PURE__*/__webpack_require__.n(templates_toolbar_html__WEBPACK_IMPORTED_MODULE_17__);
/* harmony import */ var templates_status_message_html__WEBPACK_IMPORTED_MODULE_17___default = /*#__PURE__*/__webpack_require__.n(templates_status_message_html__WEBPACK_IMPORTED_MODULE_17__);
/* harmony import */ var templates_toolbar_fileupload_html__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! templates/toolbar_fileupload.html */ "./src/templates/toolbar_fileupload.html");
/* harmony import */ var templates_toolbar_html__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! templates/toolbar.html */ "./src/templates/toolbar.html");
/* harmony import */ var templates_toolbar_fileupload_html__WEBPACK_IMPORTED_MODULE_18___default = /*#__PURE__*/__webpack_require__.n(templates_toolbar_fileupload_html__WEBPACK_IMPORTED_MODULE_18__);
/* harmony import */ var templates_toolbar_html__WEBPACK_IMPORTED_MODULE_18___default = /*#__PURE__*/__webpack_require__.n(templates_toolbar_html__WEBPACK_IMPORTED_MODULE_18__);
/* harmony import */ var templates_user_details_modal_html__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! templates/user_details_modal.html */ "./src/templates/user_details_modal.html");
/* harmony import */ var templates_toolbar_fileupload_html__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! templates/toolbar_fileupload.html */ "./src/templates/toolbar_fileupload.html");
/* harmony import */ var templates_user_details_modal_html__WEBPACK_IMPORTED_MODULE_19___default = /*#__PURE__*/__webpack_require__.n(templates_user_details_modal_html__WEBPACK_IMPORTED_MODULE_19__);
/* harmony import */ var templates_toolbar_fileupload_html__WEBPACK_IMPORTED_MODULE_19___default = /*#__PURE__*/__webpack_require__.n(templates_toolbar_fileupload_html__WEBPACK_IMPORTED_MODULE_19__);
/* harmony import */ var utils_emoji__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! utils/emoji */ "./src/headless/utils/emoji.js");
/* harmony import */ var templates_user_details_modal_html__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! templates/user_details_modal.html */ "./src/templates/user_details_modal.html");
/* harmony import */ var xss__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! xss */ "./node_modules/xss/dist/xss.js");
/* harmony import */ var templates_user_details_modal_html__WEBPACK_IMPORTED_MODULE_20___default = /*#__PURE__*/__webpack_require__.n(templates_user_details_modal_html__WEBPACK_IMPORTED_MODULE_20__);
/* harmony import */ var xss__WEBPACK_IMPORTED_MODULE_21___default = /*#__PURE__*/__webpack_require__.n(xss__WEBPACK_IMPORTED_MODULE_21__);
/* harmony import */ var utils_emoji__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! utils/emoji */ "./src/headless/utils/emoji.js");
/* harmony import */ var xss__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! xss */ "./node_modules/xss/dist/xss.js");
/* harmony import */ var xss__WEBPACK_IMPORTED_MODULE_22___default = /*#__PURE__*/__webpack_require__.n(xss__WEBPACK_IMPORTED_MODULE_22__);
// Converse.js
// Converse.js
// http://conversejs.org
// http://conversejs.org
//
//
...
@@ -58749,6 +58747,7 @@ __webpack_require__.r(__webpack_exports__);
...
@@ -58749,6 +58747,7 @@ __webpack_require__.r(__webpack_exports__);
const _converse$env = _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].env,
const _converse$env = _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].env,
...
@@ -58829,11 +58828,11 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
...
@@ -58829,11 +58828,11 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
},
},
toHTML() {
toHTML() {
return templates_emojis_html__WEBPACK_IMPORTED_MODULE_
9
___default()(_.extend(this.model.toJSON(), {
return templates_emojis_html__WEBPACK_IMPORTED_MODULE_
10
___default()(_.extend(this.model.toJSON(), {
'_': _,
'_': _,
'transform': utils_emoji__WEBPACK_IMPORTED_MODULE_2
0
__["default"].getEmojiRenderer(_converse),
'transform': utils_emoji__WEBPACK_IMPORTED_MODULE_2
1
__["default"].getEmojiRenderer(_converse),
'emojis_by_category': utils_emoji__WEBPACK_IMPORTED_MODULE_2
0
__["default"].getEmojisByCategory(_converse),
'emojis_by_category': utils_emoji__WEBPACK_IMPORTED_MODULE_2
1
__["default"].getEmojisByCategory(_converse),
'toned_emojis': utils_emoji__WEBPACK_IMPORTED_MODULE_2
0
__["default"].getTonedEmojis(_converse),
'toned_emojis': utils_emoji__WEBPACK_IMPORTED_MODULE_2
1
__["default"].getTonedEmojis(_converse),
'skintones': ['tone1', 'tone2', 'tone3', 'tone4', 'tone5'],
'skintones': ['tone1', 'tone2', 'tone3', 'tone4', 'tone5'],
'shouldBeHidden': this.shouldBeHidden
'shouldBeHidden': this.shouldBeHidden
}));
}));
...
@@ -58893,7 +58892,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
...
@@ -58893,7 +58892,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
},
},
render() {
render() {
this.el.innerHTML = templates_chatbox_head_html__WEBPACK_IMPORTED_MODULE_
7
___default()(_.extend(this.model.vcard.toJSON(), this.model.toJSON(), {
this.el.innerHTML = templates_chatbox_head_html__WEBPACK_IMPORTED_MODULE_
8
___default()(_.extend(this.model.vcard.toJSON(), this.model.toJSON(), {
'_converse': _converse,
'_converse': _converse,
'info_close': __('Close this chat box')
'info_close': __('Close this chat box')
}));
}));
...
@@ -58929,7 +58928,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
...
@@ -58929,7 +58928,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
},
},
toHTML() {
toHTML() {
return templates_user_details_modal_html__WEBPACK_IMPORTED_MODULE_
19
___default()(_.extend(this.model.toJSON(), this.model.vcard.toJSON(), {
return templates_user_details_modal_html__WEBPACK_IMPORTED_MODULE_
20
___default()(_.extend(this.model.toJSON(), this.model.vcard.toJSON(), {
'_': _,
'_': _,
'__': __,
'__': __,
'view': this,
'view': this,
...
@@ -58937,7 +58936,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
...
@@ -58937,7 +58936,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
'allow_contact_removal': _converse.allow_contact_removal,
'allow_contact_removal': _converse.allow_contact_removal,
'display_name': this.model.getDisplayName(),
'display_name': this.model.getDisplayName(),
'is_roster_contact': !_.isUndefined(this.model.contact),
'is_roster_contact': !_.isUndefined(this.model.contact),
'utils': utils_emoji__WEBPACK_IMPORTED_MODULE_2
0
__["default"]
'utils': utils_emoji__WEBPACK_IMPORTED_MODULE_2
1
__["default"]
}));
}));
},
},
...
@@ -58952,15 +58951,26 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
...
@@ -58952,15 +58951,26 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
}
}
},
},
refreshContact(ev) {
async
refreshContact(ev) {
if (ev && ev.preventDefault) {
if (ev && ev.preventDefault) {
ev.preventDefault();
ev.preventDefault();
}
}
const refresh_icon = this.el.querySelector('.fa-refresh');
const refresh_icon = this.el.querySelector('.fa-refresh');
utils_emoji__WEBPACK_IMPORTED_MODULE_20__["default"].addClass('fa-spin', refresh_icon);
utils_emoji__WEBPACK_IMPORTED_MODULE_21__["default"].addClass('fa-spin', refresh_icon);
try {
await _converse.api.vcard.update(this.model.contact.vcard, true);
} catch (e) {
_converse.log(e, Strophe.LogLevel.FATAL);
_converse.api.vcard.update(this.model.contact.vcard, true).then(() => utils_emoji__WEBPACK_IMPORTED_MODULE_20__["default"].removeClass('fa-spin', refresh_icon)).catch(_.partial(_converse.log, _, Strophe.LogLevel.FATAL));
this.el.querySelector('.modal-body').insertAdjacentHTML('afterBegin', templates_alert_html__WEBPACK_IMPORTED_MODULE_6___default()({
'type': 'alert-danger',
'message': __('Sorry, something went wrong while trying to refresh')
}));
}
utils_emoji__WEBPACK_IMPORTED_MODULE_21__["default"].removeClass('fa-spin', refresh_icon);
},
},
removeContact(ev) {
removeContact(ev) {
...
@@ -59038,7 +59048,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
...
@@ -59038,7 +59048,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
render() {
render() {
// XXX: Is this still needed?
// XXX: Is this still needed?
this.el.setAttribute('id', this.model.get('box_id'));
this.el.setAttribute('id', this.model.get('box_id'));
this.el.innerHTML = templates_chatbox_html__WEBPACK_IMPORTED_MODULE_
6
___default()(_.extend(this.model.toJSON(), {
this.el.innerHTML = templates_chatbox_html__WEBPACK_IMPORTED_MODULE_
7
___default()(_.extend(this.model.toJSON(), {
'unread_msgs': __('You have unread messages')
'unread_msgs': __('You have unread messages')
}));
}));
this.content = this.el.querySelector('.chat-content');
this.content = this.el.querySelector('.chat-content');
...
@@ -59052,7 +59062,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
...
@@ -59052,7 +59062,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
return this;
return this;
}
}
toolbar = toolbar || templates_toolbar_html__WEBPACK_IMPORTED_MODULE_1
7
___default.a;
toolbar = toolbar || templates_toolbar_html__WEBPACK_IMPORTED_MODULE_1
8
___default.a;
options = _.assign(this.model.toJSON(), this.getToolbarOptions(options || {}));
options = _.assign(this.model.toJSON(), this.getToolbarOptions(options || {}));
this.el.querySelector('.chat-toolbar').innerHTML = toolbar(options);
this.el.querySelector('.chat-toolbar').innerHTML = toolbar(options);
this.addSpoilerButton(options);
this.addSpoilerButton(options);
...
@@ -59073,7 +59083,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
...
@@ -59073,7 +59083,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
}
}
const form_container = this.el.querySelector('.message-form-container');
const form_container = this.el.querySelector('.message-form-container');
form_container.innerHTML = templates_chatbox_message_form_html__WEBPACK_IMPORTED_MODULE_
8
___default()(_.extend(this.model.toJSON(), {
form_container.innerHTML = templates_chatbox_message_form_html__WEBPACK_IMPORTED_MODULE_
9
___default()(_.extend(this.model.toJSON(), {
'hint_value': _.get(this.el.querySelector('.spoiler-hint'), 'value'),
'hint_value': _.get(this.el.querySelector('.spoiler-hint'), 'value'),
'label_message': placeholder,
'label_message': placeholder,
'label_send': __('Send'),
'label_send': __('Send'),
...
@@ -59114,17 +59124,17 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
...
@@ -59114,17 +59124,17 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
this.model.sendFiles(evt.target.files);
this.model.sendFiles(evt.target.files);
},
},
addFileUploadButton(options) {
async addFileUploadButton(options) {
_converse.api.disco.supports(Strophe.NS.HTTPUPLOAD, _converse.domain).then(result => {
const result = await _converse.api.disco.supports(Strophe.NS.HTTPUPLOAD, _converse.domain);
if (result.length) {
if (result.length) {
this.el.querySelector('.chat-toolbar').insertAdjacentHTML('beforeend', templates_toolbar_fileupload_html__WEBPACK_IMPORTED_MODULE_18
___default()({
this.el.querySelector('.chat-toolbar').insertAdjacentHTML('beforeend', templates_toolbar_fileupload_html__WEBPACK_IMPORTED_MODULE_19
___default()({
'tooltip_upload_file': __('Choose a file to send')
'tooltip_upload_file': __('Choose a file to send')
}));
}));
}
}
}).catch(_.partial(_converse.log, _, Strophe.LogLevel.FATAL));
},
},
addSpoilerButton(options) {
a
sync a
ddSpoilerButton(options) {
/* Asynchronously adds a button for writing spoiler
/* Asynchronously adds a button for writing spoiler
* messages, based on whether the contact's client supports
* messages, based on whether the contact's client supports
* it.
* it.
...
@@ -59140,9 +59150,10 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
...
@@ -59140,9 +59150,10 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
return;
return;
}
}
Promise.all(_.map(_.keys(resources), resource => _converse.api.disco.supports(Strophe.NS.SPOILER, `${contact_jid}/${resource}`))).then(results => {
const results = await Promise.all(_.map(_.keys(resources), resource => _converse.api.disco.supports(Strophe.NS.SPOILER, `${contact_jid}/${resource}`)));
if (_.filter(results, 'length').length) {
if (_.filter(results, 'length').length) {
const html = templates_spoiler_button_html__WEBPACK_IMPORTED_MODULE_15
___default()(this.model.toJSON());
const html = templates_spoiler_button_html__WEBPACK_IMPORTED_MODULE_16
___default()(this.model.toJSON());
if (_converse.visible_toolbar_buttons.emoji) {
if (_converse.visible_toolbar_buttons.emoji) {
this.el.querySelector('.toggle-smiley').insertAdjacentHTML('afterEnd', html);
this.el.querySelector('.toggle-smiley').insertAdjacentHTML('afterEnd', html);
...
@@ -59150,7 +59161,6 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
...
@@ -59150,7 +59161,6 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
this.el.querySelector('.chat-toolbar').insertAdjacentHTML('afterBegin', html);
this.el.querySelector('.chat-toolbar').insertAdjacentHTML('afterBegin', html);
}
}
}
}
}).catch(_.partial(_converse.log, _, Strophe.LogLevel.FATAL));
},
},
insertHeading() {
insertHeading() {
...
@@ -59218,7 +59228,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
...
@@ -59218,7 +59228,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
showChatEvent(message) {
showChatEvent(message) {
const isodate = moment().format();
const isodate = moment().format();
this.content.insertAdjacentHTML('beforeend', templates_info_html__WEBPACK_IMPORTED_MODULE_1
2
___default()({
this.content.insertAdjacentHTML('beforeend', templates_info_html__WEBPACK_IMPORTED_MODULE_1
3
___default()({
'extra_classes': 'chat-event',
'extra_classes': 'chat-event',
'message': message,
'message': message,
'isodate': isodate
'isodate': isodate
...
@@ -59229,7 +59239,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
...
@@ -59229,7 +59239,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
},
},
showErrorMessage(message) {
showErrorMessage(message) {
this.content.insertAdjacentHTML('beforeend', templates_error_message_html__WEBPACK_IMPORTED_MODULE_1
0
___default()({
this.content.insertAdjacentHTML('beforeend', templates_error_message_html__WEBPACK_IMPORTED_MODULE_1
1
___default()({
'message': message,
'message': message,
'isodate': moment().format()
'isodate': moment().format()
}));
}));
...
@@ -59239,10 +59249,10 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
...
@@ -59239,10 +59249,10 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
addSpinner(append = false) {
addSpinner(append = false) {
if (_.isNull(this.el.querySelector('.spinner'))) {
if (_.isNull(this.el.querySelector('.spinner'))) {
if (append) {
if (append) {
this.content.insertAdjacentHTML('beforeend', templates_spinner_html__WEBPACK_IMPORTED_MODULE_1
4
___default()());
this.content.insertAdjacentHTML('beforeend', templates_spinner_html__WEBPACK_IMPORTED_MODULE_1
5
___default()());
this.scrollDown();
this.scrollDown();
} else {
} else {
this.content.insertAdjacentHTML('afterbegin', templates_spinner_html__WEBPACK_IMPORTED_MODULE_1
4
___default()());
this.content.insertAdjacentHTML('afterbegin', templates_spinner_html__WEBPACK_IMPORTED_MODULE_1
5
___default()());
}
}
}
}
},
},
...
@@ -59263,7 +59273,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
...
@@ -59263,7 +59273,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
* This element must have a "data-isodate" attribute
* This element must have a "data-isodate" attribute
* which specifies its creation date.
* which specifies its creation date.
*/
*/
const prev_msg_el = utils_emoji__WEBPACK_IMPORTED_MODULE_2
0
__["default"].getPreviousElement(next_msg_el, ".message:not(.chat-state-notification)"),
const prev_msg_el = utils_emoji__WEBPACK_IMPORTED_MODULE_2
1
__["default"].getPreviousElement(next_msg_el, ".message:not(.chat-state-notification)"),
prev_msg_date = _.isNull(prev_msg_el) ? null : prev_msg_el.getAttribute('data-isodate'),
prev_msg_date = _.isNull(prev_msg_el) ? null : prev_msg_el.getAttribute('data-isodate'),
next_msg_date = next_msg_el.getAttribute('data-isodate');
next_msg_date = next_msg_el.getAttribute('data-isodate');
...
@@ -59273,7 +59283,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
...
@@ -59273,7 +59283,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
if (_.isNull(prev_msg_date) || moment(next_msg_date).isAfter(prev_msg_date, 'day')) {
if (_.isNull(prev_msg_date) || moment(next_msg_date).isAfter(prev_msg_date, 'day')) {
const day_date = moment(next_msg_date).startOf('day');
const day_date = moment(next_msg_date).startOf('day');
next_msg_el.insertAdjacentHTML('beforeBegin', templates_new_day_html__WEBPACK_IMPORTED_MODULE_1
3
___default()({
next_msg_el.insertAdjacentHTML('beforeBegin', templates_new_day_html__WEBPACK_IMPORTED_MODULE_1
4
___default()({
'isodate': day_date.format(),
'isodate': day_date.format(),
'datestring': day_date.format("dddd MMM Do YYYY")
'datestring': day_date.format("dddd MMM Do YYYY")
}));
}));
...
@@ -59287,14 +59297,14 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
...
@@ -59287,14 +59297,14 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
* (Object) cutoff: Moment Date cutoff date. The last
* (Object) cutoff: Moment Date cutoff date. The last
* message received cutoff this date will be returned.
* message received cutoff this date will be returned.
*/
*/
const first_msg = utils_emoji__WEBPACK_IMPORTED_MODULE_2
0
__["default"].getFirstChildElement(this.content, '.message:not(.chat-state-notification)'),
const first_msg = utils_emoji__WEBPACK_IMPORTED_MODULE_2
1
__["default"].getFirstChildElement(this.content, '.message:not(.chat-state-notification)'),
oldest_date = first_msg ? first_msg.getAttribute('data-isodate') : null;
oldest_date = first_msg ? first_msg.getAttribute('data-isodate') : null;
if (!_.isNull(oldest_date) && moment(oldest_date).isAfter(cutoff)) {
if (!_.isNull(oldest_date) && moment(oldest_date).isAfter(cutoff)) {
return null;
return null;
}
}
const last_msg = utils_emoji__WEBPACK_IMPORTED_MODULE_2
0
__["default"].getLastChildElement(this.content, '.message:not(.chat-state-notification)'),
const last_msg = utils_emoji__WEBPACK_IMPORTED_MODULE_2
1
__["default"].getLastChildElement(this.content, '.message:not(.chat-state-notification)'),
most_recent_date = last_msg ? last_msg.getAttribute('data-isodate') : null;
most_recent_date = last_msg ? last_msg.getAttribute('data-isodate') : null;
if (_.isNull(most_recent_date) || moment(most_recent_date).isBefore(cutoff)) {
if (_.isNull(most_recent_date) || moment(most_recent_date).isBefore(cutoff)) {
...
@@ -59331,7 +59341,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
...
@@ -59331,7 +59341,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
* up when using infinite scroll).
* up when using infinite scroll).
*/
*/
if (this.model.get('scrolled')) {
if (this.model.get('scrolled')) {
const next_msg_el = utils_emoji__WEBPACK_IMPORTED_MODULE_2
0
__["default"].getNextElement(message_el, ".chat-msg");
const next_msg_el = utils_emoji__WEBPACK_IMPORTED_MODULE_2
1
__["default"].getNextElement(message_el, ".chat-msg");
if (next_msg_el) {
if (next_msg_el) {
// The currently received message is not new, there
// The currently received message is not new, there
...
@@ -59350,10 +59360,10 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
...
@@ -59350,10 +59360,10 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
showHelpMessages(msgs, type, spinner) {
showHelpMessages(msgs, type, spinner) {
_.each(msgs, msg => {
_.each(msgs, msg => {
this.content.insertAdjacentHTML('beforeend', templates_help_message_html__WEBPACK_IMPORTED_MODULE_1
1
___default()({
this.content.insertAdjacentHTML('beforeend', templates_help_message_html__WEBPACK_IMPORTED_MODULE_1
2
___default()({
'isodate': moment().format(),
'isodate': moment().format(),
'type': type,
'type': type,
'message': xss__WEBPACK_IMPORTED_MODULE_2
1
___default.a.filterXSS(msg, {
'message': xss__WEBPACK_IMPORTED_MODULE_2
2
___default.a.filterXSS(msg, {
'whiteList': {
'whiteList': {
'strong': []
'strong': []
}
}
...
@@ -59372,14 +59382,14 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
...
@@ -59372,14 +59382,14 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
clearChatStateNotification(message, isodate) {
clearChatStateNotification(message, isodate) {
if (isodate) {
if (isodate) {
_.each(sizzle(`.chat-state-notification[data-csn="${message.get('from')}"][data-isodate="${isodate}"]`, this.content), utils_emoji__WEBPACK_IMPORTED_MODULE_2
0
__["default"].removeElement);
_.each(sizzle(`.chat-state-notification[data-csn="${message.get('from')}"][data-isodate="${isodate}"]`, this.content), utils_emoji__WEBPACK_IMPORTED_MODULE_2
1
__["default"].removeElement);
} else {
} else {
_.each(sizzle(`.chat-state-notification[data-csn="${message.get('from')}"]`, this.content), utils_emoji__WEBPACK_IMPORTED_MODULE_2
0
__["default"].removeElement);
_.each(sizzle(`.chat-state-notification[data-csn="${message.get('from')}"]`, this.content), utils_emoji__WEBPACK_IMPORTED_MODULE_2
1
__["default"].removeElement);
}
}
},
},
shouldShowOnTextMessage() {
shouldShowOnTextMessage() {
return !utils_emoji__WEBPACK_IMPORTED_MODULE_2
0
__["default"].isVisible(this.el);
return !utils_emoji__WEBPACK_IMPORTED_MODULE_2
1
__["default"].isVisible(this.el);
},
},
insertMessage(view) {
insertMessage(view) {
...
@@ -59406,7 +59416,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
...
@@ -59406,7 +59416,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
} else {
} else {
const previous_msg_el = sizzle(`[data-isodate="${previous_msg_date}"]:last`, this.content).pop();
const previous_msg_el = sizzle(`[data-isodate="${previous_msg_date}"]:last`, this.content).pop();
if (view.model.get('type') === 'error' && utils_emoji__WEBPACK_IMPORTED_MODULE_2
0
__["default"].hasClass('chat-error', previous_msg_el) && previous_msg_el.textContent === view.model.get('message')) {
if (view.model.get('type') === 'error' && utils_emoji__WEBPACK_IMPORTED_MODULE_2
1
__["default"].hasClass('chat-error', previous_msg_el) && previous_msg_el.textContent === view.model.get('message')) {
// We don't show a duplicate error message
// We don't show a duplicate error message
return;
return;
}
}
...
@@ -59437,18 +59447,18 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
...
@@ -59437,18 +59447,18 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
date = moment(el.getAttribute('data-isodate')),
date = moment(el.getAttribute('data-isodate')),
next_el = el.nextElementSibling;
next_el = el.nextElementSibling;
if (!utils_emoji__WEBPACK_IMPORTED_MODULE_2
0__["default"].hasClass('chat-msg--action', el) && !utils_emoji__WEBPACK_IMPORTED_MODULE_20
__["default"].hasClass('chat-msg--action', previous_el) && previous_el.getAttribute('data-from') === from && date.isBefore(moment(previous_el.getAttribute('data-isodate')).add(10, 'minutes')) && el.getAttribute('data-encrypted') === previous_el.getAttribute('data-encrypted')) {
if (!utils_emoji__WEBPACK_IMPORTED_MODULE_2
1__["default"].hasClass('chat-msg--action', el) && !utils_emoji__WEBPACK_IMPORTED_MODULE_21
__["default"].hasClass('chat-msg--action', previous_el) && previous_el.getAttribute('data-from') === from && date.isBefore(moment(previous_el.getAttribute('data-isodate')).add(10, 'minutes')) && el.getAttribute('data-encrypted') === previous_el.getAttribute('data-encrypted')) {
utils_emoji__WEBPACK_IMPORTED_MODULE_2
0
__["default"].addClass('chat-msg--followup', el);
utils_emoji__WEBPACK_IMPORTED_MODULE_2
1
__["default"].addClass('chat-msg--followup', el);
}
}
if (!next_el) {
if (!next_el) {
return;
return;
}
}
if (!utils_emoji__WEBPACK_IMPORTED_MODULE_2
0
__["default"].hasClass('chat-msg--action', 'el') && next_el.getAttribute('data-from') === from && moment(next_el.getAttribute('data-isodate')).isBefore(date.add(10, 'minutes')) && el.getAttribute('data-encrypted') === next_el.getAttribute('data-encrypted')) {
if (!utils_emoji__WEBPACK_IMPORTED_MODULE_2
1
__["default"].hasClass('chat-msg--action', 'el') && next_el.getAttribute('data-from') === from && moment(next_el.getAttribute('data-isodate')).isBefore(date.add(10, 'minutes')) && el.getAttribute('data-encrypted') === next_el.getAttribute('data-encrypted')) {
utils_emoji__WEBPACK_IMPORTED_MODULE_2
0
__["default"].addClass('chat-msg--followup', next_el);
utils_emoji__WEBPACK_IMPORTED_MODULE_2
1
__["default"].addClass('chat-msg--followup', next_el);
} else {
} else {
utils_emoji__WEBPACK_IMPORTED_MODULE_2
0
__["default"].removeClass('chat-msg--followup', next_el);
utils_emoji__WEBPACK_IMPORTED_MODULE_2
1
__["default"].removeClass('chat-msg--followup', next_el);
}
}
},
},
...
@@ -59477,14 +59487,14 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
...
@@ -59477,14 +59487,14 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
this.insertDayIndicator(view.el);
this.insertDayIndicator(view.el);
this.setScrollPosition(view.el);
this.setScrollPosition(view.el);
if (utils_emoji__WEBPACK_IMPORTED_MODULE_2
0
__["default"].isNewMessage(message)) {
if (utils_emoji__WEBPACK_IMPORTED_MODULE_2
1
__["default"].isNewMessage(message)) {
if (message.get('sender') === 'me') {
if (message.get('sender') === 'me') {
// We remove the "scrolled" flag so that the chat area
// We remove the "scrolled" flag so that the chat area
// gets scrolled down. We always want to scroll down
// gets scrolled down. We always want to scroll down
// when the user writes a message as opposed to when a
// when the user writes a message as opposed to when a
// message is received.
// message is received.
this.model.set('scrolled', false);
this.model.set('scrolled', false);
} else if (this.model.get('scrolled', true) && !utils_emoji__WEBPACK_IMPORTED_MODULE_2
0
__["default"].isOnlyChatStateNotification(message)) {
} else if (this.model.get('scrolled', true) && !utils_emoji__WEBPACK_IMPORTED_MODULE_2
1
__["default"].isOnlyChatStateNotification(message)) {
this.showNewMessagesIndicator();
this.showNewMessagesIndicator();
}
}
}
}
...
@@ -59594,7 +59604,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
...
@@ -59594,7 +59604,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
}
}
textarea.value = '';
textarea.value = '';
utils_emoji__WEBPACK_IMPORTED_MODULE_2
0
__["default"].removeClass('correcting', textarea);
utils_emoji__WEBPACK_IMPORTED_MODULE_2
1
__["default"].removeClass('correcting', textarea);
textarea.focus(); // Trigger input event, so that the textarea resizes
textarea.focus(); // Trigger input event, so that the textarea resizes
const event = document.createEvent('Event');
const event = document.createEvent('Event');
...
@@ -59626,7 +59636,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
...
@@ -59626,7 +59636,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
} else if (ev.keyCode === _converse.keycodes.ESCAPE) {
} else if (ev.keyCode === _converse.keycodes.ESCAPE) {
return this.onEscapePressed(ev);
return this.onEscapePressed(ev);
} else if (ev.keyCode === _converse.keycodes.ENTER) {
} else if (ev.keyCode === _converse.keycodes.ENTER) {
if (this.emoji_dropdown && utils_emoji__WEBPACK_IMPORTED_MODULE_2
0
__["default"].isVisible(this.emoji_dropdown.el.querySelector('.emoji-picker'))) {
if (this.emoji_dropdown && utils_emoji__WEBPACK_IMPORTED_MODULE_2
1
__["default"].isVisible(this.emoji_dropdown.el.querySelector('.emoji-picker'))) {
this.emoji_dropdown.toggle();
this.emoji_dropdown.toggle();
}
}
...
@@ -59671,7 +59681,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
...
@@ -59671,7 +59681,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
ev.preventDefault();
ev.preventDefault();
const idx = this.model.messages.findLastIndex('correcting'),
const idx = this.model.messages.findLastIndex('correcting'),
currently_correcting = idx >= 0 ? this.model.messages.at(idx) : null,
currently_correcting = idx >= 0 ? this.model.messages.at(idx) : null,
message_el = utils_emoji__WEBPACK_IMPORTED_MODULE_2
0
__["default"].ancestor(ev.target, '.chat-msg'),
message_el = utils_emoji__WEBPACK_IMPORTED_MODULE_2
1
__["default"].ancestor(ev.target, '.chat-msg'),
message = this.model.messages.findWhere({
message = this.model.messages.findWhere({
'msgid': message_el.getAttribute('data-msgid')
'msgid': message_el.getAttribute('data-msgid')
});
});
...
@@ -59682,7 +59692,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
...
@@ -59682,7 +59692,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
}
}
message.save('correcting', true);
message.save('correcting', true);
this.insertIntoTextArea(utils_emoji__WEBPACK_IMPORTED_MODULE_2
0
__["default"].prefixMentions(message), true, true);
this.insertIntoTextArea(utils_emoji__WEBPACK_IMPORTED_MODULE_2
1
__["default"].prefixMentions(message), true, true);
} else {
} else {
message.save('correcting', false);
message.save('correcting', false);
this.insertIntoTextArea('', true, false);
this.insertIntoTextArea('', true, false);
...
@@ -59768,9 +59778,9 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
...
@@ -59768,9 +59778,9 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
const textarea = this.el.querySelector('.chat-textarea');
const textarea = this.el.querySelector('.chat-textarea');
if (correcting) {
if (correcting) {
utils_emoji__WEBPACK_IMPORTED_MODULE_2
0
__["default"].addClass('correcting', textarea);
utils_emoji__WEBPACK_IMPORTED_MODULE_2
1
__["default"].addClass('correcting', textarea);
} else {
} else {
utils_emoji__WEBPACK_IMPORTED_MODULE_2
0
__["default"].removeClass('correcting', textarea);
utils_emoji__WEBPACK_IMPORTED_MODULE_2
1
__["default"].removeClass('correcting', textarea);
}
}
if (replace) {
if (replace) {
...
@@ -59787,7 +59797,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
...
@@ -59787,7 +59797,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
textarea.value = existing + value + ' ';
textarea.value = existing + value + ' ';
}
}
utils_emoji__WEBPACK_IMPORTED_MODULE_2
0
__["default"].putCurserAtEnd(textarea);
utils_emoji__WEBPACK_IMPORTED_MODULE_2
1
__["default"].putCurserAtEnd(textarea);
},
},
createEmojiPicker() {
createEmojiPicker() {
...
@@ -59850,7 +59860,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
...
@@ -59850,7 +59860,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
const toggle_el = ev.target,
const toggle_el = ev.target,
icon_el = toggle_el.firstElementChild;
icon_el = toggle_el.firstElementChild;
utils_emoji__WEBPACK_IMPORTED_MODULE_2
0
__["default"].slideToggleElement(toggle_el.parentElement.parentElement.querySelector('.spoiler'));
utils_emoji__WEBPACK_IMPORTED_MODULE_2
1
__["default"].slideToggleElement(toggle_el.parentElement.parentElement.querySelector('.spoiler'));
if (toggle_el.getAttribute("data-toggle-state") == "closed") {
if (toggle_el.getAttribute("data-toggle-state") == "closed") {
toggle_el.textContent = 'Show less';
toggle_el.textContent = 'Show less';
...
@@ -59872,7 +59882,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
...
@@ -59872,7 +59882,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
fullname = this.model.getDisplayName();
fullname = this.model.getDisplayName();
let text;
let text;
if (utils_emoji__WEBPACK_IMPORTED_MODULE_2
0
__["default"].isVisible(this.el)) {
if (utils_emoji__WEBPACK_IMPORTED_MODULE_2
1
__["default"].isVisible(this.el)) {
if (show === 'offline') {
if (show === 'offline') {
text = __('%1$s has gone offline', fullname);
text = __('%1$s has gone offline', fullname);
} else if (show === 'away') {
} else if (show === 'away') {
...
@@ -59884,7 +59894,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
...
@@ -59884,7 +59894,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
}
}
if (text) {
if (text) {
this.content.insertAdjacentHTML('beforeend', templates_status_message_html__WEBPACK_IMPORTED_MODULE_1
6
___default()({
this.content.insertAdjacentHTML('beforeend', templates_status_message_html__WEBPACK_IMPORTED_MODULE_1
7
___default()({
'message': text,
'message': text,
'isodate': moment().format()
'isodate': moment().format()
}));
}));
...
@@ -59961,16 +59971,16 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
...
@@ -59961,16 +59971,16 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
_show(f) {
_show(f) {
/* Inner show method that gets debounced */
/* Inner show method that gets debounced */
if (utils_emoji__WEBPACK_IMPORTED_MODULE_2
0
__["default"].isVisible(this.el)) {
if (utils_emoji__WEBPACK_IMPORTED_MODULE_2
1
__["default"].isVisible(this.el)) {
this.focus();
this.focus();
return;
return;
}
}
utils_emoji__WEBPACK_IMPORTED_MODULE_2
0
__["default"].fadeIn(this.el, _.bind(this.afterShown, this));
utils_emoji__WEBPACK_IMPORTED_MODULE_2
1
__["default"].fadeIn(this.el, _.bind(this.afterShown, this));
},
},
showNewMessagesIndicator() {
showNewMessagesIndicator() {
utils_emoji__WEBPACK_IMPORTED_MODULE_2
0
__["default"].showElement(this.el.querySelector('.new-msgs-indicator'));
utils_emoji__WEBPACK_IMPORTED_MODULE_2
1
__["default"].showElement(this.el.querySelector('.new-msgs-indicator'));
},
},
hideNewMessagesIndicator() {
hideNewMessagesIndicator() {
...
@@ -60000,7 +60010,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
...
@@ -60000,7 +60010,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
this.onScrolledDown();
this.onScrolledDown();
}
}
utils_emoji__WEBPACK_IMPORTED_MODULE_2
0
__["default"].safeSave(this.model, {
utils_emoji__WEBPACK_IMPORTED_MODULE_2
1
__["default"].safeSave(this.model, {
'scrolled': scrolled,
'scrolled': scrolled,
'top_visible_message': null
'top_visible_message': null
});
});
...
@@ -60020,7 +60030,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
...
@@ -60020,7 +60030,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
return;
return;
}
}
if (utils_emoji__WEBPACK_IMPORTED_MODULE_2
0
__["default"].isVisible(this.content) && !this.model.get('scrolled')) {
if (utils_emoji__WEBPACK_IMPORTED_MODULE_2
1
__["default"].isVisible(this.content) && !this.model.get('scrolled')) {
this.content.scrollTop = this.content.scrollHeight;
this.content.scrollTop = this.content.scrollHeight;
}
}
},
},
...
@@ -62102,7 +62112,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_1__["default"].plugins
...
@@ -62102,7 +62112,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_1__["default"].plugins
!view.model.get('minimized') && !view.model.get('closed') && u.isVisible(view.el));
!view.model.get('minimized') && !view.model.get('closed') && u.isVisible(view.el));
},
},
trimChats(newchat) {
async
trimChats(newchat) {
/* This method is called when a newly created chat box will
/* This method is called when a newly created chat box will
* be shown.
* be shown.
*
*
...
@@ -62125,7 +62135,8 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_1__["default"].plugins
...
@@ -62125,7 +62135,8 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_1__["default"].plugins
return;
return;
}
}
_converse.api.waitUntil('minimizedChatsInitialized').then(() => {
await _converse.api.waitUntil('minimizedChatsInitialized');
const minimized_el = _.get(_converse.minimized_chats, 'el'),
const minimized_el = _.get(_converse.minimized_chats, 'el'),
new_id = newchat ? newchat.model.get('id') : null;
new_id = newchat ? newchat.model.get('id') : null;
...
@@ -62152,7 +62163,6 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_1__["default"].plugins
...
@@ -62152,7 +62163,6 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_1__["default"].plugins
}
}
}
}
}
}
}).catch(_.partial(_converse.log, _, Strophe.LogLevel.FATAL));
},
},
getOldestMaximizedChat(exclude_ids) {
getOldestMaximizedChat(exclude_ids) {
...
@@ -63874,7 +63884,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_3__["default"].plugins
...
@@ -63874,7 +63884,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_3__["default"].plugins
* the settings.
* the settings.
*/
*/
this.showSpinner();
this.showSpinner();
this.model.fetchRoomConfiguration().then(
this.renderConfigurationForm.bind(this
)).catch(_.partial(_converse.log, _, Strophe.LogLevel.ERROR));
this.model.fetchRoomConfiguration().then(
iq => this.renderConfigurationForm(iq
)).catch(_.partial(_converse.log, _, Strophe.LogLevel.ERROR));
},
},
submitNickname(ev) {
submitNickname(ev) {
...
@@ -66411,16 +66421,14 @@ __webpack_require__.r(__webpack_exports__);
...
@@ -66411,16 +66421,14 @@ __webpack_require__.r(__webpack_exports__);
/* harmony import */ var bootstrap__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! bootstrap */ "./node_modules/bootstrap.native/dist/bootstrap-native-v4.js");
/* harmony import */ var bootstrap__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! bootstrap */ "./node_modules/bootstrap.native/dist/bootstrap-native-v4.js");
/* harmony import */ var bootstrap__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(bootstrap__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var bootstrap__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(bootstrap__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @converse/headless/converse-core */ "./src/headless/converse-core.js");
/* harmony import */ var _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @converse/headless/converse-core */ "./src/headless/converse-core.js");
/* harmony import */ var templates_alert_html__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! templates/alert.html */ "./src/templates/alert.html");
/* harmony import */ var templates_chat_status_modal_html__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! templates/chat_status_modal.html */ "./src/templates/chat_status_modal.html");
/* harmony import */ var templates_alert_html__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(templates_alert_html__WEBPACK_IMPORTED_MODULE_5__);
/* harmony import */ var templates_chat_status_modal_html__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(templates_chat_status_modal_html__WEBPACK_IMPORTED_MODULE_5__);
/* harmony import */ var templates_chat_status_modal_html__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! templates/chat_status_modal.html */ "./src/templates/chat_status_modal.html");
/* harmony import */ var templates_profile_modal_html__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! templates/profile_modal.html */ "./src/templates/profile_modal.html");
/* harmony import */ var templates_chat_status_modal_html__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(templates_chat_status_modal_html__WEBPACK_IMPORTED_MODULE_6__);
/* harmony import */ var templates_profile_modal_html__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(templates_profile_modal_html__WEBPACK_IMPORTED_MODULE_6__);
/* harmony import */ var templates_profile_modal_html__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! templates/profile_modal.html */ "./src/templates/profile_modal.html");
/* harmony import */ var templates_profile_view_html__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! templates/profile_view.html */ "./src/templates/profile_view.html");
/* harmony import */ var templates_profile_modal_html__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(templates_profile_modal_html__WEBPACK_IMPORTED_MODULE_7__);
/* harmony import */ var templates_profile_view_html__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(templates_profile_view_html__WEBPACK_IMPORTED_MODULE_7__);
/* harmony import */ var templates_profile_view_html__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! templates/profile_view.html */ "./src/templates/profile_view.html");
/* harmony import */ var templates_status_option_html__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! templates/status_option.html */ "./src/templates/status_option.html");
/* harmony import */ var templates_profile_view_html__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(templates_profile_view_html__WEBPACK_IMPORTED_MODULE_8__);
/* harmony import */ var templates_status_option_html__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(templates_status_option_html__WEBPACK_IMPORTED_MODULE_8__);
/* harmony import */ var templates_status_option_html__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! templates/status_option.html */ "./src/templates/status_option.html");
/* harmony import */ var templates_status_option_html__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(templates_status_option_html__WEBPACK_IMPORTED_MODULE_9__);
// Converse.js (A browser based XMPP chat client)
// Converse.js (A browser based XMPP chat client)
// http://conversejs.org
// http://conversejs.org
//
//
...
@@ -66438,7 +66446,6 @@ __webpack_require__.r(__webpack_exports__);
...
@@ -66438,7 +66446,6 @@ __webpack_require__.r(__webpack_exports__);
const _converse$env = _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_4__["default"].env,
const _converse$env = _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_4__["default"].env,
Strophe = _converse$env.Strophe,
Strophe = _converse$env.Strophe,
Backbone = _converse$env.Backbone,
Backbone = _converse$env.Backbone,
...
@@ -66472,7 +66479,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_4__["default"].plugins
...
@@ -66472,7 +66479,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_4__["default"].plugins
},
},
toHTML() {
toHTML() {
return templates_profile_modal_html__WEBPACK_IMPORTED_MODULE_
7
___default()(_.extend(this.model.toJSON(), this.model.vcard.toJSON(), {
return templates_profile_modal_html__WEBPACK_IMPORTED_MODULE_
6
___default()(_.extend(this.model.toJSON(), this.model.vcard.toJSON(), {
'_': _,
'_': _,
'__': __,
'__': __,
'_converse': _converse,
'_converse': _converse,
...
@@ -66563,7 +66570,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_4__["default"].plugins
...
@@ -66563,7 +66570,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_4__["default"].plugins
},
},
toHTML() {
toHTML() {
return templates_chat_status_modal_html__WEBPACK_IMPORTED_MODULE_
6
___default()(_.extend(this.model.toJSON(), this.model.vcard.toJSON(), {
return templates_chat_status_modal_html__WEBPACK_IMPORTED_MODULE_
5
___default()(_.extend(this.model.toJSON(), this.model.vcard.toJSON(), {
'label_away': __('Away'),
'label_away': __('Away'),
'label_close': __('Close'),
'label_close': __('Close'),
'label_busy': __('Busy'),
'label_busy': __('Busy'),
...
@@ -66620,7 +66627,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_4__["default"].plugins
...
@@ -66620,7 +66627,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_4__["default"].plugins
toHTML() {
toHTML() {
const chat_status = this.model.get('status') || 'offline';
const chat_status = this.model.get('status') || 'offline';
return templates_profile_view_html__WEBPACK_IMPORTED_MODULE_
8
___default()(_.extend(this.model.toJSON(), this.model.vcard.toJSON(), {
return templates_profile_view_html__WEBPACK_IMPORTED_MODULE_
7
___default()(_.extend(this.model.toJSON(), this.model.vcard.toJSON(), {
'__': __,
'__': __,
'fullname': this.model.vcard.get('fullname') || _converse.bare_jid,
'fullname': this.model.vcard.get('fullname') || _converse.bare_jid,
'status_message': this.model.get('status_message') || __("I am %1$s", this.getPrettyStatus(chat_status)),
'status_message': this.model.get('status_message') || __("I am %1$s", this.getPrettyStatus(chat_status)),
...
@@ -68743,7 +68750,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
...
@@ -68743,7 +68750,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
this.filterOutContacts(this.getFilterMatches(q, type));
this.filterOutContacts(this.getFilterMatches(q, type));
},
},
toggle(ev) {
async
toggle(ev) {
if (ev && ev.preventDefault) {
if (ev && ev.preventDefault) {
ev.preventDefault();
ev.preventDefault();
}
}
...
@@ -68754,10 +68761,9 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
...
@@ -68754,10 +68761,9 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
this.model.save({
this.model.save({
state: _converse.CLOSED
state: _converse.CLOSED
});
});
this.collapse().then(() => {
await this.collapse();
icon_el.classList.remove("fa-caret-down");
icon_el.classList.remove("fa-caret-down");
icon_el.classList.add("fa-caret-right");
icon_el.classList.add("fa-caret-right");
});
} else {
} else {
icon_el.classList.remove("fa-caret-right");
icon_el.classList.remove("fa-caret-right");
icon_el.classList.add("fa-caret-down");
icon_el.classList.add("fa-caret-down");
...
@@ -70626,8 +70632,20 @@ _converse_core__WEBPACK_IMPORTED_MODULE_2__["default"].plugins.add('converse-cha
...
@@ -70626,8 +70632,20 @@ _converse_core__WEBPACK_IMPORTED_MODULE_2__["default"].plugins.add('converse-cha
return _converse.api.sendIQ(iq);
return _converse.api.sendIQ(iq);
},
},
getRequestSlotURL() {
async getRequestSlotURL() {
this.sendSlotRequestStanza().then(stanza => {
let stanza;
try {
stanza = await this.sendSlotRequestStanza();
} catch (e) {
_converse.log(e, Strophe.LogLevel.ERROR);
return this.save({
'type': 'error',
'message': __("Sorry, could not determine upload URL.")
});
}
const slot = stanza.querySelector('slot');
const slot = stanza.querySelector('slot');
if (slot) {
if (slot) {
...
@@ -70641,14 +70659,6 @@ _converse_core__WEBPACK_IMPORTED_MODULE_2__["default"].plugins.add('converse-cha
...
@@ -70641,14 +70659,6 @@ _converse_core__WEBPACK_IMPORTED_MODULE_2__["default"].plugins.add('converse-cha
'message': __("Sorry, could not determine file upload URL.")
'message': __("Sorry, could not determine file upload URL.")
});
});
}
}
}).catch(e => {
_converse.log(e, Strophe.LogLevel.ERROR);
return this.save({
'type': 'error',
'message': __("Sorry, could not determine upload URL.")
});
});
},
},
uploadFile() {
uploadFile() {
...
@@ -73569,7 +73579,7 @@ _converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins.add('converse-dis
...
@@ -73569,7 +73579,7 @@ _converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins.add('converse-dis
});
});
},
},
queryForItems() {
async
queryForItems() {
if (_.isEmpty(this.identities.where({
if (_.isEmpty(this.identities.where({
'category': 'server'
'category': 'server'
}))) {
}))) {
...
@@ -73578,7 +73588,8 @@ _converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins.add('converse-dis
...
@@ -73578,7 +73588,8 @@ _converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins.add('converse-dis
return;
return;
}
}
_converse.api.disco.items(this.get('jid')).then(stanza => this.onDiscoItems(stanza));
const stanza = await _converse.api.disco.items(this.get('jid'));
this.onDiscoItems(stanza);
},
},
onInfo(stanza) {
onInfo(stanza) {
...
@@ -73690,15 +73701,15 @@ _converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins.add('converse-dis
...
@@ -73690,15 +73701,15 @@ _converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins.add('converse-dis
_converse.emit('streamFeaturesAdded');
_converse.emit('streamFeaturesAdded');
}
}
function initializeDisco() {
async
function initializeDisco() {
addClientFeatures();
addClientFeatures();
_converse.connection.addHandler(onDiscoInfoRequest, Strophe.NS.DISCO_INFO, 'iq', 'get', null, null);
_converse.connection.addHandler(onDiscoInfoRequest, Strophe.NS.DISCO_INFO, 'iq', 'get', null, null);
_converse.disco_entities = new _converse.DiscoEntities();
_converse.disco_entities = new _converse.DiscoEntities();
_converse.disco_entities.browserStorage = new Backbone.BrowserStorage.session(b64_sha1(`converse.disco-entities-${_converse.bare_jid}`));
_converse.disco_entities.browserStorage = new Backbone.BrowserStorage.session(b64_sha1(`converse.disco-entities-${_converse.bare_jid}`));
const collection = await _converse.disco_entities.fetchEntities();
_converse.disco_entities.fetchEntities().then(collection => {
if (collection.length === 0 || !collection.get(_converse.domain)) {
if (collection.length === 0 || !collection.get(_converse.domain)) {
// If we don't have an entity for our own XMPP server,
// If we don't have an entity for our own XMPP server,
// create one.
// create one.
...
@@ -73708,7 +73719,6 @@ _converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins.add('converse-dis
...
@@ -73708,7 +73719,6 @@ _converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins.add('converse-dis
}
}
_converse.emit('discoInitialized');
_converse.emit('discoInitialized');
}).catch(_.partial(_converse.log, _, Strophe.LogLevel.FATAL));
}
}
_converse.api.listen.on('sessionInitialized', initStreamFeatures);
_converse.api.listen.on('sessionInitialized', initStreamFeatures);
...
@@ -73984,8 +73994,9 @@ _converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins.add('converse-dis
...
@@ -73984,8 +73994,9 @@ _converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins.add('converse-dis
* @param {boolean} [create] Whether the entity should be created if it doesn't exist.
* @param {boolean} [create] Whether the entity should be created if it doesn't exist.
* @example _converse.api.disco.entities.get(jid);
* @example _converse.api.disco.entities.get(jid);
*/
*/
'get'(jid, create = false) {
async 'get'(jid, create = false) {
return _converse.api.waitUntil('discoInitialized').then(() => {
await _converse.api.waitUntil('discoInitialized');
if (_.isNil(jid)) {
if (_.isNil(jid)) {
return _converse.disco_entities;
return _converse.disco_entities;
}
}
...
@@ -73999,7 +74010,6 @@ _converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins.add('converse-dis
...
@@ -73999,7 +74010,6 @@ _converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins.add('converse-dis
return _converse.disco_entities.create({
return _converse.disco_entities.create({
'jid': jid
'jid': jid
});
});
});
}
}
},
},
...
@@ -74035,16 +74045,19 @@ _converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins.add('converse-dis
...
@@ -74035,16 +74045,19 @@ _converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins.add('converse-dis
* );
* );
* });
* });
*/
*/
'supports'(feature, jid) {
async
'supports'(feature, jid) {
if (_.isNil(jid)) {
if (_.isNil(jid)) {
throw new TypeError('api.disco.supports: You need to provide an entity JID');
throw new TypeError('api.disco.supports: You need to provide an entity JID');
}
}
return _converse.api.waitUntil('discoInitialized').then(() => _converse.api.disco.entities.get(jid, true)).then(entity => entity.waitUntilFeaturesDiscovered).then(entity => {
await _converse.api.waitUntil('discoInitialized');
let entity = await _converse.api.disco.entities.get(jid, true);
entity = await entity.waitUntilFeaturesDiscovered;
const promises = _.concat(entity.items.map(item => item.hasFeature(feature)), entity.hasFeature(feature));
const promises = _.concat(entity.items.map(item => item.hasFeature(feature)), entity.hasFeature(feature));
return
Promise.all(promises);
const result = await
Promise.all(promises);
}).then(result => f.filter(f.isObject, result)
);
return f.filter(f.isObject, result
);
},
},
/**
/**
...
@@ -74057,19 +74070,19 @@ _converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins.add('converse-dis
...
@@ -74057,19 +74070,19 @@ _converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins.add('converse-dis
* @example
* @example
* await _converse.api.disco.refreshFeatures('room@conference.example.org');
* await _converse.api.disco.refreshFeatures('room@conference.example.org');
*/
*/
'refreshFeatures'(jid) {
async
'refreshFeatures'(jid) {
if (_.isNil(jid)) {
if (_.isNil(jid)) {
throw new TypeError('api.disco.refreshFeatures: You need to provide an entity JID');
throw new TypeError('api.disco.refreshFeatures: You need to provide an entity JID');
}
}
return _converse.api.waitUntil('discoInitialized').then(() => _converse.api.disco.entities.get(jid, true)).then(entity => {
await _converse.api.waitUntil('discoInitialized');
const entity = await _converse.api.disco.entities.get(jid, true);
entity.features.reset();
entity.features.reset();
entity.fields.reset();
entity.fields.reset();
entity.identities.reset();
entity.identities.reset();
entity.waitUntilFeaturesDiscovered = utils.getResolveablePromise();
entity.waitUntilFeaturesDiscovered = utils.getResolveablePromise();
entity.queryInfo();
entity.queryInfo();
return entity.waitUntilFeaturesDiscovered;
return entity.waitUntilFeaturesDiscovered;
}).catch(_.partial(_converse.log, _, Strophe.LogLevel.FATAL));
},
},
/**
/**
...
@@ -74081,12 +74094,15 @@ _converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins.add('converse-dis
...
@@ -74081,12 +74094,15 @@ _converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins.add('converse-dis
* @example
* @example
* const features = await _converse.api.disco.getFeatures('room@conference.example.org');
* const features = await _converse.api.disco.getFeatures('room@conference.example.org');
*/
*/
'getFeatures'(jid) {
async
'getFeatures'(jid) {
if (_.isNil(jid)) {
if (_.isNil(jid)) {
throw new TypeError('api.disco.getFeatures: You need to provide an entity JID');
throw new TypeError('api.disco.getFeatures: You need to provide an entity JID');
}
}
return _converse.api.waitUntil('discoInitialized').then(() => _converse.api.disco.entities.get(jid, true)).then(entity => entity.waitUntilFeaturesDiscovered).then(entity => entity.features).catch(_.partial(_converse.log, _, Strophe.LogLevel.FATAL));
await _converse.api.waitUntil('discoInitialized');
let entity = await _converse.api.disco.entities.get(jid, true);
entity = await entity.waitUntilFeaturesDiscovered;
return entity.features;
},
},
/**
/**
...
@@ -74100,12 +74116,15 @@ _converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins.add('converse-dis
...
@@ -74100,12 +74116,15 @@ _converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins.add('converse-dis
* @example
* @example
* const fields = await _converse.api.disco.getFields('room@conference.example.org');
* const fields = await _converse.api.disco.getFields('room@conference.example.org');
*/
*/
'getFields'(jid) {
async
'getFields'(jid) {
if (_.isNil(jid)) {
if (_.isNil(jid)) {
throw new TypeError('api.disco.getFields: You need to provide an entity JID');
throw new TypeError('api.disco.getFields: You need to provide an entity JID');
}
}
return _converse.api.waitUntil('discoInitialized').then(() => _converse.api.disco.entities.get(jid, true)).then(entity => entity.waitUntilFeaturesDiscovered).then(entity => entity.fields).catch(_.partial(_converse.log, _, Strophe.LogLevel.FATAL));
await _converse.api.waitUntil('discoInitialized');
let entity = await _converse.api.disco.entities.get(jid, true);
entity = await entity.waitUntilFeaturesDiscovered;
return entity.fields;
},
},
/**
/**
...
@@ -74139,8 +74158,9 @@ _converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins.add('converse-dis
...
@@ -74139,8 +74158,9 @@ _converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins.add('converse-dis
* }
* }
* ).catch(_.partial(_converse.log, _, Strophe.LogLevel.FATAL));
* ).catch(_.partial(_converse.log, _, Strophe.LogLevel.FATAL));
*/
*/
'getIdentity'(category, type, jid) {
async 'getIdentity'(category, type, jid) {
return _converse.api.disco.entities.get(jid, true).then(e => e.getIdentity(category, type));
const e = await _converse.api.disco.entities.get(jid, true);
return e.getIdentity(category, type);
}
}
}
}
...
@@ -74968,20 +74988,18 @@ _converse_core__WEBPACK_IMPORTED_MODULE_6__["default"].plugins.add('converse-muc
...
@@ -74968,20 +74988,18 @@ _converse_core__WEBPACK_IMPORTED_MODULE_6__["default"].plugins.add('converse-muc
_converse.api.promises.add(['roomsAutoJoined']);
_converse.api.promises.add(['roomsAutoJoined']);
function openRoom(jid) {
async
function openRoom(jid) {
if (!_utils_form__WEBPACK_IMPORTED_MODULE_7__["default"].isValidMUCJID(jid)) {
if (!_utils_form__WEBPACK_IMPORTED_MODULE_7__["default"].isValidMUCJID(jid)) {
return _converse.log(`Invalid JID "${jid}" provided in URL fragment`, Strophe.LogLevel.WARN);
return _converse.log(`Invalid JID "${jid}" provided in URL fragment`, Strophe.LogLevel.WARN);
}
}
const promises = [_converse.api.waitUntil('roomsAutoJoined')]
;
await _converse.api.waitUntil('roomsAutoJoined')
;
if (_converse.allow_bookmarks) {
if (_converse.allow_bookmarks) {
promises.push(_converse.api.waitUntil('bookmarksInitialized')
);
await _converse.api.waitUntil('bookmarksInitialized'
);
}
}
Promise.all(promises).then(() => {
_converse.api.rooms.open(jid);
_converse.api.rooms.open(jid);
});
}
}
_converse.router.route('converse/room?jid=:jid', openRoom);
_converse.router.route('converse/room?jid=:jid', openRoom);
...
@@ -75714,7 +75732,7 @@ _converse_core__WEBPACK_IMPORTED_MODULE_6__["default"].plugins.add('converse-muc
...
@@ -75714,7 +75732,7 @@ _converse_core__WEBPACK_IMPORTED_MODULE_6__["default"].plugins.add('converse-muc
}
}
},
},
checkForReservedNick() {
async
checkForReservedNick() {
/* Use service-discovery to ask the XMPP server whether
/* Use service-discovery to ask the XMPP server whether
* this user has a reserved nickname for this groupchat.
* this user has a reserved nickname for this groupchat.
* If so, we'll use that, otherwise we render the nickname form.
* If so, we'll use that, otherwise we render the nickname form.
...
@@ -75723,14 +75741,14 @@ _converse_core__WEBPACK_IMPORTED_MODULE_6__["default"].plugins.add('converse-muc
...
@@ -75723,14 +75741,14 @@ _converse_core__WEBPACK_IMPORTED_MODULE_6__["default"].plugins.add('converse-muc
* (Function) callback: Callback upon succesful IQ response
* (Function) callback: Callback upon succesful IQ response
* (Function) errback: Callback upon error IQ response
* (Function) errback: Callback upon error IQ response
*/
*/
return
_converse.api.sendIQ($iq({
const iq = await
_converse.api.sendIQ($iq({
'to': this.get('jid'),
'to': this.get('jid'),
'from': _converse.connection.jid,
'from': _converse.connection.jid,
'type': "get"
'type': "get"
}).c("query", {
}).c("query", {
'xmlns': Strophe.NS.DISCO_INFO,
'xmlns': Strophe.NS.DISCO_INFO,
'node': 'x-roomuser-item'
'node': 'x-roomuser-item'
}))
.then(iq => {
}))
;
const identity_el = iq.querySelector('query[node="x-roomuser-item"] identity'),
const identity_el = iq.querySelector('query[node="x-roomuser-item"] identity'),
nick = identity_el ? identity_el.getAttribute('name') : null;
nick = identity_el ? identity_el.getAttribute('name') : null;
this.save({
this.save({
...
@@ -75740,7 +75758,6 @@ _converse_core__WEBPACK_IMPORTED_MODULE_6__["default"].plugins.add('converse-muc
...
@@ -75740,7 +75758,6 @@ _converse_core__WEBPACK_IMPORTED_MODULE_6__["default"].plugins.add('converse-muc
'silent': true
'silent': true
});
});
return iq;
return iq;
});
},
},
async registerNickname() {
async registerNickname() {
...
@@ -75922,7 +75939,7 @@ _converse_core__WEBPACK_IMPORTED_MODULE_6__["default"].plugins.add('converse-muc
...
@@ -75922,7 +75939,7 @@ _converse_core__WEBPACK_IMPORTED_MODULE_6__["default"].plugins.add('converse-muc
}
}
},
},
onMessage(stanza) {
async
onMessage(stanza) {
/* Handler for all MUC messages sent to this groupchat.
/* Handler for all MUC messages sent to this groupchat.
*
*
* Parameters:
* Parameters:
...
@@ -75961,7 +75978,8 @@ _converse_core__WEBPACK_IMPORTED_MODULE_6__["default"].plugins.add('converse-muc
...
@@ -75961,7 +75978,8 @@ _converse_core__WEBPACK_IMPORTED_MODULE_6__["default"].plugins.add('converse-muc
});
});
}
}
this.createMessage(stanza, original_stanza).then(msg => this.incrementUnreadMsgCounter(msg)).catch(_.partial(_converse.log, _, Strophe.LogLevel.FATAL));
const msg = await this.createMessage(stanza, original_stanza);
this.incrementUnreadMsgCounter(msg);
}
}
if (sender !== this.get('nick')) {
if (sender !== this.get('nick')) {
...
@@ -76157,8 +76175,8 @@ _converse_core__WEBPACK_IMPORTED_MODULE_6__["default"].plugins.add('converse-muc
...
@@ -76157,8 +76175,8 @@ _converse_core__WEBPACK_IMPORTED_MODULE_6__["default"].plugins.add('converse-muc
}
}
},
},
fetchMembers() {
async
fetchMembers() {
this.chatroom.getJidsWithAffiliations(['member', 'owner', 'admin']).then(new_members => {
const new_members = await this.chatroom.getJidsWithAffiliations(['member', 'owner', 'admin']);
const new_jids = new_members.map(m => m.jid).filter(m => !_.isUndefined(m)),
const new_jids = new_members.map(m => m.jid).filter(m => !_.isUndefined(m)),
new_nicks = new_members.map(m => !m.jid && m.nick || undefined).filter(m => !_.isUndefined(m)),
new_nicks = new_members.map(m => !m.jid && m.nick || undefined).filter(m => !_.isUndefined(m)),
removed_members = this.filter(m => {
removed_members = this.filter(m => {
...
@@ -76194,7 +76212,6 @@ _converse_core__WEBPACK_IMPORTED_MODULE_6__["default"].plugins.add('converse-muc
...
@@ -76194,7 +76212,6 @@ _converse_core__WEBPACK_IMPORTED_MODULE_6__["default"].plugins.add('converse-muc
this.create(attrs);
this.create(attrs);
}
}
});
});
}).catch(_.partial(_converse.log, _, Strophe.LogLevel.ERROR));
},
},
findOccupant(data) {
findOccupant(data) {
...
@@ -78704,15 +78721,6 @@ u.replaceCurrentWord = function (input, new_value) {
...
@@ -78704,15 +78721,6 @@ u.replaceCurrentWord = function (input, new_value) {
input.selectionEnd = cursor - current_word.length + new_value.length + 1;
input.selectionEnd = cursor - current_word.length + new_value.length + 1;
};
};
u.isVisible = function (el) {
if (u.hasClass('hidden', el)) {
return false;
} // XXX: Taken from jQuery's "visible" implementation
return el.offsetWidth > 0 || el.offsetHeight > 0 || el.getClientRects().length > 0;
};
u.triggerEvent = function (el, name, type = "Event", bubbles = true, cancelable = true) {
u.triggerEvent = function (el, name, type = "Event", bubbles = true, cancelable = true) {
const evt = document.createEvent(type);
const evt = document.createEvent(type);
evt.initEvent(name, bubbles, cancelable);
evt.initEvent(name, bubbles, cancelable);
...
@@ -100598,9 +100606,9 @@ module.exports = function(o) {
...
@@ -100598,9 +100606,9 @@ module.exports = function(o) {
var __t, __p = '', __e = _.escape;
var __t, __p = '', __e = _.escape;
__p += '<!-- src/templates/alert.html -->\n<div class="alert ' +
__p += '<!-- src/templates/alert.html -->\n<div class="alert ' +
__e(o.type) +
__e(o.type) +
'" role="alert">' +
'" role="alert">
<p>
' +
__e(o.message) +
__e(o.message) +
'</div>\n';
'</
p></
div>\n';
return __p
return __p
};
};
...
@@ -104276,6 +104284,15 @@ function afterAnimationEnds(el, callback) {
...
@@ -104276,6 +104284,15 @@ function afterAnimationEnds(el, callback) {
}
}
}
}
_headless_utils_core__WEBPACK_IMPORTED_MODULE_16__["default"].isVisible = function (el) {
if (_headless_utils_core__WEBPACK_IMPORTED_MODULE_16__["default"].hasClass('hidden', el)) {
return false;
} // XXX: Taken from jQuery's "visible" implementation
return el.offsetWidth > 0 || el.offsetHeight > 0 || el.getClientRects().length > 0;
};
_headless_utils_core__WEBPACK_IMPORTED_MODULE_16__["default"].fadeIn = function (el, callback) {
_headless_utils_core__WEBPACK_IMPORTED_MODULE_16__["default"].fadeIn = function (el, callback) {
if (_headless_lodash_noconflict__WEBPACK_IMPORTED_MODULE_1___default.a.isNil(el)) {
if (_headless_lodash_noconflict__WEBPACK_IMPORTED_MODULE_1___default.a.isNil(el)) {
logger.warn("Undefined or null element passed into fadeIn");
logger.warn("Undefined or null element passed into fadeIn");
sass/_chatbox.scss
View file @
37f43989
...
@@ -527,7 +527,7 @@
...
@@ -527,7 +527,7 @@
height
:
$overlayed-emoji-picker-height
;
height
:
$overlayed-emoji-picker-height
;
}
}
.chatbox
{
.chatbox
{
form
.sendXMPPMessage
{
.sendXMPPMessage
{
.chat-toolbar
{
.chat-toolbar
{
li
{
li
{
.toolbar-menu
{
.toolbar-menu
{
...
@@ -541,6 +541,16 @@
...
@@ -541,6 +541,16 @@
}
}
}
}
}
}
&
.toggle-smiley
{
.emoji-toolbar
{
.emoji-category-picker
{
ul
{
flex-wrap
:
wrap
;
justify-content
:
flex-start
;
}
}
}
}
}
}
}
}
}
}
...
...
spec/bookmarks.js
View file @
37f43989
...
@@ -9,10 +9,11 @@
...
@@ -9,10 +9,11 @@
],
factory
);
],
factory
);
}
(
this
,
function
(
jasmine
,
$
,
mock
,
test_utils
)
{
}
(
this
,
function
(
jasmine
,
$
,
mock
,
test_utils
)
{
"
use strict
"
;
"
use strict
"
;
var
$iq
=
converse
.
env
.
$iq
,
const
$iq
=
converse
.
env
.
$iq
,
$msg
=
converse
.
env
.
$msg
,
$msg
=
converse
.
env
.
$msg
,
Backbone
=
converse
.
env
.
Backbone
,
Backbone
=
converse
.
env
.
Backbone
,
Strophe
=
converse
.
env
.
Strophe
,
Strophe
=
converse
.
env
.
Strophe
,
sizzle
=
converse
.
env
.
sizzle
,
_
=
converse
.
env
.
_
,
_
=
converse
.
env
.
_
,
u
=
converse
.
env
.
utils
;
u
=
converse
.
env
.
utils
;
...
@@ -369,15 +370,16 @@
...
@@ -369,15 +370,16 @@
});
});
}));
}));
it
(
"
can be retrieved from the XMPP server
"
,
mock
.
initConverseWithPromises
(
it
(
"
can be retrieved from the XMPP server
"
,
mock
.
initConverseWithPromises
(
[
'
send
'
],
[
'
chatBoxesFetched
'
,
'
roomsPanelRendered
'
,
'
rosterGroupsFetched
'
],
{},
[
'
send
'
],
[
'
chatBoxesFetched
'
,
'
roomsPanelRendered
'
,
'
rosterGroupsFetched
'
],
{},
function
(
done
,
_converse
)
{
async
function
(
done
,
_converse
)
{
test_utils
.
waitUntilDiscoConfirmed
(
await
test_utils
.
waitUntilDiscoConfirmed
(
_converse
,
_converse
.
bare_jid
,
_converse
,
_converse
.
bare_jid
,
[{
'
category
'
:
'
pubsub
'
,
'
type
'
:
'
pep
'
}],
[{
'
category
'
:
'
pubsub
'
,
'
type
'
:
'
pep
'
}],
[
'
http://jabber.org/protocol/pubsub#publish-options
'
]
[
'
http://jabber.org/protocol/pubsub#publish-options
'
]
)
.
then
(
function
()
{
)
;
/* Client requests all items
/* Client requests all items
* -------------------------
* -------------------------
*
*
...
@@ -387,26 +389,29 @@
...
@@ -387,26 +389,29 @@
* </pubsub>
* </pubsub>
* </iq>
* </iq>
*/
*/
var
IQ_id
;
let
IQ_id
;
expect
(
_
.
filter
(
_converse
.
connection
.
send
.
calls
.
all
(),
function
(
call
)
{
const
call
=
await
test_utils
.
waitUntil
(()
=>
var
stanza
=
call
.
args
[
0
];
_
.
filter
(
_converse
.
connection
.
send
.
calls
.
all
(),
call
=>
{
const
stanza
=
call
.
args
[
0
];
if
(
!
(
stanza
instanceof
Element
)
||
stanza
.
nodeName
!==
'
iq
'
)
{
if
(
!
(
stanza
instanceof
Element
)
||
stanza
.
nodeName
!==
'
iq
'
)
{
return
;
return
;
}
}
// XXX: Wrapping in a div is a workaround for PhantomJS
if
(
sizzle
(
'
items[node="storage:bookmarks"]
'
,
stanza
).
length
)
{
var
div
=
document
.
createElement
(
'
div
'
);
div
.
appendChild
(
stanza
);
if
(
div
.
innerHTML
===
'
<iq from="dummy@localhost/resource" type="get"
'
+
'
xmlns="jabber:client" id="
'
+
stanza
.
getAttribute
(
'
id
'
)
+
'
">
'
+
'
<pubsub xmlns="http://jabber.org/protocol/pubsub">
'
+
'
<items node="storage:bookmarks"></items>
'
+
'
</pubsub>
'
+
'
</iq>
'
)
{
IQ_id
=
stanza
.
getAttribute
(
'
id
'
);
IQ_id
=
stanza
.
getAttribute
(
'
id
'
);
return
true
;
return
true
;
}
}
}).
length
).
toBe
(
1
);
}
).
pop
()
);
expect
(
Strophe
.
serialize
(
call
.
args
[
0
])).
toBe
(
`<iq from="dummy@localhost/resource" id="
${
IQ_id
}
" type="get" xmlns="jabber:client">`
+
'
<pubsub xmlns="http://jabber.org/protocol/pubsub">
'
+
'
<items node="storage:bookmarks"/>
'
+
'
</pubsub>
'
+
'
</iq>
'
);
/*
/*
* Server returns all items
* Server returns all items
...
@@ -448,49 +453,51 @@
...
@@ -448,49 +453,51 @@
'
jid
'
:
'
another@conference.shakespeare.lit
'
'
jid
'
:
'
another@conference.shakespeare.lit
'
});
// Purposefully exclude the <nick> element to test #1043
});
// Purposefully exclude the <nick> element to test #1043
_converse
.
connection
.
_dataRecv
(
test_utils
.
createRequest
(
stanza
));
_converse
.
connection
.
_dataRecv
(
test_utils
.
createRequest
(
stanza
));
return
test_utils
.
waitUntil
(()
=>
_converse
.
bookmarks
.
onBookmarksReceived
.
calls
.
count
(),
300
)
await
test_utils
.
waitUntil
(()
=>
_converse
.
bookmarks
.
onBookmarksReceived
.
calls
.
count
());
}).
then
(()
=>
{
expect
(
_converse
.
bookmarks
.
models
.
length
).
toBe
(
2
);
expect
(
_converse
.
bookmarks
.
models
.
length
).
toBe
(
2
);
expect
(
_converse
.
bookmarks
.
findWhere
({
'
jid
'
:
'
theplay@conference.shakespeare.lit
'
}).
get
(
'
autojoin
'
)).
toBe
(
true
);
expect
(
_converse
.
bookmarks
.
findWhere
({
'
jid
'
:
'
theplay@conference.shakespeare.lit
'
}).
get
(
'
autojoin
'
)).
toBe
(
true
);
expect
(
_converse
.
bookmarks
.
findWhere
({
'
jid
'
:
'
another@conference.shakespeare.lit
'
}).
get
(
'
autojoin
'
)).
toBe
(
false
);
expect
(
_converse
.
bookmarks
.
findWhere
({
'
jid
'
:
'
another@conference.shakespeare.lit
'
}).
get
(
'
autojoin
'
)).
toBe
(
false
);
done
();
done
();
}).
catch
(
_
.
partial
(
console
.
error
,
_
));
}));
}));
describe
(
"
The rooms panel
"
,
function
()
{
describe
(
"
The rooms panel
"
,
function
()
{
it
(
"
shows a list of bookmarks
"
,
mock
.
initConverseWithPromises
(
it
(
"
shows a list of bookmarks
"
,
mock
.
initConverseWithPromises
(
[
'
send
'
],
[
'
rosterGroupsFetched
'
],
{},
function
(
done
,
_converse
)
{
[
'
send
'
],
[
'
rosterGroupsFetched
'
],
{},
async
function
(
done
,
_converse
)
{
test_utils
.
waitUntilDiscoConfirmed
(
await
test_utils
.
waitUntilDiscoConfirmed
(
_converse
,
_converse
.
bare_jid
,
_converse
,
_converse
.
bare_jid
,
[{
'
category
'
:
'
pubsub
'
,
'
type
'
:
'
pep
'
}],
[{
'
category
'
:
'
pubsub
'
,
'
type
'
:
'
pep
'
}],
[
'
http://jabber.org/protocol/pubsub#publish-options
'
]
[
'
http://jabber.org/protocol/pubsub#publish-options
'
]
)
.
then
(
function
()
{
)
;
test_utils
.
openControlBox
();
test_utils
.
openControlBox
();
var
IQ_id
;
let
IQ_id
;
expect
(
_
.
filter
(
_converse
.
connection
.
send
.
calls
.
all
(),
function
(
call
)
{
const
call
=
await
test_utils
.
waitUntil
(()
=>
var
stanza
=
call
.
args
[
0
];
_
.
filter
(
_converse
.
connection
.
send
.
calls
.
all
(),
call
=>
{
const
stanza
=
call
.
args
[
0
];
if
(
!
(
stanza
instanceof
Element
)
||
stanza
.
nodeName
!==
'
iq
'
)
{
if
(
!
(
stanza
instanceof
Element
)
||
stanza
.
nodeName
!==
'
iq
'
)
{
return
;
return
;
}
}
// XXX: Wrapping in a div is a workaround for PhantomJS
if
(
sizzle
(
'
items[node="storage:bookmarks"]
'
,
stanza
).
length
)
{
var
div
=
document
.
createElement
(
'
div
'
);
div
.
appendChild
(
stanza
);
if
(
div
.
innerHTML
===
'
<iq from="dummy@localhost/resource" type="get"
'
+
'
xmlns="jabber:client" id="
'
+
stanza
.
getAttribute
(
'
id
'
)
+
'
">
'
+
'
<pubsub xmlns="http://jabber.org/protocol/pubsub">
'
+
'
<items node="storage:bookmarks"></items>
'
+
'
</pubsub>
'
+
'
</iq>
'
)
{
IQ_id
=
stanza
.
getAttribute
(
'
id
'
);
IQ_id
=
stanza
.
getAttribute
(
'
id
'
);
return
true
;
return
true
;
}
}
}).
length
).
toBe
(
1
);
}
).
pop
()
);
expect
(
Strophe
.
serialize
(
call
.
args
[
0
])).
toBe
(
`<iq from="dummy@localhost/resource" id="
${
IQ_id
}
" type="get" xmlns="jabber:client">`
+
'
<pubsub xmlns="http://jabber.org/protocol/pubsub">
'
+
'
<items node="storage:bookmarks"/>
'
+
'
</pubsub>
'
+
'
</iq>
'
);
var
stanza
=
$iq
({
'
to
'
:
_converse
.
connection
.
jid
,
'
type
'
:
'
result
'
,
'
id
'
:
IQ_id
})
const
stanza
=
$iq
({
'
to
'
:
_converse
.
connection
.
jid
,
'
type
'
:
'
result
'
,
'
id
'
:
IQ_id
})
.
c
(
'
pubsub
'
,
{
'
xmlns
'
:
Strophe
.
NS
.
PUBSUB
})
.
c
(
'
pubsub
'
,
{
'
xmlns
'
:
Strophe
.
NS
.
PUBSUB
})
.
c
(
'
items
'
,
{
'
node
'
:
'
storage:bookmarks
'
})
.
c
(
'
items
'
,
{
'
node
'
:
'
storage:bookmarks
'
})
.
c
(
'
item
'
,
{
'
id
'
:
'
current
'
})
.
c
(
'
item
'
,
{
'
id
'
:
'
current
'
})
...
@@ -521,10 +528,9 @@
...
@@ -521,10 +528,9 @@
}).
c
(
'
nick
'
).
t
(
'
JC
'
).
up
().
up
();
}).
c
(
'
nick
'
).
t
(
'
JC
'
).
up
().
up
();
_converse
.
connection
.
_dataRecv
(
test_utils
.
createRequest
(
stanza
));
_converse
.
connection
.
_dataRecv
(
test_utils
.
createRequest
(
stanza
));
test_utils
.
waitUntil
(()
=>
document
.
querySelectorAll
(
'
#chatrooms div.bookmarks.rooms-list .room-item
'
).
length
,
300
)
await
test_utils
.
waitUntil
(()
=>
document
.
querySelectorAll
(
'
#chatrooms div.bookmarks.rooms-list .room-item
'
).
length
);
.
then
(()
=>
{
expect
(
document
.
querySelectorAll
(
'
#chatrooms div.bookmarks.rooms-list .room-item
'
).
length
).
toBe
(
5
);
expect
(
document
.
querySelectorAll
(
'
#chatrooms div.bookmarks.rooms-list .room-item
'
).
length
).
toBe
(
5
);
cons
t
els
=
document
.
querySelectorAll
(
'
#chatrooms div.bookmarks.rooms-list .room-item a.list-item-link
'
);
le
t
els
=
document
.
querySelectorAll
(
'
#chatrooms div.bookmarks.rooms-list .room-item a.list-item-link
'
);
expect
(
els
[
0
].
textContent
).
toBe
(
"
1st Bookmark
"
);
expect
(
els
[
0
].
textContent
).
toBe
(
"
1st Bookmark
"
);
expect
(
els
[
1
].
textContent
).
toBe
(
"
Another room
"
);
expect
(
els
[
1
].
textContent
).
toBe
(
"
Another room
"
);
expect
(
els
[
2
].
textContent
).
toBe
(
"
Bookmark with a very very long name that will be shortened
"
);
expect
(
els
[
2
].
textContent
).
toBe
(
"
Bookmark with a very very long name that will be shortened
"
);
...
@@ -534,50 +540,52 @@
...
@@ -534,50 +540,52 @@
spyOn
(
window
,
'
confirm
'
).
and
.
returnValue
(
true
);
spyOn
(
window
,
'
confirm
'
).
and
.
returnValue
(
true
);
document
.
querySelector
(
'
#chatrooms .bookmarks.rooms-list .room-item:nth-child(2) a:nth-child(2)
'
).
click
();
document
.
querySelector
(
'
#chatrooms .bookmarks.rooms-list .room-item:nth-child(2) a:nth-child(2)
'
).
click
();
expect
(
window
.
confirm
).
toHaveBeenCalled
();
expect
(
window
.
confirm
).
toHaveBeenCalled
();
return
test_utils
.
waitUntil
(()
=>
document
.
querySelectorAll
(
'
#chatrooms div.bookmarks.rooms-list .room-item
'
).
length
===
4
,
300
)
await
test_utils
.
waitUntil
(()
=>
document
.
querySelectorAll
(
'
#chatrooms div.bookmarks.rooms-list .room-item
'
).
length
===
4
)
}).
then
(()
=>
{
els
=
document
.
querySelectorAll
(
'
#chatrooms div.bookmarks.rooms-list .room-item a.list-item-link
'
);
const
els
=
document
.
querySelectorAll
(
'
#chatrooms div.bookmarks.rooms-list .room-item a.list-item-link
'
);
expect
(
els
[
0
].
textContent
).
toBe
(
"
1st Bookmark
"
);
expect
(
els
[
0
].
textContent
).
toBe
(
"
1st Bookmark
"
);
expect
(
els
[
1
].
textContent
).
toBe
(
"
Bookmark with a very very long name that will be shortened
"
);
expect
(
els
[
1
].
textContent
).
toBe
(
"
Bookmark with a very very long name that will be shortened
"
);
expect
(
els
[
2
].
textContent
).
toBe
(
"
noname@conference.shakespeare.lit
"
);
expect
(
els
[
2
].
textContent
).
toBe
(
"
noname@conference.shakespeare.lit
"
);
expect
(
els
[
3
].
textContent
).
toBe
(
"
The Play's the Thing
"
);
expect
(
els
[
3
].
textContent
).
toBe
(
"
The Play's the Thing
"
);
done
();
done
();
}).
catch
(
_
.
partial
(
console
.
error
,
_
));
});
}));
}));
it
(
"
remembers the toggle state of the bookmarks list
"
,
mock
.
initConverseWithPromises
(
it
(
"
remembers the toggle state of the bookmarks list
"
,
mock
.
initConverseWithPromises
(
[
'
send
'
],
[
'
rosterGroupsFetched
'
],
{},
function
(
done
,
_converse
)
{
[
'
send
'
],
[
'
rosterGroupsFetched
'
],
{},
async
function
(
done
,
_converse
)
{
test_utils
.
openControlBox
();
test_utils
.
openControlBox
();
await
test_utils
.
waitUntilDiscoConfirmed
(
test_utils
.
waitUntilDiscoConfirmed
(
_converse
,
_converse
.
bare_jid
,
_converse
,
_converse
.
bare_jid
,
[{
'
category
'
:
'
pubsub
'
,
'
type
'
:
'
pep
'
}],
[{
'
category
'
:
'
pubsub
'
,
'
type
'
:
'
pep
'
}],
[
'
http://jabber.org/protocol/pubsub#publish-options
'
]
[
'
http://jabber.org/protocol/pubsub#publish-options
'
]
).
then
(
function
()
{
);
var
IQ_id
;
expect
(
_
.
filter
(
_converse
.
connection
.
send
.
calls
.
all
(),
function
(
call
)
{
let
IQ_id
;
var
stanza
=
call
.
args
[
0
];
const
call
=
await
test_utils
.
waitUntil
(()
=>
_
.
filter
(
_converse
.
connection
.
send
.
calls
.
all
(),
call
=>
{
const
stanza
=
call
.
args
[
0
];
if
(
!
(
stanza
instanceof
Element
)
||
stanza
.
nodeName
!==
'
iq
'
)
{
if
(
!
(
stanza
instanceof
Element
)
||
stanza
.
nodeName
!==
'
iq
'
)
{
return
;
return
;
}
}
// XXX: Wrapping in a div is a workaround for PhantomJS
if
(
sizzle
(
'
items[node="storage:bookmarks"]
'
,
stanza
).
length
)
{
var
div
=
document
.
createElement
(
'
div
'
);
div
.
appendChild
(
stanza
);
if
(
div
.
innerHTML
===
'
<iq from="dummy@localhost/resource" type="get"
'
+
'
xmlns="jabber:client" id="
'
+
stanza
.
getAttribute
(
'
id
'
)
+
'
">
'
+
'
<pubsub xmlns="http://jabber.org/protocol/pubsub">
'
+
'
<items node="storage:bookmarks"></items>
'
+
'
</pubsub>
'
+
'
</iq>
'
)
{
IQ_id
=
stanza
.
getAttribute
(
'
id
'
);
IQ_id
=
stanza
.
getAttribute
(
'
id
'
);
return
true
;
return
true
;
}
}
}).
length
).
toBe
(
1
);
}
).
pop
()
);
expect
(
Strophe
.
serialize
(
call
.
args
[
0
])).
toBe
(
`<iq from="dummy@localhost/resource" id="
${
IQ_id
}
" type="get" xmlns="jabber:client">`
+
'
<pubsub xmlns="http://jabber.org/protocol/pubsub">
'
+
'
<items node="storage:bookmarks"/>
'
+
'
</pubsub>
'
+
'
</iq>
'
);
var
stanza
=
$iq
({
'
to
'
:
_converse
.
connection
.
jid
,
'
type
'
:
'
result
'
,
'
id
'
:
IQ_id
})
const
stanza
=
$iq
({
'
to
'
:
_converse
.
connection
.
jid
,
'
type
'
:
'
result
'
,
'
id
'
:
IQ_id
})
.
c
(
'
pubsub
'
,
{
'
xmlns
'
:
Strophe
.
NS
.
PUBSUB
})
.
c
(
'
pubsub
'
,
{
'
xmlns
'
:
Strophe
.
NS
.
PUBSUB
})
.
c
(
'
items
'
,
{
'
node
'
:
'
storage:bookmarks
'
})
.
c
(
'
items
'
,
{
'
node
'
:
'
storage:bookmarks
'
})
.
c
(
'
item
'
,
{
'
id
'
:
'
current
'
})
.
c
(
'
item
'
,
{
'
id
'
:
'
current
'
})
...
@@ -590,8 +598,7 @@
...
@@ -590,8 +598,7 @@
'
name
'
:
'
The Play
'
,
'
name
'
:
'
The Play
'
,
'
nick
'
:
''
'
nick
'
:
''
});
});
test_utils
.
waitUntil
(()
=>
$
(
'
#chatrooms .bookmarks.rooms-list .room-item:visible
'
).
length
await
test_utils
.
waitUntil
(()
=>
$
(
'
#chatrooms .bookmarks.rooms-list .room-item:visible
'
).
length
);
).
then
(
function
()
{
expect
(
$
(
'
#chatrooms .bookmarks.rooms-list
'
).
hasClass
(
'
collapsed
'
)).
toBeFalsy
();
expect
(
$
(
'
#chatrooms .bookmarks.rooms-list
'
).
hasClass
(
'
collapsed
'
)).
toBeFalsy
();
expect
(
$
(
'
#chatrooms .bookmarks.rooms-list .room-item:visible
'
).
length
).
toBe
(
1
);
expect
(
$
(
'
#chatrooms .bookmarks.rooms-list .room-item:visible
'
).
length
).
toBe
(
1
);
expect
(
_converse
.
bookmarksview
.
list_model
.
get
(
'
toggle-state
'
)).
toBe
(
_converse
.
OPENED
);
expect
(
_converse
.
bookmarksview
.
list_model
.
get
(
'
toggle-state
'
)).
toBe
(
_converse
.
OPENED
);
...
@@ -603,8 +610,6 @@
...
@@ -603,8 +610,6 @@
expect
(
$
(
'
#chatrooms .bookmarks.rooms-list .room-item:visible
'
).
length
).
toBe
(
1
);
expect
(
$
(
'
#chatrooms .bookmarks.rooms-list .room-item:visible
'
).
length
).
toBe
(
1
);
expect
(
_converse
.
bookmarksview
.
list_model
.
get
(
'
toggle-state
'
)).
toBe
(
_converse
.
OPENED
);
expect
(
_converse
.
bookmarksview
.
list_model
.
get
(
'
toggle-state
'
)).
toBe
(
_converse
.
OPENED
);
done
();
done
();
});
});
}));
}));
});
});
});
});
...
...
spec/chatbox.js
View file @
37f43989
...
@@ -150,7 +150,8 @@
...
@@ -150,7 +150,8 @@
}));
}));
it
(
"
can be trimmed to conserve space
"
,
it
(
"
can be trimmed to conserve space
"
,
mock
.
initConverseWithPromises
(
null
,
[
'
rosterGroupsFetched
'
],
{},
function
(
done
,
_converse
)
{
mock
.
initConverseWithPromises
(
null
,
[
'
rosterGroupsFetched
'
],
{},
async
function
(
done
,
_converse
)
{
spyOn
(
_converse
.
chatboxviews
,
'
trimChats
'
);
spyOn
(
_converse
.
chatboxviews
,
'
trimChats
'
);
...
@@ -163,25 +164,23 @@
...
@@ -163,25 +164,23 @@
test_utils
.
openControlBox
();
test_utils
.
openControlBox
();
let
online_contacts
;
let
jid
,
chatboxview
;
var
i
,
jid
,
chatbox
,
chatboxview
,
trimmedview
;
// openControlBox was called earlier, so the controlbox is
// openControlBox was called earlier, so the controlbox is
// visible, but no other chat boxes have been created.
// visible, but no other chat boxes have been created.
expect
(
_converse
.
chatboxes
.
length
).
toEqual
(
1
);
expect
(
_converse
.
chatboxes
.
length
).
toEqual
(
1
);
expect
(
document
.
querySelectorAll
(
"
#conversejs .chatbox
"
).
length
).
toBe
(
1
);
// Controlbox is open
expect
(
document
.
querySelectorAll
(
"
#conversejs .chatbox
"
).
length
).
toBe
(
1
);
// Controlbox is open
_converse
.
rosterview
.
update
();
// XXX: Hack to make sure $roster element is attached.
_converse
.
rosterview
.
update
();
// XXX: Hack to make sure $roster element is attached.
test_utils
.
waitUntil
(()
=>
_converse
.
rosterview
.
el
.
querySelectorAll
(
'
.roster-group li
'
).
length
)
await
test_utils
.
waitUntil
(()
=>
_converse
.
rosterview
.
el
.
querySelectorAll
(
'
.roster-group li
'
).
length
);
.
then
(()
=>
{
// Test that they can be maximized again
// Test that they can be maximized again
online_contacts
=
_converse
.
rosterview
.
el
.
querySelectorAll
(
'
.roster-group .current-xmpp-contact a.open-chat
'
);
const
online_contacts
=
_converse
.
rosterview
.
el
.
querySelectorAll
(
'
.roster-group .current-xmpp-contact a.open-chat
'
);
expect
(
online_contacts
.
length
).
toBe
(
15
);
expect
(
online_contacts
.
length
).
toBe
(
15
);
let
i
;
for
(
i
=
0
;
i
<
online_contacts
.
length
;
i
++
)
{
for
(
i
=
0
;
i
<
online_contacts
.
length
;
i
++
)
{
const
el
=
online_contacts
[
i
];
const
el
=
online_contacts
[
i
];
el
.
click
();
el
.
click
();
}
}
return
test_utils
.
waitUntil
(()
=>
_converse
.
chatboxes
.
length
==
16
)
await
test_utils
.
waitUntil
(()
=>
_converse
.
chatboxes
.
length
==
16
);
}).
then
(()
=>
{
expect
(
_converse
.
chatboxviews
.
trimChats
.
calls
.
count
()).
toBe
(
16
);
expect
(
_converse
.
chatboxviews
.
trimChats
.
calls
.
count
()).
toBe
(
16
);
for
(
i
=
0
;
i
<
online_contacts
.
length
;
i
++
)
{
for
(
i
=
0
;
i
<
online_contacts
.
length
;
i
++
)
{
...
@@ -193,11 +192,10 @@
...
@@ -193,11 +192,10 @@
expect
(
trimmed_chatboxes
.
addChat
).
toHaveBeenCalled
();
expect
(
trimmed_chatboxes
.
addChat
).
toHaveBeenCalled
();
expect
(
chatboxview
.
minimize
).
toHaveBeenCalled
();
expect
(
chatboxview
.
minimize
).
toHaveBeenCalled
();
}
}
return
test_utils
.
waitUntil
(()
=>
_converse
.
chatboxviews
.
keys
().
length
);
await
test_utils
.
waitUntil
(()
=>
_converse
.
chatboxviews
.
keys
().
length
);
}).
then
(
function
()
{
var
key
=
_converse
.
chatboxviews
.
keys
()[
1
];
var
key
=
_converse
.
chatboxviews
.
keys
()[
1
];
trimmedview
=
trimmed_chatboxes
.
get
(
key
);
const
trimmedview
=
trimmed_chatboxes
.
get
(
key
);
chatbox
=
trimmedview
.
model
;
const
chatbox
=
trimmedview
.
model
;
spyOn
(
chatbox
,
'
maximize
'
).
and
.
callThrough
();
spyOn
(
chatbox
,
'
maximize
'
).
and
.
callThrough
();
spyOn
(
trimmedview
,
'
restore
'
).
and
.
callThrough
();
spyOn
(
trimmedview
,
'
restore
'
).
and
.
callThrough
();
trimmedview
.
delegateEvents
();
trimmedview
.
delegateEvents
();
...
@@ -207,7 +205,6 @@
...
@@ -207,7 +205,6 @@
expect
(
chatbox
.
maximize
).
toHaveBeenCalled
();
expect
(
chatbox
.
maximize
).
toHaveBeenCalled
();
expect
(
_converse
.
chatboxviews
.
trimChats
.
calls
.
count
()).
toBe
(
17
);
expect
(
_converse
.
chatboxviews
.
trimChats
.
calls
.
count
()).
toBe
(
17
);
done
();
done
();
});
}));
}));
it
(
"
can be opened in minimized mode initially
"
,
it
(
"
can be opened in minimized mode initially
"
,
...
@@ -453,18 +450,16 @@
...
@@ -453,18 +450,16 @@
it
(
"
contains a button for inserting emojis
"
,
it
(
"
contains a button for inserting emojis
"
,
mock
.
initConverseWithPromises
(
mock
.
initConverseWithPromises
(
null
,
[
'
rosterGroupsFetched
'
,
'
chatBoxesFetched
'
],
{},
null
,
[
'
rosterGroupsFetched
'
,
'
chatBoxesFetched
'
],
{},
function
(
done
,
_converse
)
{
async
function
(
done
,
_converse
)
{
test_utils
.
createContacts
(
_converse
,
'
current
'
);
test_utils
.
createContacts
(
_converse
,
'
current
'
);
_converse
.
emit
(
'
rosterContactsFetched
'
);
_converse
.
emit
(
'
rosterContactsFetched
'
);
test_utils
.
openControlBox
();
test_utils
.
openControlBox
();
let
timeout
=
false
,
view
,
toolbar
;
const
contact_jid
=
mock
.
cur_names
[
2
].
replace
(
/ /g
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
;
const
contact_jid
=
mock
.
cur_names
[
2
].
replace
(
/ /g
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
;
test_utils
.
openChatBoxFor
(
_converse
,
contact_jid
)
await
test_utils
.
openChatBoxFor
(
_converse
,
contact_jid
);
.
then
(()
=>
{
const
view
=
_converse
.
chatboxviews
.
get
(
contact_jid
);
view
=
_converse
.
chatboxviews
.
get
(
contact_jid
);
const
toolbar
=
view
.
el
.
querySelector
(
'
ul.chat-toolbar
'
);
toolbar
=
view
.
el
.
querySelector
(
'
ul.chat-toolbar
'
);
expect
(
toolbar
.
querySelectorAll
(
'
li.toggle-smiley
'
).
length
).
toBe
(
1
);
expect
(
toolbar
.
querySelectorAll
(
'
li.toggle-smiley
'
).
length
).
toBe
(
1
);
// Register spies
// Register spies
spyOn
(
view
,
'
toggleEmojiMenu
'
).
and
.
callThrough
();
spyOn
(
view
,
'
toggleEmojiMenu
'
).
and
.
callThrough
();
...
@@ -473,52 +468,33 @@
...
@@ -473,52 +468,33 @@
view
.
delegateEvents
();
// We need to rebind all events otherwise our spy won't be called
view
.
delegateEvents
();
// We need to rebind all events otherwise our spy won't be called
toolbar
.
querySelector
(
'
li.toggle-smiley
'
).
click
();
toolbar
.
querySelector
(
'
li.toggle-smiley
'
).
click
();
return
test_utils
.
waitUntil
(()
=>
u
.
isVisible
(
view
.
el
.
querySelector
(
'
.toggle-smiley .emoji-picker-container
'
),
500
));
await
test_utils
.
waitUntil
(()
=>
u
.
isVisible
(
view
.
el
.
querySelector
(
'
.toggle-smiley .emoji-picker-container
'
)));
}).
then
(()
=>
{
var
picker
=
view
.
el
.
querySelector
(
'
.toggle-smiley .emoji-picker-container
'
);
var
picker
=
view
.
el
.
querySelector
(
'
.toggle-smiley .emoji-picker-container
'
);
var
items
=
picker
.
querySelectorAll
(
'
.emoji-picker li
'
);
var
items
=
picker
.
querySelectorAll
(
'
.emoji-picker li
'
);
items
[
0
].
click
()
items
[
0
].
click
()
expect
(
view
.
insertEmoji
).
toHaveBeenCalled
();
expect
(
view
.
insertEmoji
).
toHaveBeenCalled
();
setTimeout
(
function
()
{
timeout
=
true
;
},
100
);
return
test_utils
.
waitUntil
(()
=>
timeout
,
500
);
}).
then
(()
=>
{
timeout
=
false
;
toolbar
.
querySelector
(
'
li.toggle-smiley
'
).
click
();
// Close the panel again
return
test_utils
.
waitUntil
(()
=>
!
view
.
el
.
querySelector
(
'
.toggle-smiley .toolbar-menu
'
).
offsetHeight
,
500
);
}).
then
(()
=>
{
setTimeout
(
function
()
{
timeout
=
true
;
},
100
);
return
test_utils
.
waitUntil
(()
=>
timeout
,
500
);
}).
then
(()
=>
{
toolbar
.
querySelector
(
'
li.toggle-smiley
'
).
click
();
expect
(
view
.
toggleEmojiMenu
).
toHaveBeenCalled
();
return
test_utils
.
waitUntil
(()
=>
u
.
isVisible
(
view
.
el
.
querySelector
(
'
.toggle-smiley .emoji-picker-container
'
)),
500
);
}).
then
(()
=>
{
var
nodes
=
view
.
el
.
querySelectorAll
(
'
.toggle-smiley ul li
'
);
nodes
[
nodes
.
length
-
1
].
click
();
expect
(
view
.
el
.
querySelector
(
'
textarea.chat-textarea
'
).
value
).
toBe
(
'
:grinning:
'
);
expect
(
view
.
el
.
querySelector
(
'
textarea.chat-textarea
'
).
value
).
toBe
(
'
:grinning:
'
);
expect
(
view
.
insertEmoji
).
toHaveBeenCalled
();
toolbar
.
querySelector
(
'
li.toggle-smiley
'
).
click
();
// Close the panel again
done
();
done
();
}).
catch
(
_
.
partial
(
_converse
.
log
,
_
,
Strophe
.
LogLevel
.
FATAL
));
}));
}));
it
(
"
can contain a button for starting a call
"
,
it
(
"
can contain a button for starting a call
"
,
mock
.
initConverseWithPromises
(
mock
.
initConverseWithPromises
(
null
,
[
'
rosterGroupsFetched
'
,
'
chatBoxesFetched
'
],
{},
null
,
[
'
rosterGroupsFetched
'
,
'
chatBoxesFetched
'
],
{},
function
(
done
,
_converse
)
{
async
function
(
done
,
_converse
)
{
test_utils
.
createContacts
(
_converse
,
'
current
'
);
test_utils
.
createContacts
(
_converse
,
'
current
'
);
_converse
.
emit
(
'
rosterContactsFetched
'
);
_converse
.
emit
(
'
rosterContactsFetched
'
);
test_utils
.
openControlBox
();
test_utils
.
openControlBox
();
let
view
,
toolbar
,
call_button
;
let
toolbar
,
call_button
;
const
contact_jid
=
mock
.
cur_names
[
2
].
replace
(
/ /g
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
;
const
contact_jid
=
mock
.
cur_names
[
2
].
replace
(
/ /g
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
;
spyOn
(
_converse
,
'
emit
'
);
spyOn
(
_converse
,
'
emit
'
);
// First check that the button doesn't show if it's not enabled
// First check that the button doesn't show if it's not enabled
// via "visible_toolbar_buttons"
// via "visible_toolbar_buttons"
_converse
.
visible_toolbar_buttons
.
call
=
false
;
_converse
.
visible_toolbar_buttons
.
call
=
false
;
test_utils
.
openChatBoxFor
(
_converse
,
contact_jid
)
await
test_utils
.
openChatBoxFor
(
_converse
,
contact_jid
);
.
then
(()
=>
{
let
view
=
_converse
.
chatboxviews
.
get
(
contact_jid
);
view
=
_converse
.
chatboxviews
.
get
(
contact_jid
);
toolbar
=
view
.
el
.
querySelector
(
'
ul.chat-toolbar
'
);
toolbar
=
view
.
el
.
querySelector
(
'
ul.chat-toolbar
'
);
call_button
=
toolbar
.
querySelector
(
'
.toggle-call
'
);
call_button
=
toolbar
.
querySelector
(
'
.toggle-call
'
);
expect
(
_
.
isNull
(
call_button
)).
toBeTruthy
();
expect
(
_
.
isNull
(
call_button
)).
toBeTruthy
();
...
@@ -526,15 +502,13 @@
...
@@ -526,15 +502,13 @@
// Now check that it's shown if enabled and that it emits
// Now check that it's shown if enabled and that it emits
// callButtonClicked
// callButtonClicked
_converse
.
visible_toolbar_buttons
.
call
=
true
;
// enable the button
_converse
.
visible_toolbar_buttons
.
call
=
true
;
// enable the button
return
test_utils
.
openChatBoxFor
(
_converse
,
contact_jid
);
await
test_utils
.
openChatBoxFor
(
_converse
,
contact_jid
);
}).
then
(()
=>
{
view
=
_converse
.
chatboxviews
.
get
(
contact_jid
);
view
=
_converse
.
chatboxviews
.
get
(
contact_jid
);
toolbar
=
view
.
el
.
querySelector
(
'
ul.chat-toolbar
'
);
toolbar
=
view
.
el
.
querySelector
(
'
ul.chat-toolbar
'
);
call_button
=
toolbar
.
querySelector
(
'
.toggle-call
'
);
call_button
=
toolbar
.
querySelector
(
'
.toggle-call
'
);
call_button
.
click
();
call_button
.
click
();
expect
(
_converse
.
emit
).
toHaveBeenCalledWith
(
'
callButtonClicked
'
,
jasmine
.
any
(
Object
));
expect
(
_converse
.
emit
).
toHaveBeenCalledWith
(
'
callButtonClicked
'
,
jasmine
.
any
(
Object
));
done
();
done
();
});
}));
}));
});
});
...
@@ -549,9 +523,9 @@
...
@@ -549,9 +523,9 @@
test_utils
.
openControlBox
();
test_utils
.
openControlBox
();
spyOn
(
_converse
,
'
emit
'
);
spyOn
(
_converse
,
'
emit
'
);
var
sender_jid
=
mock
.
cur_names
[
1
].
replace
(
/ /g
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
;
const
sender_jid
=
mock
.
cur_names
[
1
].
replace
(
/ /g
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
;
// <composing> state
// <composing> state
var
msg
=
$msg
({
const
msg
=
$msg
({
'
from
'
:
sender_jid
,
'
from
'
:
sender_jid
,
'
to
'
:
_converse
.
connection
.
jid
,
'
to
'
:
_converse
.
connection
.
jid
,
'
type
'
:
'
chat
'
,
'
type
'
:
'
chat
'
,
...
...
spec/chatroom.js
View file @
37f43989
...
@@ -2331,10 +2331,9 @@
...
@@ -2331,10 +2331,9 @@
it
(
"
can be minimized by clicking a DOM element with class 'toggle-chatbox-button'
"
,
it
(
"
can be minimized by clicking a DOM element with class 'toggle-chatbox-button'
"
,
mock
.
initConverseWithPromises
(
mock
.
initConverseWithPromises
(
null
,
[
'
rosterGroupsFetched
'
,
'
chatBoxesFetched
'
],
{},
null
,
[
'
rosterGroupsFetched
'
,
'
chatBoxesFetched
'
],
{},
function
(
done
,
_converse
)
{
async
function
(
done
,
_converse
)
{
test_utils
.
openChatRoom
(
_converse
,
'
lounge
'
,
'
localhost
'
,
'
dummy
'
)
await
test_utils
.
openChatRoom
(
_converse
,
'
lounge
'
,
'
localhost
'
,
'
dummy
'
);
.
then
(()
=>
{
const
view
=
_converse
.
chatboxviews
.
get
(
'
lounge@localhost
'
),
const
view
=
_converse
.
chatboxviews
.
get
(
'
lounge@localhost
'
),
trimmed_chatboxes
=
_converse
.
minimized_chats
;
trimmed_chatboxes
=
_converse
.
minimized_chats
;
...
@@ -2349,7 +2348,8 @@
...
@@ -2349,7 +2348,8 @@
expect
(
u
.
isVisible
(
view
.
el
)).
toBeFalsy
();
expect
(
u
.
isVisible
(
view
.
el
)).
toBeFalsy
();
expect
(
view
.
model
.
get
(
'
minimized
'
)).
toBeTruthy
();
expect
(
view
.
model
.
get
(
'
minimized
'
)).
toBeTruthy
();
expect
(
view
.
minimize
).
toHaveBeenCalled
();
expect
(
view
.
minimize
).
toHaveBeenCalled
();
var
trimmedview
=
trimmed_chatboxes
.
get
(
view
.
model
.
get
(
'
id
'
));
await
test_utils
.
waitUntil
(()
=>
trimmed_chatboxes
.
get
(
view
.
model
.
get
(
'
id
'
)));
const
trimmedview
=
trimmed_chatboxes
.
get
(
view
.
model
.
get
(
'
id
'
));
trimmedview
.
el
.
querySelector
(
"
a.restore-chat
"
).
click
();
trimmedview
.
el
.
querySelector
(
"
a.restore-chat
"
).
click
();
expect
(
view
.
maximize
).
toHaveBeenCalled
();
expect
(
view
.
maximize
).
toHaveBeenCalled
();
expect
(
_converse
.
emit
).
toHaveBeenCalledWith
(
'
chatBoxMaximized
'
,
jasmine
.
any
(
Object
));
expect
(
_converse
.
emit
).
toHaveBeenCalledWith
(
'
chatBoxMaximized
'
,
jasmine
.
any
(
Object
));
...
@@ -2357,7 +2357,6 @@
...
@@ -2357,7 +2357,6 @@
expect
(
_converse
.
emit
.
calls
.
count
(),
3
);
expect
(
_converse
.
emit
.
calls
.
count
(),
3
);
done
();
done
();
});
}));
}));
it
(
"
can be closed again by clicking a DOM element with class 'close-chatbox-button'
"
,
it
(
"
can be closed again by clicking a DOM element with class 'close-chatbox-button'
"
,
...
...
spec/http-file-upload.js
View file @
37f43989
...
@@ -14,17 +14,16 @@
...
@@ -14,17 +14,16 @@
describe
(
"
Discovering support
"
,
function
()
{
describe
(
"
Discovering support
"
,
function
()
{
it
(
"
is done automatically
"
,
mock
.
initConverseWithAsync
(
function
(
done
,
_converse
)
{
it
(
"
is done automatically
"
,
mock
.
initConverseWithAsync
(
async
function
(
done
,
_converse
)
{
var
IQ_stanzas
=
_converse
.
connection
.
IQ_stanzas
;
var
IQ_stanzas
=
_converse
.
connection
.
IQ_stanzas
;
var
IQ_ids
=
_converse
.
connection
.
IQ_ids
;
var
IQ_ids
=
_converse
.
connection
.
IQ_ids
;
test_utils
.
waitUntilDiscoConfirmed
(
_converse
,
_converse
.
bare_jid
,
[],
[]).
then
(
function
()
{
await
test_utils
.
waitUntilDiscoConfirmed
(
_converse
,
_converse
.
bare_jid
,
[],
[]);
test_utils
.
waitUntil
(
function
()
{
await
test_utils
.
waitUntil
(()
=>
_
.
filter
(
return
_
.
filter
(
IQ_stanzas
,
function
(
iq
)
{
IQ_stanzas
,
return
iq
.
nodeTree
.
querySelector
(
iq
=>
iq
.
nodeTree
.
querySelector
(
'
iq[to="localhost"] query[xmlns="http://jabber.org/protocol/disco#info"]
'
)).
length
'
iq[to="localhost"] query[xmlns="http://jabber.org/protocol/disco#info"]
'
);
);
}).
length
>
0
;
},
300
).
then
(
function
()
{
/* <iq type='result'
/* <iq type='result'
* from='plays.shakespeare.lit'
* from='plays.shakespeare.lit'
* to='romeo@montague.net/orchard'
* to='romeo@montague.net/orchard'
...
@@ -38,7 +37,7 @@
...
@@ -38,7 +37,7 @@
* </query>
* </query>
* </iq>
* </iq>
*/
*/
var
stanza
=
_
.
find
(
IQ_stanzas
,
function
(
iq
)
{
let
stanza
=
_
.
find
(
IQ_stanzas
,
function
(
iq
)
{
return
iq
.
nodeTree
.
querySelector
(
return
iq
.
nodeTree
.
querySelector
(
'
iq[to="localhost"] query[xmlns="http://jabber.org/protocol/disco#info"]
'
);
'
iq[to="localhost"] query[xmlns="http://jabber.org/protocol/disco#info"]
'
);
});
});
...
@@ -59,7 +58,7 @@
...
@@ -59,7 +58,7 @@
'
var
'
:
'
http://jabber.org/protocol/disco#items
'
});
'
var
'
:
'
http://jabber.org/protocol/disco#items
'
});
_converse
.
connection
.
_dataRecv
(
test_utils
.
createRequest
(
stanza
));
_converse
.
connection
.
_dataRecv
(
test_utils
.
createRequest
(
stanza
));
_converse
.
api
.
disco
.
entities
.
get
().
then
(
function
(
entities
)
{
const
entities
=
await
_converse
.
api
.
disco
.
entities
.
get
();
expect
(
entities
.
length
).
toBe
(
2
);
expect
(
entities
.
length
).
toBe
(
2
);
expect
(
_
.
includes
(
entities
.
pluck
(
'
jid
'
),
'
localhost
'
)).
toBe
(
true
);
expect
(
_
.
includes
(
entities
.
pluck
(
'
jid
'
),
'
localhost
'
)).
toBe
(
true
);
expect
(
_
.
includes
(
entities
.
pluck
(
'
jid
'
),
'
dummy@localhost
'
)).
toBe
(
true
);
expect
(
_
.
includes
(
entities
.
pluck
(
'
jid
'
),
'
dummy@localhost
'
)).
toBe
(
true
);
...
@@ -67,15 +66,13 @@
...
@@ -67,15 +66,13 @@
expect
(
entities
.
get
(
_converse
.
domain
).
features
.
length
).
toBe
(
2
);
expect
(
entities
.
get
(
_converse
.
domain
).
features
.
length
).
toBe
(
2
);
expect
(
entities
.
get
(
_converse
.
domain
).
identities
.
length
).
toBe
(
1
);
expect
(
entities
.
get
(
_converse
.
domain
).
identities
.
length
).
toBe
(
1
);
return
test_utils
.
waitUntil
(
function
()
{
// Converse.js sees that the entity has a disco#items feature,
// Converse.js sees that the entity has a disco#items feature,
// so it will make a query for it.
// so it will make a query for it.
return
_
.
filter
(
IQ_stanzas
,
function
(
iq
)
{
await
test_utils
.
waitUntil
(()
=>
_
.
filter
(
return
iq
.
nodeTree
.
querySelector
(
'
iq[to="localhost"] query[xmlns="http://jabber.org/protocol/disco#items"]
'
);
IQ_stanzas
,
}).
length
>
0
;
iq
=>
iq
.
nodeTree
.
querySelector
(
'
iq[to="localhost"] query[xmlns="http://jabber.org/protocol/disco#items"]
'
)
},
300
);
).
length
});
);
}).
then
(
function
()
{
/* <iq from='montague.tld'
/* <iq from='montague.tld'
* id='step_01'
* id='step_01'
* to='romeo@montague.tld/garden'
* to='romeo@montague.tld/garden'
...
@@ -86,7 +83,7 @@
...
@@ -86,7 +83,7 @@
* </query>
* </query>
* </iq>
* </iq>
*/
*/
var
stanza
=
_
.
find
(
IQ_stanzas
,
function
(
iq
)
{
stanza
=
_
.
find
(
IQ_stanzas
,
function
(
iq
)
{
return
iq
.
nodeTree
.
querySelector
(
'
iq[to="localhost"] query[xmlns="http://jabber.org/protocol/disco#items"]
'
);
return
iq
.
nodeTree
.
querySelector
(
'
iq[to="localhost"] query[xmlns="http://jabber.org/protocol/disco#items"]
'
);
});
});
var
items_IQ_id
=
IQ_ids
[
IQ_stanzas
.
indexOf
(
stanza
)];
var
items_IQ_id
=
IQ_ids
[
IQ_stanzas
.
indexOf
(
stanza
)];
...
@@ -99,6 +96,7 @@
...
@@ -99,6 +96,7 @@
.
c
(
'
item
'
,
{
.
c
(
'
item
'
,
{
'
jid
'
:
'
upload.localhost
'
,
'
jid
'
:
'
upload.localhost
'
,
'
name
'
:
'
HTTP File Upload
'
});
'
name
'
:
'
HTTP File Upload
'
});
_converse
.
connection
.
_dataRecv
(
test_utils
.
createRequest
(
stanza
));
_converse
.
connection
.
_dataRecv
(
test_utils
.
createRequest
(
stanza
));
_converse
.
api
.
disco
.
entities
.
get
().
then
(
function
(
entities
)
{
_converse
.
api
.
disco
.
entities
.
get
().
then
(
function
(
entities
)
{
...
@@ -112,11 +110,15 @@
...
@@ -112,11 +110,15 @@
}).
length
>
0
;
}).
length
>
0
;
},
300
);
},
300
);
});
});
}).
then
(
function
()
{
var
stanza
=
_
.
find
(
IQ_stanzas
,
function
(
iq
)
{
stanza
=
await
test_utils
.
waitUntil
(()
=>
return
iq
.
nodeTree
.
querySelector
(
'
iq[to="upload.localhost"] query[xmlns="http://jabber.org/protocol/disco#info"]
'
);
_
.
filter
(
});
IQ_stanzas
,
var
IQ_id
=
IQ_ids
[
IQ_stanzas
.
indexOf
(
stanza
)];
iq
=>
iq
.
nodeTree
.
querySelector
(
'
iq[to="upload.localhost"] query[xmlns="http://jabber.org/protocol/disco#info"]
'
)
).
pop
()
);
const
IQ_id
=
IQ_ids
[
IQ_stanzas
.
indexOf
(
stanza
)];
expect
(
stanza
.
toLocaleString
()).
toBe
(
expect
(
stanza
.
toLocaleString
()).
toBe
(
`<iq from="dummy@localhost/resource" id="`
+
IQ_id
+
`" to="upload.localhost" type="get" xmlns="jabber:client">`
+
`<iq from="dummy@localhost/resource" id="`
+
IQ_id
+
`" to="upload.localhost" type="get" xmlns="jabber:client">`
+
`<query xmlns="http://jabber.org/protocol/disco#info"/>`
+
`<query xmlns="http://jabber.org/protocol/disco#info"/>`
+
...
@@ -165,8 +167,6 @@
...
@@ -165,8 +167,6 @@
}
}
);
);
}).
catch
(
_
.
partial
(
_converse
.
log
,
_
,
Strophe
.
LogLevel
.
FATAL
));
}).
catch
(
_
.
partial
(
_converse
.
log
,
_
,
Strophe
.
LogLevel
.
FATAL
));
})
})
}));
}));
});
});
...
@@ -474,16 +474,17 @@
...
@@ -474,16 +474,17 @@
done
();
done
();
}));
}));
it
(
"
shows an error message if the file is too large
"
,
mock
.
initConverseWithAsync
(
function
(
done
,
_converse
)
{
it
(
"
shows an error message if the file is too large
"
,
mock
.
initConverseWithAsync
(
async
function
(
done
,
_converse
)
{
const
IQ_stanzas
=
_converse
.
connection
.
IQ_stanzas
;
const
IQ_stanzas
=
_converse
.
connection
.
IQ_stanzas
;
const
IQ_ids
=
_converse
.
connection
.
IQ_ids
;
const
IQ_ids
=
_converse
.
connection
.
IQ_ids
;
const
send_backup
=
XMLHttpRequest
.
prototype
.
send
;
const
send_backup
=
XMLHttpRequest
.
prototype
.
send
;
let
view
,
contact_jid
;
test_utils
.
waitUntilDiscoConfirmed
(
_converse
,
_converse
.
bare_jid
,
[],
[])
await
test_utils
.
waitUntilDiscoConfirmed
(
_converse
,
_converse
.
bare_jid
,
[],
[]);
.
then
(()
=>
test_utils
.
waitUntil
(()
=>
_
.
filter
(
await
test_utils
.
waitUntil
(()
=>
_
.
filter
(
IQ_stanzas
,
(
iq
)
=>
iq
.
nodeTree
.
querySelector
(
'
iq[to="localhost"] query[xmlns="http://jabber.org/protocol/disco#info"]
'
)).
length
IQ_stanzas
,
)).
then
(()
=>
{
iq
=>
iq
.
nodeTree
.
querySelector
(
'
iq[to="localhost"] query[xmlns="http://jabber.org/protocol/disco#info"]
'
)).
length
);
var
stanza
=
_
.
find
(
IQ_stanzas
,
function
(
iq
)
{
var
stanza
=
_
.
find
(
IQ_stanzas
,
function
(
iq
)
{
return
iq
.
nodeTree
.
querySelector
(
return
iq
.
nodeTree
.
querySelector
(
'
iq[to="localhost"] query[xmlns="http://jabber.org/protocol/disco#info"]
'
);
'
iq[to="localhost"] query[xmlns="http://jabber.org/protocol/disco#info"]
'
);
...
@@ -504,8 +505,8 @@
...
@@ -504,8 +505,8 @@
.
c
(
'
feature
'
,
{
.
c
(
'
feature
'
,
{
'
var
'
:
'
http://jabber.org/protocol/disco#items
'
});
'
var
'
:
'
http://jabber.org/protocol/disco#items
'
});
_converse
.
connection
.
_dataRecv
(
test_utils
.
createRequest
(
stanza
));
_converse
.
connection
.
_dataRecv
(
test_utils
.
createRequest
(
stanza
));
return
_converse
.
api
.
disco
.
entities
.
get
();
let
entities
=
await
_converse
.
api
.
disco
.
entities
.
get
();
}).
then
(
function
(
entities
)
{
expect
(
entities
.
length
).
toBe
(
2
);
expect
(
entities
.
length
).
toBe
(
2
);
expect
(
_
.
includes
(
entities
.
pluck
(
'
jid
'
),
'
localhost
'
)).
toBe
(
true
);
expect
(
_
.
includes
(
entities
.
pluck
(
'
jid
'
),
'
localhost
'
)).
toBe
(
true
);
expect
(
_
.
includes
(
entities
.
pluck
(
'
jid
'
),
'
dummy@localhost
'
)).
toBe
(
true
);
expect
(
_
.
includes
(
entities
.
pluck
(
'
jid
'
),
'
dummy@localhost
'
)).
toBe
(
true
);
...
@@ -513,15 +514,15 @@
...
@@ -513,15 +514,15 @@
expect
(
entities
.
get
(
_converse
.
domain
).
features
.
length
).
toBe
(
2
);
expect
(
entities
.
get
(
_converse
.
domain
).
features
.
length
).
toBe
(
2
);
expect
(
entities
.
get
(
_converse
.
domain
).
identities
.
length
).
toBe
(
1
);
expect
(
entities
.
get
(
_converse
.
domain
).
identities
.
length
).
toBe
(
1
);
return
test_utils
.
waitUntil
(
function
()
{
await
test_utils
.
waitUntil
(
function
()
{
// Converse.js sees that the entity has a disco#items feature,
// Converse.js sees that the entity has a disco#items feature,
// so it will make a query for it.
// so it will make a query for it.
return
_
.
filter
(
IQ_stanzas
,
function
(
iq
)
{
return
_
.
filter
(
IQ_stanzas
,
function
(
iq
)
{
return
iq
.
nodeTree
.
querySelector
(
'
iq[to="localhost"] query[xmlns="http://jabber.org/protocol/disco#items"]
'
);
return
iq
.
nodeTree
.
querySelector
(
'
iq[to="localhost"] query[xmlns="http://jabber.org/protocol/disco#items"]
'
);
}).
length
>
0
;
}).
length
>
0
;
},
300
);
},
300
);
}).
then
(
function
()
{
var
stanza
=
_
.
find
(
IQ_stanzas
,
function
(
iq
)
{
stanza
=
_
.
find
(
IQ_stanzas
,
function
(
iq
)
{
return
iq
.
nodeTree
.
querySelector
(
'
iq[to="localhost"] query[xmlns="http://jabber.org/protocol/disco#items"]
'
);
return
iq
.
nodeTree
.
querySelector
(
'
iq[to="localhost"] query[xmlns="http://jabber.org/protocol/disco#items"]
'
);
});
});
var
items_IQ_id
=
IQ_ids
[
IQ_stanzas
.
indexOf
(
stanza
)];
var
items_IQ_id
=
IQ_ids
[
IQ_stanzas
.
indexOf
(
stanza
)];
...
@@ -537,19 +538,19 @@
...
@@ -537,19 +538,19 @@
_converse
.
connection
.
_dataRecv
(
test_utils
.
createRequest
(
stanza
));
_converse
.
connection
.
_dataRecv
(
test_utils
.
createRequest
(
stanza
));
_converse
.
api
.
disco
.
entities
.
get
().
then
(
function
(
entities
)
{
entities
=
await
_converse
.
api
.
disco
.
entities
.
get
()
expect
(
entities
.
length
).
toBe
(
2
);
expect
(
entities
.
length
).
toBe
(
2
);
expect
(
entities
.
get
(
'
localhost
'
).
items
.
length
).
toBe
(
1
);
expect
(
entities
.
get
(
'
localhost
'
).
items
.
length
).
toBe
(
1
);
return
test_utils
.
waitUntil
(
function
()
{
await
test_utils
.
waitUntil
(
function
()
{
// Converse.js sees that the entity has a disco#info feature,
// Converse.js sees that the entity has a disco#info feature,
// so it will make a query for it.
// so it will make a query for it.
return
_
.
filter
(
IQ_stanzas
,
function
(
iq
)
{
return
_
.
filter
(
IQ_stanzas
,
function
(
iq
)
{
return
iq
.
nodeTree
.
querySelector
(
'
iq[to="upload.localhost"] query[xmlns="http://jabber.org/protocol/disco#info"]
'
);
return
iq
.
nodeTree
.
querySelector
(
'
iq[to="upload.localhost"] query[xmlns="http://jabber.org/protocol/disco#info"]
'
);
}).
length
>
0
;
}).
length
>
0
;
},
300
);
},
300
);
});
}).
then
(
function
()
{
stanza
=
_
.
find
(
IQ_stanzas
,
function
(
iq
)
{
var
stanza
=
_
.
find
(
IQ_stanzas
,
function
(
iq
)
{
return
iq
.
nodeTree
.
querySelector
(
'
iq[to="upload.localhost"] query[xmlns="http://jabber.org/protocol/disco#info"]
'
);
return
iq
.
nodeTree
.
querySelector
(
'
iq[to="upload.localhost"] query[xmlns="http://jabber.org/protocol/disco#info"]
'
);
});
});
var
IQ_id
=
IQ_ids
[
IQ_stanzas
.
indexOf
(
stanza
)];
var
IQ_id
=
IQ_ids
[
IQ_stanzas
.
indexOf
(
stanza
)];
...
@@ -569,18 +570,15 @@
...
@@ -569,18 +570,15 @@
.
c
(
'
field
'
,
{
'
var
'
:
'
max-file-size
'
})
.
c
(
'
field
'
,
{
'
var
'
:
'
max-file-size
'
})
.
c
(
'
value
'
).
t
(
'
5242880
'
);
.
c
(
'
value
'
).
t
(
'
5242880
'
);
_converse
.
connection
.
_dataRecv
(
test_utils
.
createRequest
(
stanza
));
_converse
.
connection
.
_dataRecv
(
test_utils
.
createRequest
(
stanza
));
return
_converse
.
api
.
disco
.
entities
.
get
();
entities
=
await
_converse
.
api
.
disco
.
entities
.
get
();
}).
then
(
function
(
entities
)
{
expect
(
entities
.
get
(
'
localhost
'
).
items
.
get
(
'
upload.localhost
'
).
identities
.
where
({
'
category
'
:
'
store
'
}).
length
).
toBe
(
1
);
expect
(
entities
.
get
(
'
localhost
'
).
items
.
get
(
'
upload.localhost
'
).
identities
.
where
({
'
category
'
:
'
store
'
}).
length
).
toBe
(
1
);
return
_converse
.
api
.
disco
.
supports
(
Strophe
.
NS
.
HTTPUPLOAD
,
_converse
.
domain
);
const
result
=
await
_converse
.
api
.
disco
.
supports
(
Strophe
.
NS
.
HTTPUPLOAD
,
_converse
.
domain
);
}).
then
(
function
(
result
)
{
test_utils
.
createContacts
(
_converse
,
'
current
'
);
test_utils
.
createContacts
(
_converse
,
'
current
'
);
_converse
.
emit
(
'
rosterContactsFetched
'
);
_converse
.
emit
(
'
rosterContactsFetched
'
);
contact_jid
=
mock
.
cur_names
[
2
].
replace
(
/ /g
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
;
const
contact_jid
=
mock
.
cur_names
[
2
].
replace
(
/ /g
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
;
return
test_utils
.
openChatBoxFor
(
_converse
,
contact_jid
);
await
test_utils
.
openChatBoxFor
(
_converse
,
contact_jid
);
}).
then
(()
=>
{
const
view
=
_converse
.
chatboxviews
.
get
(
contact_jid
);
view
=
_converse
.
chatboxviews
.
get
(
contact_jid
);
var
file
=
{
var
file
=
{
'
type
'
:
'
image/jpeg
'
,
'
type
'
:
'
image/jpeg
'
,
'
size
'
:
'
5242881
'
,
'
size
'
:
'
5242881
'
,
...
@@ -588,14 +586,12 @@
...
@@ -588,14 +586,12 @@
'
name
'
:
"
my-juliet.jpg
"
'
name
'
:
"
my-juliet.jpg
"
};
};
view
.
model
.
sendFiles
([
file
]);
view
.
model
.
sendFiles
([
file
]);
return
test_utils
.
waitUntil
(()
=>
view
.
el
.
querySelectorAll
(
'
.message
'
).
length
)
await
test_utils
.
waitUntil
(()
=>
view
.
el
.
querySelectorAll
(
'
.message
'
).
length
)
}).
then
(
function
()
{
const
messages
=
view
.
el
.
querySelectorAll
(
'
.message.chat-error
'
);
const
messages
=
view
.
el
.
querySelectorAll
(
'
.message.chat-error
'
);
expect
(
messages
.
length
).
toBe
(
1
);
expect
(
messages
.
length
).
toBe
(
1
);
expect
(
messages
[
0
].
textContent
).
toBe
(
expect
(
messages
[
0
].
textContent
).
toBe
(
'
The size of your file, my-juliet.jpg, exceeds the maximum allowed by your server, which is 5 MB.
'
);
'
The size of your file, my-juliet.jpg, exceeds the maximum allowed by your server, which is 5 MB.
'
);
done
();
done
();
}).
catch
(
_
.
partial
(
_converse
.
log
,
_
,
Strophe
.
LogLevel
.
FATAL
))
}));
}));
});
});
});
});
...
...
spec/notification.js
View file @
37f43989
...
@@ -159,22 +159,26 @@
...
@@ -159,22 +159,26 @@
it
(
"
is played when the current user is mentioned in a chat room
"
,
it
(
"
is played when the current user is mentioned in a chat room
"
,
mock
.
initConverseWithPromises
(
mock
.
initConverseWithPromises
(
null
,
[
'
rosterGroupsFetched
'
],
{},
null
,
[
'
rosterGroupsFetched
'
],
{},
function
(
done
,
_converse
)
{
async
function
(
done
,
_converse
)
{
test_utils
.
createContacts
(
_converse
,
'
current
'
);
test_utils
.
createContacts
(
_converse
,
'
current
'
);
test_utils
.
openAndEnterChatRoom
(
_converse
,
'
lounge
'
,
'
localhost
'
,
'
dummy
'
).
then
(
function
()
{
await
test_utils
.
openAndEnterChatRoom
(
_converse
,
'
lounge
'
,
'
localhost
'
,
'
dummy
'
);
_converse
.
play_sounds
=
true
;
_converse
.
play_sounds
=
true
;
spyOn
(
_converse
,
'
playSoundNotification
'
);
spyOn
(
_converse
,
'
playSoundNotification
'
);
var
view
=
_converse
.
chatboxviews
.
get
(
'
lounge@localhost
'
);
const
view
=
_converse
.
chatboxviews
.
get
(
'
lounge@localhost
'
);
if
(
!
$
(
view
.
el
).
find
(
'
.chat-area
'
).
length
)
{
view
.
renderChatArea
();
}
if
(
!
view
.
el
.
querySelectorAll
(
'
.chat-area
'
).
length
)
{
var
text
=
'
This message will play a sound because it mentions dummy
'
;
view
.
renderChatArea
();
var
message
=
$msg
({
}
let
text
=
'
This message will play a sound because it mentions dummy
'
;
let
message
=
$msg
({
from
:
'
lounge@localhost/otheruser
'
,
from
:
'
lounge@localhost/otheruser
'
,
id
:
'
1
'
,
id
:
'
1
'
,
to
:
'
dummy@localhost
'
,
to
:
'
dummy@localhost
'
,
type
:
'
groupchat
'
type
:
'
groupchat
'
}).
c
(
'
body
'
).
t
(
text
);
}).
c
(
'
body
'
).
t
(
text
);
view
.
model
.
onMessage
(
message
.
nodeTree
);
view
.
model
.
onMessage
(
message
.
nodeTree
);
await
test_utils
.
waitUntil
(()
=>
_converse
.
playSoundNotification
.
calls
.
count
());
expect
(
_converse
.
playSoundNotification
).
toHaveBeenCalled
();
expect
(
_converse
.
playSoundNotification
).
toHaveBeenCalled
();
text
=
"
This message won't play a sound
"
;
text
=
"
This message won't play a sound
"
;
...
@@ -199,7 +203,6 @@
...
@@ -199,7 +203,6 @@
expect
(
_converse
.
playSoundNotification
,
1
);
expect
(
_converse
.
playSoundNotification
,
1
);
_converse
.
play_sounds
=
false
;
_converse
.
play_sounds
=
false
;
done
();
done
();
});
}));
}));
});
});
});
});
...
...
spec/roster.js
View file @
37f43989
...
@@ -10,28 +10,21 @@
...
@@ -10,28 +10,21 @@
const
u
=
converse
.
env
.
utils
;
const
u
=
converse
.
env
.
utils
;
const
checkHeaderToggling
=
function
(
group
)
{
const
checkHeaderToggling
=
async
function
(
group
)
{
var
$group
=
$
(
group
);
var
toggle
=
group
.
querySelector
(
'
a.group-toggle
'
);
var
toggle
=
group
.
querySelector
(
'
a.group-toggle
'
);
expect
(
u
.
isVisible
(
$group
[
0
]
)).
toBeTruthy
();
expect
(
u
.
isVisible
(
group
)).
toBeTruthy
();
expect
(
$group
.
find
(
'
ul.collapsed
'
).
length
).
toBe
(
0
);
expect
(
group
.
querySelectorAll
(
'
ul.collapsed
'
).
length
).
toBe
(
0
);
expect
(
u
.
hasClass
(
'
fa-caret-right
'
,
toggle
.
firstElementChild
)).
toBeFalsy
();
expect
(
u
.
hasClass
(
'
fa-caret-right
'
,
toggle
.
firstElementChild
)).
toBeFalsy
();
expect
(
u
.
hasClass
(
'
fa-caret-down
'
,
toggle
.
firstElementChild
)).
toBeTruthy
();
expect
(
u
.
hasClass
(
'
fa-caret-down
'
,
toggle
.
firstElementChild
)).
toBeTruthy
();
toggle
.
click
();
toggle
.
click
();
return
test_utils
.
waitUntil
(
function
()
{
await
test_utils
.
waitUntil
(()
=>
group
.
querySelectorAll
(
'
ul.collapsed
'
).
length
===
1
);
return
$group
.
find
(
'
ul.collapsed
'
).
length
===
1
;
},
500
).
then
(
function
()
{
expect
(
u
.
hasClass
(
'
fa-caret-right
'
,
toggle
.
firstElementChild
)).
toBeTruthy
();
expect
(
u
.
hasClass
(
'
fa-caret-right
'
,
toggle
.
firstElementChild
)).
toBeTruthy
();
expect
(
u
.
hasClass
(
'
fa-caret-down
'
,
toggle
.
firstElementChild
)).
toBeFalsy
();
expect
(
u
.
hasClass
(
'
fa-caret-down
'
,
toggle
.
firstElementChild
)).
toBeFalsy
();
toggle
.
click
();
toggle
.
click
();
return
test_utils
.
waitUntil
(
function
()
{
await
test_utils
.
waitUntil
(()
=>
group
.
querySelectorAll
(
'
li
'
).
length
===
$
(
group
).
find
(
'
li:visible
'
).
length
);
return
$group
.
find
(
'
li
'
).
length
===
$group
.
find
(
'
li:visible
'
).
length
},
500
);
}).
then
(
function
()
{
expect
(
u
.
hasClass
(
'
fa-caret-right
'
,
toggle
.
firstElementChild
)).
toBeFalsy
();
expect
(
u
.
hasClass
(
'
fa-caret-right
'
,
toggle
.
firstElementChild
)).
toBeFalsy
();
expect
(
u
.
hasClass
(
'
fa-caret-down
'
,
toggle
.
firstElementChild
)).
toBeTruthy
();
expect
(
u
.
hasClass
(
'
fa-caret-down
'
,
toggle
.
firstElementChild
)).
toBeTruthy
();
});
};
};
...
@@ -501,7 +494,7 @@
...
@@ -501,7 +494,7 @@
it
(
"
remembers whether it is closed or opened
"
,
it
(
"
remembers whether it is closed or opened
"
,
mock
.
initConverseWithPromises
(
mock
.
initConverseWithPromises
(
null
,
[
'
rosterGroupsFetched
'
],
{},
null
,
[
'
rosterGroupsFetched
'
],
{},
function
(
done
,
_converse
)
{
async
function
(
done
,
_converse
)
{
_converse
.
roster_groups
=
true
;
_converse
.
roster_groups
=
true
;
test_utils
.
openControlBox
();
test_utils
.
openControlBox
();
...
@@ -524,20 +517,14 @@
...
@@ -524,20 +517,14 @@
});
});
}
}
});
});
var
view
=
_converse
.
rosterview
.
get
(
'
colleagues
'
);
const
view
=
_converse
.
rosterview
.
get
(
'
colleagues
'
);
var
$toggle
=
$
(
view
.
el
).
find
(
'
a.group-toggle
'
);
const
toggle
=
view
.
el
.
querySelector
(
'
a.group-toggle
'
);
expect
(
view
.
model
.
get
(
'
state
'
)).
toBe
(
'
opened
'
);
expect
(
view
.
model
.
get
(
'
state
'
)).
toBe
(
'
opened
'
);
$toggle
[
0
].
click
();
toggle
.
click
();
return
test_utils
.
waitUntil
(
function
()
{
await
test_utils
.
waitUntil
(()
=>
view
.
model
.
get
(
'
state
'
)
===
'
closed
'
);
return
view
.
model
.
get
(
'
state
'
)
===
'
closed
'
;
toggle
.
click
();
},
500
).
then
(
function
()
{
await
test_utils
.
waitUntil
(()
=>
view
.
model
.
get
(
'
state
'
)
===
'
opened
'
);
$toggle
[
0
].
click
();
return
test_utils
.
waitUntil
(
function
()
{
return
view
.
model
.
get
(
'
state
'
)
===
'
opened
'
;
},
500
)
}).
then
(
function
()
{
done
();
done
();
});
}));
}));
});
});
...
...
spec/spoilers.js
View file @
37f43989
...
@@ -105,6 +105,7 @@
...
@@ -105,6 +105,7 @@
spyOn
(
view
,
'
onMessageSubmitted
'
).
and
.
callThrough
();
spyOn
(
view
,
'
onMessageSubmitted
'
).
and
.
callThrough
();
spyOn
(
_converse
.
connection
,
'
send
'
);
spyOn
(
_converse
.
connection
,
'
send
'
);
await
test_utils
.
waitUntil
(()
=>
view
.
el
.
querySelector
(
'
.toggle-compose-spoiler
'
));
let
spoiler_toggle
=
view
.
el
.
querySelector
(
'
.toggle-compose-spoiler
'
);
let
spoiler_toggle
=
view
.
el
.
querySelector
(
'
.toggle-compose-spoiler
'
);
spoiler_toggle
.
click
();
spoiler_toggle
.
click
();
...
@@ -178,6 +179,8 @@
...
@@ -178,6 +179,8 @@
await
test_utils
.
openChatBoxFor
(
_converse
,
contact_jid
);
await
test_utils
.
openChatBoxFor
(
_converse
,
contact_jid
);
await
test_utils
.
waitUntilDiscoConfirmed
(
_converse
,
contact_jid
+
'
/phone
'
,
[],
[
Strophe
.
NS
.
SPOILER
]);
await
test_utils
.
waitUntilDiscoConfirmed
(
_converse
,
contact_jid
+
'
/phone
'
,
[],
[
Strophe
.
NS
.
SPOILER
]);
const
view
=
_converse
.
chatboxviews
.
get
(
contact_jid
);
const
view
=
_converse
.
chatboxviews
.
get
(
contact_jid
);
await
test_utils
.
waitUntil
(()
=>
view
.
el
.
querySelector
(
'
.toggle-compose-spoiler
'
));
let
spoiler_toggle
=
view
.
el
.
querySelector
(
'
.toggle-compose-spoiler
'
);
let
spoiler_toggle
=
view
.
el
.
querySelector
(
'
.toggle-compose-spoiler
'
);
spoiler_toggle
.
click
();
spoiler_toggle
.
click
();
...
...
src/converse-bookmarks.js
View file @
37f43989
...
@@ -69,15 +69,14 @@ converse.plugins.add('converse-bookmarks', {
...
@@ -69,15 +69,14 @@ converse.plugins.add('converse-bookmarks', {
close_button
.
insertAdjacentHTML
(
'
afterend
'
,
bookmark_button
);
close_button
.
insertAdjacentHTML
(
'
afterend
'
,
bookmark_button
);
},
},
renderHeading
()
{
async
renderHeading
()
{
this
.
__super__
.
renderHeading
.
apply
(
this
,
arguments
);
this
.
__super__
.
renderHeading
.
apply
(
this
,
arguments
);
const
{
_converse
}
=
this
.
__super__
;
const
{
_converse
}
=
this
.
__super__
;
if
(
_converse
.
allow_bookmarks
)
{
if
(
_converse
.
allow_bookmarks
)
{
_converse
.
checkBookmarksSupport
().
then
((
supported
)
=>
{
const
supported
=
await
_converse
.
checkBookmarksSupport
();
if
(
supported
)
{
if
(
supported
)
{
this
.
renderBookmarkToggle
();
this
.
renderBookmarkToggle
();
}
}
}).
catch
(
_
.
partial
(
_converse
.
log
,
_
,
Strophe
.
LogLevel
.
FATAL
));
}
}
},
},
...
@@ -518,32 +517,25 @@ converse.plugins.add('converse-bookmarks', {
...
@@ -518,32 +517,25 @@ converse.plugins.add('converse-bookmarks', {
}
}
});
});
_converse
.
checkBookmarksSupport
=
function
()
{
_converse
.
checkBookmarksSupport
=
async
function
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
const
args
=
await
Promise
.
all
([
Promise
.
all
([
_converse
.
api
.
disco
.
getIdentity
(
'
pubsub
'
,
'
pep
'
,
_converse
.
bare_jid
),
_converse
.
api
.
disco
.
getIdentity
(
'
pubsub
'
,
'
pep
'
,
_converse
.
bare_jid
),
_converse
.
api
.
disco
.
supports
(
Strophe
.
NS
.
PUBSUB
+
'
#publish-options
'
,
_converse
.
bare_jid
)
_converse
.
api
.
disco
.
supports
(
Strophe
.
NS
.
PUBSUB
+
'
#publish-options
'
,
_converse
.
bare_jid
)
]).
then
((
args
)
=>
{
]);
resolve
(
args
[
0
]
&&
(
args
[
1
].
length
||
_converse
.
allow_public_bookmarks
));
return
args
[
0
]
&&
(
args
[
1
].
length
||
_converse
.
allow_public_bookmarks
);
}).
catch
(
_
.
partial
(
_converse
.
log
,
_
,
Strophe
.
LogLevel
.
FATAL
));
}).
catch
(
_
.
partial
(
_converse
.
log
,
_
,
Strophe
.
LogLevel
.
FATAL
));
}
}
const
initBookmarks
=
function
()
{
const
initBookmarks
=
async
function
()
{
if
(
!
_converse
.
allow_bookmarks
)
{
if
(
!
_converse
.
allow_bookmarks
)
{
return
;
return
;
}
}
_converse
.
checkBookmarksSupport
().
then
((
supported
)
=>
{
const
supported
=
await
_converse
.
checkBookmarksSupport
();
if
(
supported
)
{
if
(
supported
)
{
_converse
.
bookmarks
=
new
_converse
.
Bookmarks
();
_converse
.
bookmarks
=
new
_converse
.
Bookmarks
();
_converse
.
bookmarksview
=
new
_converse
.
BookmarksView
({
'
model
'
:
_converse
.
bookmarks
});
_converse
.
bookmarksview
=
new
_converse
.
BookmarksView
({
'
model
'
:
_converse
.
bookmarks
});
_converse
.
bookmarks
.
fetchBookmarks
()
await
_converse
.
bookmarks
.
fetchBookmarks
();
.
catch
(
_
.
partial
(
_converse
.
log
,
_
,
Strophe
.
LogLevel
.
FATAL
))
.
then
(()
=>
_converse
.
emit
(
'
bookmarksInitialized
'
));
}
else
{
_converse
.
emit
(
'
bookmarksInitialized
'
);
}
}
}
);
_converse
.
emit
(
'
bookmarksInitialized
'
);
}
}
u
.
onMultipleEvents
([
u
.
onMultipleEvents
([
...
...
src/converse-chatview.js
View file @
37f43989
...
@@ -10,6 +10,7 @@ import "converse-modal";
...
@@ -10,6 +10,7 @@ import "converse-modal";
import
*
as
twemoji
from
"
twemoji
"
;
import
*
as
twemoji
from
"
twemoji
"
;
import
bootstrap
from
"
bootstrap
"
;
import
bootstrap
from
"
bootstrap
"
;
import
converse
from
"
@converse/headless/converse-core
"
;
import
converse
from
"
@converse/headless/converse-core
"
;
import
tpl_alert
from
"
templates/alert.html
"
;
import
tpl_chatbox
from
"
templates/chatbox.html
"
;
import
tpl_chatbox
from
"
templates/chatbox.html
"
;
import
tpl_chatbox_head
from
"
templates/chatbox_head.html
"
;
import
tpl_chatbox_head
from
"
templates/chatbox_head.html
"
;
import
tpl_chatbox_message_form
from
"
templates/chatbox_message_form.html
"
;
import
tpl_chatbox_message_form
from
"
templates/chatbox_message_form.html
"
;
...
@@ -229,13 +230,23 @@ converse.plugins.add('converse-chatview', {
...
@@ -229,13 +230,23 @@ converse.plugins.add('converse-chatview', {
}
}
},
},
refreshContact
(
ev
)
{
async
refreshContact
(
ev
)
{
if
(
ev
&&
ev
.
preventDefault
)
{
ev
.
preventDefault
();
}
if
(
ev
&&
ev
.
preventDefault
)
{
ev
.
preventDefault
();
}
const
refresh_icon
=
this
.
el
.
querySelector
(
'
.fa-refresh
'
);
const
refresh_icon
=
this
.
el
.
querySelector
(
'
.fa-refresh
'
);
u
.
addClass
(
'
fa-spin
'
,
refresh_icon
);
u
.
addClass
(
'
fa-spin
'
,
refresh_icon
);
_converse
.
api
.
vcard
.
update
(
this
.
model
.
contact
.
vcard
,
true
)
try
{
.
then
(()
=>
u
.
removeClass
(
'
fa-spin
'
,
refresh_icon
))
await
_converse
.
api
.
vcard
.
update
(
this
.
model
.
contact
.
vcard
,
true
);
.
catch
(
_
.
partial
(
_converse
.
log
,
_
,
Strophe
.
LogLevel
.
FATAL
));
}
catch
(
e
)
{
_converse
.
log
(
e
,
Strophe
.
LogLevel
.
FATAL
);
this
.
el
.
querySelector
(
'
.modal-body
'
).
insertAdjacentHTML
(
'
afterBegin
'
,
tpl_alert
({
'
type
'
:
'
alert-danger
'
,
'
message
'
:
__
(
'
Sorry, something went wrong while trying to refresh
'
)
})
);
}
u
.
removeClass
(
'
fa-spin
'
,
refresh_icon
);
},
},
removeContact
(
ev
)
{
removeContact
(
ev
)
{
...
@@ -387,17 +398,16 @@ converse.plugins.add('converse-chatview', {
...
@@ -387,17 +398,16 @@ converse.plugins.add('converse-chatview', {
this
.
model
.
sendFiles
(
evt
.
target
.
files
);
this
.
model
.
sendFiles
(
evt
.
target
.
files
);
},
},
addFileUploadButton
(
options
)
{
a
sync
a
ddFileUploadButton
(
options
)
{
_converse
.
api
.
disco
.
supports
(
Strophe
.
NS
.
HTTPUPLOAD
,
_converse
.
domain
).
then
((
result
)
=>
{
const
result
=
await
_converse
.
api
.
disco
.
supports
(
Strophe
.
NS
.
HTTPUPLOAD
,
_converse
.
domain
);
if
(
result
.
length
)
{
if
(
result
.
length
)
{
this
.
el
.
querySelector
(
'
.chat-toolbar
'
).
insertAdjacentHTML
(
this
.
el
.
querySelector
(
'
.chat-toolbar
'
).
insertAdjacentHTML
(
'
beforeend
'
,
'
beforeend
'
,
tpl_toolbar_fileupload
({
'
tooltip_upload_file
'
:
__
(
'
Choose a file to send
'
)}));
tpl_toolbar_fileupload
({
'
tooltip_upload_file
'
:
__
(
'
Choose a file to send
'
)}));
}
}
}).
catch
(
_
.
partial
(
_converse
.
log
,
_
,
Strophe
.
LogLevel
.
FATAL
));
},
},
addSpoilerButton
(
options
)
{
a
sync
a
ddSpoilerButton
(
options
)
{
/* Asynchronously adds a button for writing spoiler
/* Asynchronously adds a button for writing spoiler
* messages, based on whether the contact's client supports
* messages, based on whether the contact's client supports
* it.
* it.
...
@@ -410,9 +420,9 @@ converse.plugins.add('converse-chatview', {
...
@@ -410,9 +420,9 @@ converse.plugins.add('converse-chatview', {
if
(
_
.
isEmpty
(
resources
))
{
if
(
_
.
isEmpty
(
resources
))
{
return
;
return
;
}
}
Promise
.
all
(
_
.
map
(
_
.
keys
(
resources
),
(
resource
)
=>
const
results
=
await
Promise
.
all
(
_
.
map
(
_
.
keys
(
resources
),
_converse
.
api
.
disco
.
supports
(
Strophe
.
NS
.
SPOILER
,
`
${
contact_jid
}
/
${
resource
}
`
)
resource
=>
_converse
.
api
.
disco
.
supports
(
Strophe
.
NS
.
SPOILER
,
`
${
contact_jid
}
/
${
resource
}
`
)
))
.
then
((
results
)
=>
{
))
;
if
(
_
.
filter
(
results
,
'
length
'
).
length
)
{
if
(
_
.
filter
(
results
,
'
length
'
).
length
)
{
const
html
=
tpl_spoiler_button
(
this
.
model
.
toJSON
());
const
html
=
tpl_spoiler_button
(
this
.
model
.
toJSON
());
if
(
_converse
.
visible_toolbar_buttons
.
emoji
)
{
if
(
_converse
.
visible_toolbar_buttons
.
emoji
)
{
...
@@ -421,7 +431,6 @@ converse.plugins.add('converse-chatview', {
...
@@ -421,7 +431,6 @@ converse.plugins.add('converse-chatview', {
this
.
el
.
querySelector
(
'
.chat-toolbar
'
).
insertAdjacentHTML
(
'
afterBegin
'
,
html
);
this
.
el
.
querySelector
(
'
.chat-toolbar
'
).
insertAdjacentHTML
(
'
afterBegin
'
,
html
);
}
}
}
}
}).
catch
(
_
.
partial
(
_converse
.
log
,
_
,
Strophe
.
LogLevel
.
FATAL
));
},
},
insertHeading
()
{
insertHeading
()
{
...
...
src/converse-minimize.js
View file @
37f43989
...
@@ -229,7 +229,7 @@ converse.plugins.add('converse-minimize', {
...
@@ -229,7 +229,7 @@ converse.plugins.add('converse-minimize', {
);
);
},
},
trimChats
(
newchat
)
{
async
trimChats
(
newchat
)
{
/* This method is called when a newly created chat box will
/* This method is called when a newly created chat box will
* be shown.
* be shown.
*
*
...
@@ -250,7 +250,7 @@ converse.plugins.add('converse-minimize', {
...
@@ -250,7 +250,7 @@ converse.plugins.add('converse-minimize', {
// fullscreen. In this case we don't trim.
// fullscreen. In this case we don't trim.
return
;
return
;
}
}
_converse
.
api
.
waitUntil
(
'
minimizedChatsInitialized
'
).
then
(()
=>
{
await
_converse
.
api
.
waitUntil
(
'
minimizedChatsInitialized
'
);
const
minimized_el
=
_
.
get
(
_converse
.
minimized_chats
,
'
el
'
),
const
minimized_el
=
_
.
get
(
_converse
.
minimized_chats
,
'
el
'
),
new_id
=
newchat
?
newchat
.
model
.
get
(
'
id
'
)
:
null
;
new_id
=
newchat
?
newchat
.
model
.
get
(
'
id
'
)
:
null
;
...
@@ -278,7 +278,6 @@ converse.plugins.add('converse-minimize', {
...
@@ -278,7 +278,6 @@ converse.plugins.add('converse-minimize', {
}
}
}
}
}
}
}).
catch
(
_
.
partial
(
_converse
.
log
,
_
,
Strophe
.
LogLevel
.
FATAL
));
},
},
getOldestMaximizedChat
(
exclude_ids
)
{
getOldestMaximizedChat
(
exclude_ids
)
{
...
...
src/converse-muc-views.js
View file @
37f43989
...
@@ -258,7 +258,7 @@ converse.plugins.add('converse-muc-views', {
...
@@ -258,7 +258,7 @@ converse.plugins.add('converse-muc-views', {
}
else
{
}
else
{
parent_el
.
insertAdjacentHTML
(
'
beforeend
'
,
tpl_spinner
());
parent_el
.
insertAdjacentHTML
(
'
beforeend
'
,
tpl_spinner
());
_converse
.
api
.
disco
.
info
(
ev
.
target
.
getAttribute
(
'
data-room-jid
'
),
null
)
_converse
.
api
.
disco
.
info
(
ev
.
target
.
getAttribute
(
'
data-room-jid
'
),
null
)
.
then
(
(
stanza
)
=>
insertRoomInfo
(
parent_el
,
stanza
))
.
then
(
stanza
=>
insertRoomInfo
(
parent_el
,
stanza
))
.
catch
(
_
.
partial
(
_converse
.
log
,
_
,
Strophe
.
LogLevel
.
ERROR
));
.
catch
(
_
.
partial
(
_converse
.
log
,
_
,
Strophe
.
LogLevel
.
ERROR
));
}
}
}
}
...
@@ -1159,7 +1159,7 @@ converse.plugins.add('converse-muc-views', {
...
@@ -1159,7 +1159,7 @@ converse.plugins.add('converse-muc-views', {
*/
*/
this
.
showSpinner
();
this
.
showSpinner
();
this
.
model
.
fetchRoomConfiguration
()
this
.
model
.
fetchRoomConfiguration
()
.
then
(
this
.
renderConfigurationForm
.
bind
(
this
))
.
then
(
iq
=>
this
.
renderConfigurationForm
(
iq
))
.
catch
(
_
.
partial
(
_converse
.
log
,
_
,
Strophe
.
LogLevel
.
ERROR
));
.
catch
(
_
.
partial
(
_converse
.
log
,
_
,
Strophe
.
LogLevel
.
ERROR
));
},
},
...
...
src/converse-oauth.js
View file @
37f43989
...
@@ -106,17 +106,16 @@ converse.plugins.add("converse-oauth", {
...
@@ -106,17 +106,16 @@ converse.plugins.add("converse-oauth", {
}));
}));
},
},
fetchOAuthProfileDataAndLogin
()
{
async
fetchOAuthProfileDataAndLogin
()
{
this
.
oauth_service
.
api
(
'
me
'
).
then
((
profile
)
=>
{
const
profile
=
await
this
.
oauth_service
.
api
(
'
me
'
);
const
response
=
this
.
oauth_service
.
getAuthResponse
();
const
response
=
this
.
oauth_service
.
getAuthResponse
();
_converse
.
api
.
user
.
login
({
_converse
.
api
.
user
.
login
({
'
jid
'
:
`
${
profile
.
name
}
@
${
this
.
provider
.
get
(
'
host
'
)}
`
,
'
jid
'
:
`
${
profile
.
name
}
@
${
this
.
provider
.
get
(
'
host
'
)}
`
,
'
password
'
:
response
.
access_token
'
password
'
:
response
.
access_token
});
});
});
},
},
oauthLogin
(
ev
)
{
async
oauthLogin
(
ev
)
{
ev
.
preventDefault
();
ev
.
preventDefault
();
const
id
=
ev
.
target
.
getAttribute
(
'
data-id
'
);
const
id
=
ev
.
target
.
getAttribute
(
'
data-id
'
);
this
.
provider
=
_converse
.
oauth_providers
.
get
(
id
);
this
.
provider
=
_converse
.
oauth_providers
.
get
(
id
);
...
@@ -128,10 +127,8 @@ converse.plugins.add("converse-oauth", {
...
@@ -128,10 +127,8 @@ converse.plugins.add("converse-oauth", {
'
redirect_uri
'
:
'
/redirect.html
'
'
redirect_uri
'
:
'
/redirect.html
'
});
});
this
.
oauth_service
.
login
().
then
(
await
this
.
oauth_service
.
login
();
()
=>
this
.
fetchOAuthProfileDataAndLogin
(),
this
.
fetchOAuthProfileDataAndLogin
();
(
error
)
=>
_converse
.
log
(
error
.
error_message
,
Strophe
.
LogLevel
.
ERROR
)
);
}
}
});
});
}
}
...
...
src/converse-profile.js
View file @
37f43989
...
@@ -11,7 +11,6 @@ import "converse-modal";
...
@@ -11,7 +11,6 @@ import "converse-modal";
import
_FormData
from
"
formdata-polyfill
"
;
import
_FormData
from
"
formdata-polyfill
"
;
import
bootstrap
from
"
bootstrap
"
;
import
bootstrap
from
"
bootstrap
"
;
import
converse
from
"
@converse/headless/converse-core
"
;
import
converse
from
"
@converse/headless/converse-core
"
;
import
tpl_alert
from
"
templates/alert.html
"
;
import
tpl_chat_status_modal
from
"
templates/chat_status_modal.html
"
;
import
tpl_chat_status_modal
from
"
templates/chat_status_modal.html
"
;
import
tpl_profile_modal
from
"
templates/profile_modal.html
"
;
import
tpl_profile_modal
from
"
templates/profile_modal.html
"
;
import
tpl_profile_view
from
"
templates/profile_view.html
"
;
import
tpl_profile_view
from
"
templates/profile_view.html
"
;
...
...
src/converse-rosterview.js
View file @
37f43989
...
@@ -680,15 +680,14 @@ converse.plugins.add('converse-rosterview', {
...
@@ -680,15 +680,14 @@ converse.plugins.add('converse-rosterview', {
this
.
filterOutContacts
(
this
.
getFilterMatches
(
q
,
type
));
this
.
filterOutContacts
(
this
.
getFilterMatches
(
q
,
type
));
},
},
toggle
(
ev
)
{
async
toggle
(
ev
)
{
if
(
ev
&&
ev
.
preventDefault
)
{
ev
.
preventDefault
();
}
if
(
ev
&&
ev
.
preventDefault
)
{
ev
.
preventDefault
();
}
const
icon_el
=
ev
.
target
.
querySelector
(
'
.fa
'
);
const
icon_el
=
ev
.
target
.
querySelector
(
'
.fa
'
);
if
(
_
.
includes
(
icon_el
.
classList
,
"
fa-caret-down
"
))
{
if
(
_
.
includes
(
icon_el
.
classList
,
"
fa-caret-down
"
))
{
this
.
model
.
save
({
state
:
_converse
.
CLOSED
});
this
.
model
.
save
({
state
:
_converse
.
CLOSED
});
this
.
collapse
().
then
(()
=>
{
await
this
.
collapse
();
icon_el
.
classList
.
remove
(
"
fa-caret-down
"
);
icon_el
.
classList
.
remove
(
"
fa-caret-down
"
);
icon_el
.
classList
.
add
(
"
fa-caret-right
"
);
icon_el
.
classList
.
add
(
"
fa-caret-right
"
);
});
}
else
{
}
else
{
icon_el
.
classList
.
remove
(
"
fa-caret-right
"
);
icon_el
.
classList
.
remove
(
"
fa-caret-right
"
);
icon_el
.
classList
.
add
(
"
fa-caret-down
"
);
icon_el
.
classList
.
add
(
"
fa-caret-down
"
);
...
...
src/headless/converse-chatboxes.js
View file @
37f43989
...
@@ -144,8 +144,17 @@ converse.plugins.add('converse-chatboxes', {
...
@@ -144,8 +144,17 @@ converse.plugins.add('converse-chatboxes', {
return
_converse
.
api
.
sendIQ
(
iq
);
return
_converse
.
api
.
sendIQ
(
iq
);
},
},
getRequestSlotURL
()
{
async
getRequestSlotURL
()
{
this
.
sendSlotRequestStanza
().
then
((
stanza
)
=>
{
let
stanza
;
try
{
stanza
=
await
this
.
sendSlotRequestStanza
();
}
catch
(
e
)
{
_converse
.
log
(
e
,
Strophe
.
LogLevel
.
ERROR
);
return
this
.
save
({
'
type
'
:
'
error
'
,
'
message
'
:
__
(
"
Sorry, could not determine upload URL.
"
)
});
}
const
slot
=
stanza
.
querySelector
(
'
slot
'
);
const
slot
=
stanza
.
querySelector
(
'
slot
'
);
if
(
slot
)
{
if
(
slot
)
{
this
.
save
({
this
.
save
({
...
@@ -158,13 +167,6 @@ converse.plugins.add('converse-chatboxes', {
...
@@ -158,13 +167,6 @@ converse.plugins.add('converse-chatboxes', {
'
message
'
:
__
(
"
Sorry, could not determine file upload URL.
"
)
'
message
'
:
__
(
"
Sorry, could not determine file upload URL.
"
)
});
});
}
}
}).
catch
((
e
)
=>
{
_converse
.
log
(
e
,
Strophe
.
LogLevel
.
ERROR
);
return
this
.
save
({
'
type
'
:
'
error
'
,
'
message
'
:
__
(
"
Sorry, could not determine upload URL.
"
)
});
});
},
},
uploadFile
()
{
uploadFile
()
{
...
...
src/headless/converse-disco.js
View file @
37f43989
...
@@ -162,13 +162,14 @@ converse.plugins.add('converse-disco', {
...
@@ -162,13 +162,14 @@ converse.plugins.add('converse-disco', {
});
});
},
},
queryForItems
()
{
async
queryForItems
()
{
if
(
_
.
isEmpty
(
this
.
identities
.
where
({
'
category
'
:
'
server
'
})))
{
if
(
_
.
isEmpty
(
this
.
identities
.
where
({
'
category
'
:
'
server
'
})))
{
// Don't fetch features and items if this is not a
// Don't fetch features and items if this is not a
// server or a conference component.
// server or a conference component.
return
;
return
;
}
}
_converse
.
api
.
disco
.
items
(
this
.
get
(
'
jid
'
)).
then
(
stanza
=>
this
.
onDiscoItems
(
stanza
));
const
stanza
=
await
_converse
.
api
.
disco
.
items
(
this
.
get
(
'
jid
'
));
this
.
onDiscoItems
(
stanza
);
},
},
onInfo
(
stanza
)
{
onInfo
(
stanza
)
{
...
@@ -268,7 +269,7 @@ converse.plugins.add('converse-disco', {
...
@@ -268,7 +269,7 @@ converse.plugins.add('converse-disco', {
_converse
.
emit
(
'
streamFeaturesAdded
'
);
_converse
.
emit
(
'
streamFeaturesAdded
'
);
}
}
function
initializeDisco
()
{
async
function
initializeDisco
()
{
addClientFeatures
();
addClientFeatures
();
_converse
.
connection
.
addHandler
(
onDiscoInfoRequest
,
Strophe
.
NS
.
DISCO_INFO
,
'
iq
'
,
'
get
'
,
null
,
null
);
_converse
.
connection
.
addHandler
(
onDiscoInfoRequest
,
Strophe
.
NS
.
DISCO_INFO
,
'
iq
'
,
'
get
'
,
null
,
null
);
...
@@ -277,14 +278,13 @@ converse.plugins.add('converse-disco', {
...
@@ -277,14 +278,13 @@ converse.plugins.add('converse-disco', {
b64_sha1
(
`converse.disco-entities-
${
_converse
.
bare_jid
}
`
)
b64_sha1
(
`converse.disco-entities-
${
_converse
.
bare_jid
}
`
)
);
);
_converse
.
disco_entities
.
fetchEntities
().
then
((
collection
)
=>
{
const
collection
=
await
_converse
.
disco_entities
.
fetchEntities
();
if
(
collection
.
length
===
0
||
!
collection
.
get
(
_converse
.
domain
))
{
if
(
collection
.
length
===
0
||
!
collection
.
get
(
_converse
.
domain
))
{
// If we don't have an entity for our own XMPP server,
// If we don't have an entity for our own XMPP server,
// create one.
// create one.
_converse
.
disco_entities
.
create
({
'
jid
'
:
_converse
.
domain
});
_converse
.
disco_entities
.
create
({
'
jid
'
:
_converse
.
domain
});
}
}
_converse
.
emit
(
'
discoInitialized
'
);
_converse
.
emit
(
'
discoInitialized
'
);
}).
catch
(
_
.
partial
(
_converse
.
log
,
_
,
Strophe
.
LogLevel
.
FATAL
));
}
}
_converse
.
api
.
listen
.
on
(
'
sessionInitialized
'
,
initStreamFeatures
);
_converse
.
api
.
listen
.
on
(
'
sessionInitialized
'
,
initStreamFeatures
);
...
@@ -513,9 +513,8 @@ converse.plugins.add('converse-disco', {
...
@@ -513,9 +513,8 @@ converse.plugins.add('converse-disco', {
* @param {boolean} [create] Whether the entity should be created if it doesn't exist.
* @param {boolean} [create] Whether the entity should be created if it doesn't exist.
* @example _converse.api.disco.entities.get(jid);
* @example _converse.api.disco.entities.get(jid);
*/
*/
'
get
'
(
jid
,
create
=
false
)
{
async
'
get
'
(
jid
,
create
=
false
)
{
return
_converse
.
api
.
waitUntil
(
'
discoInitialized
'
)
await
_converse
.
api
.
waitUntil
(
'
discoInitialized
'
);
.
then
(()
=>
{
if
(
_
.
isNil
(
jid
))
{
if
(
_
.
isNil
(
jid
))
{
return
_converse
.
disco_entities
;
return
_converse
.
disco_entities
;
}
}
...
@@ -524,7 +523,6 @@ converse.plugins.add('converse-disco', {
...
@@ -524,7 +523,6 @@ converse.plugins.add('converse-disco', {
return
entity
;
return
entity
;
}
}
return
_converse
.
disco_entities
.
create
({
'
jid
'
:
jid
});
return
_converse
.
disco_entities
.
create
({
'
jid
'
:
jid
});
});
}
}
},
},
...
@@ -559,20 +557,19 @@ converse.plugins.add('converse-disco', {
...
@@ -559,20 +557,19 @@ converse.plugins.add('converse-disco', {
* );
* );
* });
* });
*/
*/
'
supports
'
(
feature
,
jid
)
{
async
'
supports
'
(
feature
,
jid
)
{
if
(
_
.
isNil
(
jid
))
{
if
(
_
.
isNil
(
jid
))
{
throw
new
TypeError
(
'
api.disco.supports: You need to provide an entity JID
'
);
throw
new
TypeError
(
'
api.disco.supports: You need to provide an entity JID
'
);
}
}
return
_converse
.
api
.
waitUntil
(
'
discoInitialized
'
)
await
_converse
.
api
.
waitUntil
(
'
discoInitialized
'
);
.
then
(()
=>
_converse
.
api
.
disco
.
entities
.
get
(
jid
,
true
))
let
entity
=
await
_converse
.
api
.
disco
.
entities
.
get
(
jid
,
true
);
.
then
(
entity
=>
entity
.
waitUntilFeaturesDiscovered
)
entity
=
await
entity
.
waitUntilFeaturesDiscovered
;
.
then
(
entity
=>
{
const
promises
=
_
.
concat
(
const
promises
=
_
.
concat
(
entity
.
items
.
map
(
item
=>
item
.
hasFeature
(
feature
)),
entity
.
items
.
map
(
item
=>
item
.
hasFeature
(
feature
)),
entity
.
hasFeature
(
feature
)
entity
.
hasFeature
(
feature
)
);
);
return
Promise
.
all
(
promises
);
const
result
=
await
Promise
.
all
(
promises
);
}).
then
(
result
=>
f
.
filter
(
f
.
isObject
,
result
)
);
return
f
.
filter
(
f
.
isObject
,
result
);
},
},
/**
/**
...
@@ -585,21 +582,18 @@ converse.plugins.add('converse-disco', {
...
@@ -585,21 +582,18 @@ converse.plugins.add('converse-disco', {
* @example
* @example
* await _converse.api.disco.refreshFeatures('room@conference.example.org');
* await _converse.api.disco.refreshFeatures('room@conference.example.org');
*/
*/
'
refreshFeatures
'
(
jid
)
{
async
'
refreshFeatures
'
(
jid
)
{
if
(
_
.
isNil
(
jid
))
{
if
(
_
.
isNil
(
jid
))
{
throw
new
TypeError
(
'
api.disco.refreshFeatures: You need to provide an entity JID
'
);
throw
new
TypeError
(
'
api.disco.refreshFeatures: You need to provide an entity JID
'
);
}
}
return
_converse
.
api
.
waitUntil
(
'
discoInitialized
'
)
await
_converse
.
api
.
waitUntil
(
'
discoInitialized
'
);
.
then
(()
=>
_converse
.
api
.
disco
.
entities
.
get
(
jid
,
true
))
const
entity
=
await
_converse
.
api
.
disco
.
entities
.
get
(
jid
,
true
);
.
then
(
entity
=>
{
entity
.
features
.
reset
();
entity
.
features
.
reset
();
entity
.
fields
.
reset
();
entity
.
fields
.
reset
();
entity
.
identities
.
reset
();
entity
.
identities
.
reset
();
entity
.
waitUntilFeaturesDiscovered
=
utils
.
getResolveablePromise
()
entity
.
waitUntilFeaturesDiscovered
=
utils
.
getResolveablePromise
()
entity
.
queryInfo
();
entity
.
queryInfo
();
return
entity
.
waitUntilFeaturesDiscovered
;
return
entity
.
waitUntilFeaturesDiscovered
;
})
.
catch
(
_
.
partial
(
_converse
.
log
,
_
,
Strophe
.
LogLevel
.
FATAL
));
},
},
/**
/**
...
@@ -611,15 +605,14 @@ converse.plugins.add('converse-disco', {
...
@@ -611,15 +605,14 @@ converse.plugins.add('converse-disco', {
* @example
* @example
* const features = await _converse.api.disco.getFeatures('room@conference.example.org');
* const features = await _converse.api.disco.getFeatures('room@conference.example.org');
*/
*/
'
getFeatures
'
(
jid
)
{
async
'
getFeatures
'
(
jid
)
{
if
(
_
.
isNil
(
jid
))
{
if
(
_
.
isNil
(
jid
))
{
throw
new
TypeError
(
'
api.disco.getFeatures: You need to provide an entity JID
'
);
throw
new
TypeError
(
'
api.disco.getFeatures: You need to provide an entity JID
'
);
}
}
return
_converse
.
api
.
waitUntil
(
'
discoInitialized
'
)
await
_converse
.
api
.
waitUntil
(
'
discoInitialized
'
);
.
then
(()
=>
_converse
.
api
.
disco
.
entities
.
get
(
jid
,
true
))
let
entity
=
await
_converse
.
api
.
disco
.
entities
.
get
(
jid
,
true
);
.
then
(
entity
=>
entity
.
waitUntilFeaturesDiscovered
)
entity
=
await
entity
.
waitUntilFeaturesDiscovered
;
.
then
(
entity
=>
entity
.
features
)
return
entity
.
features
;
.
catch
(
_
.
partial
(
_converse
.
log
,
_
,
Strophe
.
LogLevel
.
FATAL
));
},
},
/**
/**
...
@@ -633,15 +626,14 @@ converse.plugins.add('converse-disco', {
...
@@ -633,15 +626,14 @@ converse.plugins.add('converse-disco', {
* @example
* @example
* const fields = await _converse.api.disco.getFields('room@conference.example.org');
* const fields = await _converse.api.disco.getFields('room@conference.example.org');
*/
*/
'
getFields
'
(
jid
)
{
async
'
getFields
'
(
jid
)
{
if
(
_
.
isNil
(
jid
))
{
if
(
_
.
isNil
(
jid
))
{
throw
new
TypeError
(
'
api.disco.getFields: You need to provide an entity JID
'
);
throw
new
TypeError
(
'
api.disco.getFields: You need to provide an entity JID
'
);
}
}
return
_converse
.
api
.
waitUntil
(
'
discoInitialized
'
)
await
_converse
.
api
.
waitUntil
(
'
discoInitialized
'
);
.
then
(()
=>
_converse
.
api
.
disco
.
entities
.
get
(
jid
,
true
))
let
entity
=
await
_converse
.
api
.
disco
.
entities
.
get
(
jid
,
true
);
.
then
(
entity
=>
entity
.
waitUntilFeaturesDiscovered
)
entity
=
await
entity
.
waitUntilFeaturesDiscovered
;
.
then
(
entity
=>
entity
.
fields
)
return
entity
.
fields
;
.
catch
(
_
.
partial
(
_converse
.
log
,
_
,
Strophe
.
LogLevel
.
FATAL
));
},
},
/**
/**
...
@@ -675,8 +667,9 @@ converse.plugins.add('converse-disco', {
...
@@ -675,8 +667,9 @@ converse.plugins.add('converse-disco', {
* }
* }
* ).catch(_.partial(_converse.log, _, Strophe.LogLevel.FATAL));
* ).catch(_.partial(_converse.log, _, Strophe.LogLevel.FATAL));
*/
*/
'
getIdentity
'
(
category
,
type
,
jid
)
{
async
'
getIdentity
'
(
category
,
type
,
jid
)
{
return
_converse
.
api
.
disco
.
entities
.
get
(
jid
,
true
).
then
(
e
=>
e
.
getIdentity
(
category
,
type
));
const
e
=
await
_converse
.
api
.
disco
.
entities
.
get
(
jid
,
true
);
return
e
.
getIdentity
(
category
,
type
);
}
}
}
}
});
});
...
...
src/headless/converse-muc.js
View file @
37f43989
...
@@ -109,20 +109,18 @@ converse.plugins.add('converse-muc', {
...
@@ -109,20 +109,18 @@ converse.plugins.add('converse-muc', {
_converse
.
api
.
promises
.
add
([
'
roomsAutoJoined
'
]);
_converse
.
api
.
promises
.
add
([
'
roomsAutoJoined
'
]);
function
openRoom
(
jid
)
{
async
function
openRoom
(
jid
)
{
if
(
!
u
.
isValidMUCJID
(
jid
))
{
if
(
!
u
.
isValidMUCJID
(
jid
))
{
return
_converse
.
log
(
return
_converse
.
log
(
`Invalid JID "
${
jid
}
" provided in URL fragment`
,
`Invalid JID "
${
jid
}
" provided in URL fragment`
,
Strophe
.
LogLevel
.
WARN
Strophe
.
LogLevel
.
WARN
);
);
}
}
const
promises
=
[
_converse
.
api
.
waitUntil
(
'
roomsAutoJoined
'
)]
await
_converse
.
api
.
waitUntil
(
'
roomsAutoJoined
'
);
if
(
_converse
.
allow_bookmarks
)
{
if
(
_converse
.
allow_bookmarks
)
{
promises
.
push
(
_converse
.
api
.
waitUntil
(
'
bookmarksInitialized
'
)
);
await
_converse
.
api
.
waitUntil
(
'
bookmarksInitialized
'
);
}
}
Promise
.
all
(
promises
).
then
(()
=>
{
_converse
.
api
.
rooms
.
open
(
jid
);
_converse
.
api
.
rooms
.
open
(
jid
);
});
}
}
_converse
.
router
.
route
(
'
converse/room?jid=:jid
'
,
openRoom
);
_converse
.
router
.
route
(
'
converse/room?jid=:jid
'
,
openRoom
);
...
@@ -762,7 +760,7 @@ converse.plugins.add('converse-muc', {
...
@@ -762,7 +760,7 @@ converse.plugins.add('converse-muc', {
}
}
},
},
checkForReservedNick
()
{
async
checkForReservedNick
()
{
/* Use service-discovery to ask the XMPP server whether
/* Use service-discovery to ask the XMPP server whether
* this user has a reserved nickname for this groupchat.
* this user has a reserved nickname for this groupchat.
* If so, we'll use that, otherwise we render the nickname form.
* If so, we'll use that, otherwise we render the nickname form.
...
@@ -771,7 +769,7 @@ converse.plugins.add('converse-muc', {
...
@@ -771,7 +769,7 @@ converse.plugins.add('converse-muc', {
* (Function) callback: Callback upon succesful IQ response
* (Function) callback: Callback upon succesful IQ response
* (Function) errback: Callback upon error IQ response
* (Function) errback: Callback upon error IQ response
*/
*/
return
_converse
.
api
.
sendIQ
(
const
iq
=
await
_converse
.
api
.
sendIQ
(
$iq
({
$iq
({
'
to
'
:
this
.
get
(
'
jid
'
),
'
to
'
:
this
.
get
(
'
jid
'
),
'
from
'
:
_converse
.
connection
.
jid
,
'
from
'
:
_converse
.
connection
.
jid
,
...
@@ -780,7 +778,7 @@ converse.plugins.add('converse-muc', {
...
@@ -780,7 +778,7 @@ converse.plugins.add('converse-muc', {
'
xmlns
'
:
Strophe
.
NS
.
DISCO_INFO
,
'
xmlns
'
:
Strophe
.
NS
.
DISCO_INFO
,
'
node
'
:
'
x-roomuser-item
'
'
node
'
:
'
x-roomuser-item
'
})
})
)
.
then
(
iq
=>
{
)
;
const
identity_el
=
iq
.
querySelector
(
'
query[node="x-roomuser-item"] identity
'
),
const
identity_el
=
iq
.
querySelector
(
'
query[node="x-roomuser-item"] identity
'
),
nick
=
identity_el
?
identity_el
.
getAttribute
(
'
name
'
)
:
null
;
nick
=
identity_el
?
identity_el
.
getAttribute
(
'
name
'
)
:
null
;
this
.
save
({
this
.
save
({
...
@@ -788,7 +786,6 @@ converse.plugins.add('converse-muc', {
...
@@ -788,7 +786,6 @@ converse.plugins.add('converse-muc', {
'
nick
'
:
nick
'
nick
'
:
nick
},
{
'
silent
'
:
true
});
},
{
'
silent
'
:
true
});
return
iq
;
return
iq
;
});
},
},
async
registerNickname
()
{
async
registerNickname
()
{
...
@@ -939,7 +936,7 @@ converse.plugins.add('converse-muc', {
...
@@ -939,7 +936,7 @@ converse.plugins.add('converse-muc', {
}
}
},
},
onMessage
(
stanza
)
{
async
onMessage
(
stanza
)
{
/* Handler for all MUC messages sent to this groupchat.
/* Handler for all MUC messages sent to this groupchat.
*
*
* Parameters:
* Parameters:
...
@@ -968,9 +965,8 @@ converse.plugins.add('converse-muc', {
...
@@ -968,9 +965,8 @@ converse.plugins.add('converse-muc', {
const
subject
=
_
.
propertyOf
(
subject_el
)(
'
textContent
'
)
||
''
;
const
subject
=
_
.
propertyOf
(
subject_el
)(
'
textContent
'
)
||
''
;
u
.
safeSave
(
this
,
{
'
subject
'
:
{
'
author
'
:
sender
,
'
text
'
:
subject
}});
u
.
safeSave
(
this
,
{
'
subject
'
:
{
'
author
'
:
sender
,
'
text
'
:
subject
}});
}
}
this
.
createMessage
(
stanza
,
original_stanza
)
const
msg
=
await
this
.
createMessage
(
stanza
,
original_stanza
);
.
then
(
msg
=>
this
.
incrementUnreadMsgCounter
(
msg
))
this
.
incrementUnreadMsgCounter
(
msg
);
.
catch
(
_
.
partial
(
_converse
.
log
,
_
,
Strophe
.
LogLevel
.
FATAL
));
}
}
if
(
sender
!==
this
.
get
(
'
nick
'
))
{
if
(
sender
!==
this
.
get
(
'
nick
'
))
{
// We only emit an event if it's not our own message
// We only emit an event if it's not our own message
...
@@ -1141,9 +1137,8 @@ converse.plugins.add('converse-muc', {
...
@@ -1141,9 +1137,8 @@ converse.plugins.add('converse-muc', {
}
}
},
},
fetchMembers
()
{
async
fetchMembers
()
{
this
.
chatroom
.
getJidsWithAffiliations
([
'
member
'
,
'
owner
'
,
'
admin
'
])
const
new_members
=
await
this
.
chatroom
.
getJidsWithAffiliations
([
'
member
'
,
'
owner
'
,
'
admin
'
]);
.
then
(
new_members
=>
{
const
new_jids
=
new_members
.
map
(
m
=>
m
.
jid
).
filter
(
m
=>
!
_
.
isUndefined
(
m
)),
const
new_jids
=
new_members
.
map
(
m
=>
m
.
jid
).
filter
(
m
=>
!
_
.
isUndefined
(
m
)),
new_nicks
=
new_members
.
map
(
m
=>
!
m
.
jid
&&
m
.
nick
||
undefined
).
filter
(
m
=>
!
_
.
isUndefined
(
m
)),
new_nicks
=
new_members
.
map
(
m
=>
!
m
.
jid
&&
m
.
nick
||
undefined
).
filter
(
m
=>
!
_
.
isUndefined
(
m
)),
removed_members
=
this
.
filter
(
m
=>
{
removed_members
=
this
.
filter
(
m
=>
{
...
@@ -1171,7 +1166,6 @@ converse.plugins.add('converse-muc', {
...
@@ -1171,7 +1166,6 @@ converse.plugins.add('converse-muc', {
this
.
create
(
attrs
);
this
.
create
(
attrs
);
}
}
});
});
}).
catch
(
_
.
partial
(
_converse
.
log
,
_
,
Strophe
.
LogLevel
.
ERROR
));
},
},
findOccupant
(
data
)
{
findOccupant
(
data
)
{
...
...
src/headless/utils/core.js
View file @
37f43989
...
@@ -333,14 +333,6 @@ u.replaceCurrentWord = function (input, new_value) {
...
@@ -333,14 +333,6 @@ u.replaceCurrentWord = function (input, new_value) {
input
.
selectionEnd
=
cursor
-
current_word
.
length
+
new_value
.
length
+
1
;
input
.
selectionEnd
=
cursor
-
current_word
.
length
+
new_value
.
length
+
1
;
};
};
u
.
isVisible
=
function
(
el
)
{
if
(
u
.
hasClass
(
'
hidden
'
,
el
))
{
return
false
;
}
// XXX: Taken from jQuery's "visible" implementation
return
el
.
offsetWidth
>
0
||
el
.
offsetHeight
>
0
||
el
.
getClientRects
().
length
>
0
;
};
u
.
triggerEvent
=
function
(
el
,
name
,
type
=
"
Event
"
,
bubbles
=
true
,
cancelable
=
true
)
{
u
.
triggerEvent
=
function
(
el
,
name
,
type
=
"
Event
"
,
bubbles
=
true
,
cancelable
=
true
)
{
const
evt
=
document
.
createEvent
(
type
);
const
evt
=
document
.
createEvent
(
type
);
evt
.
initEvent
(
name
,
bubbles
,
cancelable
);
evt
.
initEvent
(
name
,
bubbles
,
cancelable
);
...
...
src/templates/alert.html
View file @
37f43989
<div
class=
"alert {{{o.type}}}"
role=
"alert"
>
{{{o.message}}}
</div>
<div
class=
"alert {{{o.type}}}"
role=
"alert"
>
<p>
{{{o.message}}}
</p>
</div>
src/utils/html.js
View file @
37f43989
...
@@ -500,6 +500,15 @@ function afterAnimationEnds (el, callback) {
...
@@ -500,6 +500,15 @@ function afterAnimationEnds (el, callback) {
}
}
}
}
u
.
isVisible
=
function
(
el
)
{
if
(
u
.
hasClass
(
'
hidden
'
,
el
))
{
return
false
;
}
// XXX: Taken from jQuery's "visible" implementation
return
el
.
offsetWidth
>
0
||
el
.
offsetHeight
>
0
||
el
.
getClientRects
().
length
>
0
;
};
u
.
fadeIn
=
function
(
el
,
callback
)
{
u
.
fadeIn
=
function
(
el
,
callback
)
{
if
(
_
.
isNil
(
el
))
{
if
(
_
.
isNil
(
el
))
{
logger
.
warn
(
"
Undefined or null element passed into fadeIn
"
);
logger
.
warn
(
"
Undefined or null element passed into fadeIn
"
);
...
...
tests/runner.js
View file @
37f43989
...
@@ -179,7 +179,6 @@ require.config(config);
...
@@ -179,7 +179,6 @@ require.config(config);
var
specs
=
[
var
specs
=
[
"
jasmine
"
,
"
jasmine
"
,
//"spec/transcripts",
//"spec/transcripts",
//"spec/otr",
"
spec/spoilers
"
,
"
spec/spoilers
"
,
"
spec/profiling
"
,
"
spec/profiling
"
,
"
spec/utils
"
,
"
spec/utils
"
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment