yay, they talk and they don't fight

This commit is contained in:
Caleb James DeLisle
2017-08-10 18:31:44 +02:00
parent e786a66ff3
commit 1e56fa31c0
7 changed files with 99 additions and 43 deletions

View File

@@ -18,6 +18,34 @@ define([
}));
Cryptpad.ready(waitFor());
}).nThen(function (waitFor) {
var parsed = Cryptpad.parsePadUrl(window.location.href);
if (!parsed.type) { throw new Error(); }
var defaultTitle = Cryptpad.getDefaultName(parsed);
var updateMeta = function () {
console.log('EV_METADATA_UPDATE');
var name;
nThen(function (waitFor) {
Cryptpad.getLastName(waitFor(function (n) { name = n }));
}).nThen(function (waitFor) {
sframeChan.event('EV_METADATA_UPDATE', {
doc: {
defaultTitle: defaultTitle,
type: parsed.type
},
myID: Cryptpad.getNetwork().webChannels[0].myID,
user: {
name: name,
uid: Cryptpad.getUid(),
avatar: Cryptpad.getAvatarUrl(),
profile: Cryptpad.getProfileUrl(),
curvePublic: Cryptpad.getProxy().curvePublic
}
});
});
};
Cryptpad.onDisplayNameChanged(updateMeta);
sframeChan.onReg('EV_METADATA_UPDATE', updateMeta);
Cryptpad.onError(function (info) {
console.log('error');
console.log(info);