@converse/headless
Advanced tools
Comparing version 8.0.0 to 8.0.1
@@ -86,3 +86,3 @@ /** | ||
_converse.VERSION_NAME = "v8.0.0"; | ||
_converse.VERSION_NAME = "v8.0.1"; | ||
@@ -89,0 +89,0 @@ Object.assign(_converse, Events); |
{ | ||
"name": "@converse/headless", | ||
"version": "8.0.0", | ||
"version": "8.0.1", | ||
"description": "Converse.js Headless build", | ||
@@ -5,0 +5,0 @@ "author": "cmrd Senya <senya@riseup.net>", |
/** | ||
* @copyright 2020, the Converse.js contributors | ||
* @copyright The Converse.js contributors | ||
* @license Mozilla Public License (MPLv2) | ||
@@ -18,2 +18,13 @@ * @description This is the core utilities module. | ||
export function isEmptyMessage (attrs) { | ||
if (attrs instanceof Model) { | ||
attrs = attrs.attributes; | ||
} | ||
return !attrs['oob_url'] && | ||
!attrs['file'] && | ||
!(attrs['is_encrypted'] && attrs['plaintext']) && | ||
!attrs['message']; | ||
} | ||
/** | ||
@@ -129,3 +140,3 @@ * The utils object | ||
return attrs['retracted'] || // Retraction received *before* the message | ||
!u.isEmptyMessage(attrs); | ||
!isEmptyMessage(attrs); | ||
} | ||
@@ -137,41 +148,2 @@ | ||
u.isEmptyMessage = function (attrs) { | ||
if (attrs instanceof Model) { | ||
attrs = attrs.attributes; | ||
} | ||
return !attrs['oob_url'] && | ||
!attrs['file'] && | ||
!(attrs['is_encrypted'] && attrs['plaintext']) && | ||
!attrs['message']; | ||
}; | ||
//TODO: Remove | ||
u.isOnlyChatStateNotification = function (msg) { | ||
if (msg instanceof Element) { | ||
// See XEP-0085 Chat State Notification | ||
return (msg.querySelector('body') === null) && ( | ||
(msg.querySelector('active') !== null) || | ||
(msg.querySelector('composing') !== null) || | ||
(msg.querySelector('inactive') !== null) || | ||
(msg.querySelector('paused') !== null) || | ||
(msg.querySelector('gone') !== null)); | ||
} | ||
if (msg instanceof Model) { | ||
msg = msg.attributes; | ||
} | ||
return msg['chat_state'] && u.isEmptyMessage(msg); | ||
}; | ||
u.isOnlyMessageDeliveryReceipt = function (msg) { | ||
if (msg instanceof Element) { | ||
// See XEP-0184 Message Delivery Receipts | ||
return (msg.querySelector('body') === null) && | ||
(msg.querySelector('received') !== null); | ||
} | ||
if (msg instanceof Model) { | ||
msg = msg.attributes; | ||
} | ||
return msg['received'] && u.isEmptyMessage(msg); | ||
}; | ||
u.isChatRoom = function (model) { | ||
@@ -604,2 +576,4 @@ return model && (model.get('type') === 'chatroom'); | ||
export default u; | ||
export default Object.assign({ | ||
isEmptyMessage | ||
}, u); |
@@ -9,3 +9,3 @@ import URI from 'urijs'; | ||
window.location.protocol === 'http:' || | ||
(window.location.protocol === 'https:' && ['http', 'aesgcm'].includes(uri_protocol)) | ||
(window.location.protocol === 'https:' && ['https', 'aesgcm'].includes(uri_protocol)) | ||
); | ||
@@ -12,0 +12,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
5497123
334
5219
3
6