Add limit warning in pad2

pull/1/head
yflory 7 years ago
parent 30aef71603
commit 140c6f3776

@ -1314,6 +1314,7 @@ define([
'image/jpg', 'image/jpg',
'image/gif', 'image/gif',
]; ];
// SFRAME: copied to sframe-common-interface.js
common.displayAvatar = function ($container, href, name, cb) { common.displayAvatar = function ($container, href, name, cb) {
var MutationObserver = window.MutationObserver; var MutationObserver = window.MutationObserver;
var displayDefault = function () { var displayDefault = function () {

@ -71,6 +71,12 @@ define([
}); });
}; };
funcs.isOverPinLimit = function (cb) {
ctx.sframeChan.query('Q_GET_PIN_LIMIT_STATUS', null, function (err, data) {
cb(data.error, data.overLimit, data.limits);
});
};
/* funcs.storeLinkToClipboard = function (readOnly, cb) { /* funcs.storeLinkToClipboard = function (readOnly, cb) {
ctx.sframeChan.query('Q_STORE_LINK_TO_CLIPBOARD', readOnly, function (err) { ctx.sframeChan.query('Q_STORE_LINK_TO_CLIPBOARD', readOnly, function (err) {
if (cb) { cb(err); } if (cb) { cb(err); }

@ -57,4 +57,9 @@ define({
// Use anonymous rpc from inside the iframe (for avatars & pin usage) // Use anonymous rpc from inside the iframe (for avatars & pin usage)
'Q_ANON_RPC_MESSAGE': true, 'Q_ANON_RPC_MESSAGE': true,
// Check the pin limit to determine if we can store the pad in the drive or if we should
// display a warning
'Q_GET_PIN_LIMIT_STATUS': true,
}); });

@ -698,7 +698,7 @@ define([
}); });
} }
}; };
Cryptpad.isOverPinLimit(todo); Common.isOverPinLimit(todo);
return $limit; return $limit;
}; };

@ -471,7 +471,7 @@ define([
var titleCfg = { getHeadingText: getHeadingText }; var titleCfg = { getHeadingText: getHeadingText };
Title = common.createTitle(titleCfg, realtimeOptions.onLocal, common, cpNfInner.metadataMgr); Title = common.createTitle(titleCfg, realtimeOptions.onLocal, common, cpNfInner.metadataMgr);
var configTb = { var configTb = {
displayed: ['userlist', 'title', 'useradmin', 'spinner', 'newpad', 'share'], displayed: ['userlist', 'title', 'useradmin', 'spinner', 'newpad', 'share', 'limit'],
title: Title.getTitleConfig(), title: Title.getTitleConfig(),
metadataMgr: cpNfInner.metadataMgr, metadataMgr: cpNfInner.metadataMgr,
readOnly: readOnly, readOnly: readOnly,

@ -118,6 +118,16 @@ define([
cb(); cb();
}); });
sframeChan.on('Q_GET_PIN_LIMIT_STATUS', function (data, cb) {
Cryptpad.isOverPinLimit(function (e, overLimit, limits) {
cb({
error: e,
overLimit: overLimit,
limits: limits
});
});
});
CpNfOuter.start({ CpNfOuter.start({
sframeChan: sframeChan, sframeChan: sframeChan,
channel: secret.channel, channel: secret.channel,

Loading…
Cancel
Save