Skip to content

Commit

Permalink
[FIX] Updating an app via "Update" button errors out with "App alread…
Browse files Browse the repository at this point in the history
…y exists" (#15814)
  • Loading branch information
d-gubert authored and sampaiodiego committed Nov 19, 2019
1 parent 2289486 commit d688522
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/apps/client/admin/appManage.js
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ Template.appManage.events({
_app.set('working', true);

try {
const { status } = await Apps.installApp(appId, _app.get('marketplaceVersion'));
const { status } = await Apps.updateApp(appId, _app.get('marketplaceVersion'));
warnStatusChange(_app.get('name'), status);
} catch (error) {
handleAPIError(error);
Expand Down
3 changes: 1 addition & 2 deletions app/apps/client/admin/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -277,8 +277,7 @@ export const appButtonProps = ({
}) => {
const canUpdate = installed
&& version && marketplaceVersion
&& semver.lt(version, marketplaceVersion)
&& isPurchased;
&& semver.lt(version, marketplaceVersion);
if (canUpdate) {
return {
action: 'update',
Expand Down
9 changes: 9 additions & 0 deletions app/apps/client/orchestrator.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,15 @@ class AppClientOrchestrator {
return app;
}

updateApp = async (appId, version) => {
const { app } = await APIClient.post(`apps/${ appId }`, {
appId,
marketplace: true,
version,
});
return app;
}

uninstallApp = (appId) => APIClient.delete(`apps/${ appId }`)

syncApp = (appId) => APIClient.post(`apps/${ appId }/sync`)
Expand Down

0 comments on commit d688522

Please sign in to comment.