Fix join team for anon users

pull/1/head
yflory 5 years ago
parent 8eed376274
commit a817242fe5

@ -779,6 +779,11 @@ define([
postMessage("SEND_FRIEND_REQUEST", data, cb); postMessage("SEND_FRIEND_REQUEST", data, cb);
}; };
// Team
common.anonGetPreviewContent = function (data, cb) {
postMessage("ANON_GET_PREVIEW_CONTENT", data, cb);
};
// Onlyoffice // Onlyoffice
var onlyoffice = common.onlyoffice = {}; var onlyoffice = common.onlyoffice = {};
onlyoffice.execCommand = function (data, cb) { onlyoffice.execCommand = function (data, cb) {

@ -1273,6 +1273,12 @@ define([
}); });
}; };
Store.anonGetPreviewContent = function (clientId, data, cb) {
Team.anonGetPreviewContent({
store: store
}, data, cb);
};
// Get hashes for the share button // Get hashes for the share button
// If we can find a stronger hash // If we can find a stronger hash
Store.getStrongerHash = function (clientId, data, _cb) { Store.getStrongerHash = function (clientId, data, _cb) {

@ -60,6 +60,8 @@ define([
// Messaging // Messaging
ANSWER_FRIEND_REQUEST: Store.answerFriendRequest, ANSWER_FRIEND_REQUEST: Store.answerFriendRequest,
SEND_FRIEND_REQUEST: Store.sendFriendRequest, SEND_FRIEND_REQUEST: Store.sendFriendRequest,
// Team invitation
ANON_GET_PREVIEW_CONTENT: Store.anonGetPreviewContent,
// OnlyOffice // OnlyOffice
OO_COMMAND: Store.onlyoffice.execCommand, OO_COMMAND: Store.onlyoffice.execCommand,
// Cursor // Cursor

@ -1684,6 +1684,10 @@ define([
return team; return team;
}; };
Team.anonGetPreviewContent = function (cfg, data, cb) {
getPreviewContent(cfg, data, null, cb);
};
return Team; return Team;
}); });

@ -675,6 +675,10 @@ define([
Cryptpad.messaging.answerFriendRequest(data, cb); Cryptpad.messaging.answerFriendRequest(data, cb);
}); });
sframeChan.on('Q_ANON_GET_PREVIEW_CONTENT', function (data, cb) {
Cryptpad.anonGetPreviewContent(data, cb);
});
// History // History
sframeChan.on('Q_GET_FULL_HISTORY', function (data, cb) { sframeChan.on('Q_GET_FULL_HISTORY', function (data, cb) {
var crypto = Crypto.createEncryptor(secret.keys); var crypto = Crypto.createEncryptor(secret.keys);

@ -1149,8 +1149,18 @@ define([
}; };
nThen(function (waitFor) { nThen(function (waitFor) {
// XXX XXX Check number of teams first! // Get preview content.
APP.module.execCommand("GET_PREVIEW_CONTENT", { // Use the team module if we're logged in, or sframeChan if we're not
var f = function (data, cb) {
if (driveAPP.loggedIn) {
return void APP.module.execCommand('GET_PREVIEW_CONTENT', data, cb);
}
var sframeChan = common.getSframeChannel();
sframeChan.query('Q_ANON_GET_PREVIEW_CONTENT', data, function (err, json) {
cb(json);
});
};
f({
seeds: seeds, seeds: seeds,
}, waitFor(function (json) { }, waitFor(function (json) {
if (json && json.error) { // XXX this is failing with "team is disabled" if (json && json.error) { // XXX this is failing with "team is disabled"

Loading…
Cancel
Save