Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion app/apps/client/admin/appManage.js
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,8 @@ Template.appManage.events({
_app.set('working', true);

try {
const { status } = await Apps.updateApp(appId, _app.get('marketplaceVersion'));
const method = _app.get('installed') ? 'updateApp' : 'installApp';
const { status } = await Apps[method](appId, _app.get('marketplaceVersion'));
warnStatusChange(_app.get('name'), status);
} catch (error) {
handleAPIError(error);
Expand Down
7 changes: 6 additions & 1 deletion app/apps/client/admin/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ const appErroredStatuses = [
AppStatus.INVALID_LICENSE_DISABLED,
];

const subscriptionActiveStatuses = [
'trialing',
'active',
];

export const handleAPIError = (error) => {
console.error(error);
const message = (error.xhr && error.xhr.responseJSON && error.xhr.responseJSON.error) || error.message;
Expand Down Expand Up @@ -298,7 +303,7 @@ export const appButtonProps = ({
};
}

const canTrial = purchaseType === 'subscription' && !subscriptionInfo.status;
const canTrial = purchaseType === 'subscription' && !subscriptionActiveStatuses.includes(subscriptionInfo.status);
if (canTrial) {
return {
action: 'purchase',
Expand Down