fix message ordering, add underscore.js for throttling

This commit is contained in:
Martti Malmi 2020-01-28 10:58:56 +02:00
parent c814ae0c38
commit 258f5bd37c
4 changed files with 15 additions and 6 deletions

View File

@ -554,10 +554,12 @@ function getIdenticon(pub, width) {
return el;
}
function sortChatsByLatest() {
var sorted = $(".chat-item").sort((a, b) => $(b).data('latestTime') - $(a).data('latestTime'));
var sortChatsByLatest = _.throttle(() => {
var sorted = $(".chat-item:not(.new)").sort((a, b) => {
return ($(b).data('latestTime') || -Infinity) - ($(a).data('latestTime') || -Infinity);
});
$(".chat-list").append(sorted);
}
}, 100);
function sortMessagesByTime() {
var sorted = $(".msg").sort((a, b) => $(a).data('time') - $(b).data('time'));

View File

@ -143,8 +143,8 @@
</ul>
<p>Released under MIT license. Code: <a href="https://github.com/irislib/iris-messenger">Github</a>.</p>
<h3>Privacy</h3>
<p>Messages are end-to-end encrypted, but message timestamps aren't. It is also possible, if not trivial, to find out who are communicating with each other by monitoring data subscriptions on the decentralized database.</p>
<p>Profile names and photos are currently public.</p>
<p>Messages are end-to-end encrypted, but message timestamps aren't. By looking at timestamps, it is possible to guess who are chatting with each other. It is also possible, if not trivial, to find out who are communicating with each other by monitoring data subscriptions on the decentralized database.</p>
<p>Profile names, photos and online status are currently public.</p>
</div>
<!-- Logout confirmation -->
@ -192,6 +192,7 @@
</div>
<script src="./jquery.js"></script>
<script src="./underscore-min.js"></script>
<script src="./gun.js"></script>
<script src="./sea.js"></script>
<script src="./nts.js"></script>

View File

@ -15,7 +15,8 @@ var urlsToCache = [
'nts.js',
'qrcode.min.js',
'sea.js',
'style.css'
'style.css',
'underscore-min.js'
];
self.addEventListener('install', function(event) {

5
src/underscore-min.js vendored Normal file

File diff suppressed because one or more lines are too long