提交 7666a930 编写于 作者: J Joao Moreno

💄

上级 88c3cad7
......@@ -243,13 +243,14 @@ export class ExtensionManagementService implements IExtensionManagementService {
private rollback(localExtension: ILocalExtension, dependecies: IGalleryExtension[]): TPromise<void> {
return this.uninstall(localExtension)
.then(() => this.filterOutUnInstalled(dependecies))
.then(() => this.filterOutUninstalled(dependecies))
.then(installed => TPromise.join(installed.map((i) => this.uninstall(i))))
.then(() => null);
}
private filterOutInstalled(extensions: IGalleryExtension[]): TPromise<IGalleryExtension[]> {
return this.getInstalled().then(local => {
return this.getInstalled()
.then(local => {
return extensions.filter(extension => {
const extensionId = getExtensionId(extension, extension.version);
return local.every(local => local.id !== extensionId);
......@@ -257,12 +258,9 @@ export class ExtensionManagementService implements IExtensionManagementService {
});
}
private filterOutUnInstalled(extensions: IGalleryExtension[]): TPromise<ILocalExtension[]> {
return this.getInstalled().then(installed => {
return installed.filter(local => {
return !!this.getGalleryExtensionForLocalExtension(extensions, local);
});
});
private filterOutUninstalled(extensions: IGalleryExtension[]): TPromise<ILocalExtension[]> {
return this.getInstalled()
.then(installed => installed.filter(local => !!this.getGalleryExtensionForLocalExtension(extensions, local)));
}
private getGalleryExtensionForLocalExtension(galleryExtensions: IGalleryExtension[], localExtension: ILocalExtension): IGalleryExtension {
......@@ -277,6 +275,7 @@ export class ExtensionManagementService implements IExtensionManagementService {
publisherId: extension.publisherId,
publisherDisplayName: extension.publisherDisplayName,
};
return this.galleryService.download(extension)
.then(zipPath => validate(zipPath).then(() => zipPath))
.then(zipPath => this.installExtension(zipPath, id, metadata));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册