group testing

This commit is contained in:
Martti Malmi 2020-04-28 14:43:53 +03:00
parent 98925f2225
commit f48b6c4fdb
2 changed files with 15 additions and 10 deletions

View File

@ -945,12 +945,18 @@ function showChat(pub) {
if (!iris.util.isMobile) { if (!iris.util.isMobile) {
$("#new-msg").focus(); $("#new-msg").focus();
} }
var setTypingThrottled = _.throttle(() => { var isTyping = false;
chats[pub].setTyping($('#new-msg').val().length > 0); var getIsTyping = () => $('#new-msg').val().length > 0;
}, 1000); var setTyping = () => chats[pub].setTyping(getIsTyping());
var setTypingThrottled = _.throttle(setTyping, 1000);
$('#new-msg').val(chats[pub].msgDraft); $('#new-msg').val(chats[pub].msgDraft);
$('#new-msg').off().on('input', () => { $('#new-msg').off().on('input', () => {
setTypingThrottled(); if (isTyping === getIsTyping()) {
setTypingThrottled();
} else {
setTyping();
}
isTyping = getIsTyping();
chats[pub].msgDraft = $('#new-msg').val(); chats[pub].msgDraft = $('#new-msg').val();
}); });
$(".message-form form").off().on('submit', event => { $(".message-form form").off().on('submit', event => {

View File

@ -7537,10 +7537,9 @@
} }
_Object$keys(participants).forEach(function (k) { _Object$keys(participants).forEach(function (k) {
if (k !== _this.key.pub) { if (k !== _this.key.pub) {
_this.addParticipant(k, false, _Object$assign({}, _this.DEFAULT_PERMISSIONS, participants[k])); _this.addParticipant(k, true, _Object$assign({}, _this.DEFAULT_PERMISSIONS, participants[k]));
} }
}); });
_this.save(); // forever loop?
saved = true; saved = true;
} }
} }
@ -7892,7 +7891,7 @@
} }
this.getSecret(pub); this.getSecret(pub);
var ourSecretChannelId = await this.getOurSecretChannelId(pub); var ourSecretChannelId = await this.getOurSecretChannelId(pub);
if (!this.uuid && save) { if (save) {
// Save their public key in encrypted format, so in channel listing we know who we are channeling with // Save their public key in encrypted format, so in channel listing we know who we are channeling with
var mySecret = await Gun.SEA.secret(this.key.epub, this.key); var mySecret = await Gun.SEA.secret(this.key.epub, this.key);
this.gun.user().get('chats').get(ourSecretChannelId).get('pub').put((await Gun.SEA.encrypt({ pub: pub }, mySecret))); this.gun.user().get('chats').get(ourSecretChannelId).get('pub').put((await Gun.SEA.encrypt({ pub: pub }, mySecret)));
@ -8141,7 +8140,7 @@
this.put('typing', isTyping ? new Date().toISOString() : false); this.put('typing', isTyping ? new Date().toISOString() : false);
clearTimeout(this.setTypingTimeout); clearTimeout(this.setTypingTimeout);
this.setTypingTimeout = setTimeout(function () { this.setTypingTimeout = setTimeout(function () {
return _this13.put('isTyping', false); return _this13.put('typing', false);
}, timeout); }, timeout);
}; };
@ -8154,7 +8153,7 @@
var _this14 = this; var _this14 = this;
var timeout = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 5; var timeout = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 5;
// TODO callback not called on setTyping(false), at least for self chat
timeout = timeout * 1000; timeout = timeout * 1000;
this.onTheir('typing', function (typing, key, pub) { this.onTheir('typing', function (typing, key, pub) {
if (callback) { if (callback) {
@ -10132,7 +10131,7 @@
return SocialNetwork; return SocialNetwork;
}(); }();
var version$1 = "0.0.144"; var version$1 = "0.0.145";
/*eslint no-useless-escape: "off", camelcase: "off" */ /*eslint no-useless-escape: "off", camelcase: "off" */