Fix premium plan detection
parent
844a6a4b96
commit
0b7844b523
|
@ -344,6 +344,10 @@ define([
|
|||
};
|
||||
|
||||
var createContextMenu = function (common) {
|
||||
var metadataMgr = common.getMetadataMgr();
|
||||
var priv = metadataMgr.getPrivateData();
|
||||
|
||||
APP.premiumPlan = priv.plan;
|
||||
var getOpenIn = function (app) {
|
||||
var icon = AppConfig.applicationsIcon[app];
|
||||
var cls = icon.indexOf('cptools') === 0 ? 'cptools '+icon : 'fa '+icon;
|
||||
|
@ -4353,10 +4357,6 @@ define([
|
|||
Access.getAccessModal(common, opts, cb);
|
||||
};
|
||||
|
||||
if (!APP.loggedIn) {
|
||||
$contextMenu.find('.cp-app-drive-context-delete').attr('data-icon', faDelete)
|
||||
.html($contextMenu.find('.cp-app-drive-context-remove').html());
|
||||
}
|
||||
var deleteOwnedPaths = function (paths, pathsList) {
|
||||
pathsList = pathsList || [];
|
||||
if (paths) {
|
||||
|
@ -4421,7 +4421,7 @@ define([
|
|||
openIn(app, path, APP.team, _simpleData);
|
||||
};
|
||||
|
||||
$contextMenu.on("click", "a", function(e) {
|
||||
var addContextEvent = function () { $contextMenu.on("click", "a", function(e) {
|
||||
e.stopPropagation();
|
||||
var paths = $contextMenu.data('paths');
|
||||
var pathsList = [];
|
||||
|
@ -4840,8 +4840,22 @@ define([
|
|||
APP.selectedFiles = paths[0].path.slice(-1);
|
||||
}
|
||||
APP.hideMenu();
|
||||
})};
|
||||
|
||||
metadataMgr.onChange(function () {
|
||||
var priv = metadataMgr.getPrivateData();
|
||||
if (priv.plan !== APP.premiumPlan) {
|
||||
$contextMenu.remove();
|
||||
$contextMenu = createContextMenu(common).appendTo($appContainer);
|
||||
if (!APP.loggedIn) {
|
||||
$contextMenu.find('.cp-app-drive-context-delete').attr('data-icon', faDelete)
|
||||
.html($contextMenu.find('.cp-app-drive-context-remove').html());
|
||||
}
|
||||
addContextEvent();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// Chrome considers the double-click means "select all" in the window
|
||||
$content.on('mousedown', function (e) {
|
||||
$content.focus();
|
||||
|
|
|
@ -657,7 +657,7 @@ define([
|
|||
accountName: proxy.login_name || '',
|
||||
offline: store.proxy && store.offline,
|
||||
teams: teams,
|
||||
plan: account.plan,
|
||||
plan: store.ready ? (account.plan || '') : undefined,
|
||||
}
|
||||
};
|
||||
cb(JSON.parse(JSON.stringify(metadata)));
|
||||
|
|
|
@ -676,7 +676,7 @@ define([
|
|||
}
|
||||
|
||||
var priv = metaObj.priv;
|
||||
var _plan = priv.offline ? Utils.LocalStore.getPremium() : priv.plan;
|
||||
var _plan = typeof(priv.plan) === "undefined" ? Utils.LocalStore.getPremium() : priv.plan;
|
||||
var p = Utils.Util.checkRestrictedApp(parsed.type, AppConfig,
|
||||
Utils.Constants.earlyAccessApps, _plan, additionalPriv.loggedIn);
|
||||
if (p === 0 || p === -1) {
|
||||
|
|
Loading…
Reference in New Issue