Skip to content

Commit

Permalink
Avoid duplicates in the other view Fixes #38269
Browse files Browse the repository at this point in the history
  • Loading branch information
ramya-rao-a committed Nov 14, 2017
1 parent 7094bb1 commit 5a9df66
Showing 1 changed file with 27 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,11 @@ export class ExtensionsListView extends ViewsViewletPanel {
.then(workspaceRecommendations => {
const names = this.getTrimmedRecommendations(installedExtensions, value, fileBasedRecommendations, others, workspaceRecommendations);

/* __GDPR__
"extensionAllRecommendations:open" : {
"count" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
}
*/
this.telemetryService.publicLog('extensionAllRecommendations:open', { count: names.length });
if (!names.length) {
return TPromise.as(new PagedModel([]));
Expand All @@ -320,28 +325,34 @@ export class ExtensionsListView extends ViewsViewletPanel {
return this.extensionsWorkbenchService.queryLocal()
.then(result => result.filter(e => e.type === LocalExtensionType.User))
.then(local => {
const installedExtensions = local.map(x => `${x.publisher}.${x.name}`);
let fileBasedRecommendations = this.tipsService.getFileBasedRecommendations();
let others = this.tipsService.getOtherRecommendations();

const installedExtensions = local.map(x => `${x.publisher}.${x.name}`);
return this.tipsService.getWorkspaceRecommendations()
.then(workspaceRecommendations => {
workspaceRecommendations = workspaceRecommendations.map(x => x.toLowerCase());
fileBasedRecommendations = fileBasedRecommendations.filter(x => workspaceRecommendations.indexOf(x.toLowerCase()) === -1);
others = others.filter(x => workspaceRecommendations.indexOf(x.toLowerCase()) === -1);

const names = this.getTrimmedRecommendations(installedExtensions, value, fileBasedRecommendations, others, []);
const names = this.getTrimmedRecommendations(installedExtensions, value, fileBasedRecommendations, others, []);

/* __GDPR__
"extensionRecommendations:open" : {
"count" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
}
*/
this.telemetryService.publicLog('extensionRecommendations:open', { count: names.length });
/* __GDPR__
"extensionRecommendations:open" : {
"count" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
}
*/
this.telemetryService.publicLog('extensionRecommendations:open', { count: names.length });

if (!names.length) {
return TPromise.as(new PagedModel([]));
}
options.source = 'recommendations';
return this.extensionsWorkbenchService.queryGallery(assign(options, { names, pageSize: names.length }))
.then(pager => {
this.sortFirstPage(pager, names);
return new PagedModel(pager || []);
if (!names.length) {
return TPromise.as(new PagedModel([]));
}
options.source = 'recommendations';
return this.extensionsWorkbenchService.queryGallery(assign(options, { names, pageSize: names.length }))
.then(pager => {
this.sortFirstPage(pager, names);
return new PagedModel(pager || []);
});
});
});
}
Expand Down

0 comments on commit 5a9df66

Please sign in to comment.