Use correct size format in features.js

pull/1/head
yflory 4 years ago
parent b22b75b826
commit 991e965a10

@ -1,12 +1,13 @@
define([
'jquery',
'/common/hyperscript.js',
'/common/common-util.js',
'/customize/messages.js',
'/customize/application_config.js',
'/common/outer/local-store.js',
'/customize/pages.js',
'/api/config',
], function ($, h, Msg, AppConfig, LocalStore, Pages, Config) {
], function ($, h, Util, Msg, AppConfig, LocalStore, Pages, Config) {
var accounts = {
donateURL: AppConfig.donateURL || "https://opencollective.com/cryptpad/",
upgradeURL: AppConfig.upgradeURL
@ -55,7 +56,7 @@ define([
};
SPECIAL_GROUP_ITEMS.storage1 = function (f) {
return groupItemTemplate(
Msg._getKey('features_f_' + f, [Config.defaultStorageLimit / 1024 / 1024]),
Msg._getKey('features_f_' + f, [Util.getPrettySize(Config.defaultStorageLimit)]),
Msg['features_f_' + f + '_note']
);
};

@ -272,6 +272,14 @@
else if (bytes >= oneMegabyte) { return 'MB'; }
};
Util.getPrettySize = function (bytes, Messages) {
var unit = Util.magnitudeOfBytes(bytes);
if (unit === 'GB') {
return Messages._getKey('formattedGB', [Util.bytesToGigabytes(bytes)]);
}
return Messages._getKey('formattedMB', [Util.bytesToMegabytes(bytes)]);
};
// given a path, asynchronously return an arraybuffer
var getCacheKey = function (src) {

Loading…
Cancel
Save