Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Take changelog from remote if provided #12455

Merged
merged 2 commits into from
Sep 27, 2016
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
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ export interface IGalleryExtensionProperties {
export interface IGalleryExtensionAssets {
manifest: string;
readme: string;
changelog: string;
download: string;
icon: string;
iconFallback: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ enum FilterType {
const AssetType = {
Icon: 'Microsoft.VisualStudio.Services.Icons.Default',
Details: 'Microsoft.VisualStudio.Services.Content.Details',
Changelog: 'Microsoft.VisualStudio.Services.Content.Changelog',
Manifest: 'Microsoft.VisualStudio.Code.Manifest',
VSIX: 'Microsoft.VisualStudio.Services.VSIXPackage',
License: 'Microsoft.VisualStudio.Services.Content.License',
Expand Down Expand Up @@ -223,6 +224,7 @@ function toExtension(galleryExtension: IRawGalleryExtension, extensionsGalleryUr
const assets = {
manifest: getAssetSource(version.files, AssetType.Manifest),
readme: getAssetSource(version.files, AssetType.Details),
changelog: getAssetSource(version.files, AssetType.Changelog),
download: `${ getAssetSource(version.files, AssetType.VSIX) }?install=true`,
icon,
iconFallback,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,20 +96,20 @@ class Extension implements IExtension {
return this.local ? this.local.manifest.description : this.gallery.description;
}

get readmeUrl(): string {
private get readmeUrl(): string {
if (this.local && this.local.readmeUrl) {
return this.local.readmeUrl;
}

return this.gallery && this.gallery.assets.readme;
}

get changelogUrl(): string {
private get changelogUrl(): string {
if (this.local && this.local.changelogUrl) {
return this.local.changelogUrl;
}

return ''; // Hopefully we will change this once the gallery will support that.
return this.gallery && this.gallery.assets.changelog;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was the wrong place. You should do it in the hasChangelog and getChangelog. While you're at it, just delete the readmeUrl and changelogUrl; the former was an old implementation which I forgot to delete.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually no...

Make those two getters private and use them in the getReadme and getChangelog methods to get a hold of the URL.

}

get iconUrl(): string {
Expand Down Expand Up @@ -200,7 +200,7 @@ class Extension implements IExtension {
}

getReadme(): TPromise<string> {
const readmeUrl = this.local && this.local.readmeUrl ? this.local.readmeUrl : this.gallery && this.gallery.assets.readme;
const readmeUrl = this.readmeUrl;

if (!readmeUrl) {
return TPromise.wrapError('not available');
Expand All @@ -216,11 +216,11 @@ class Extension implements IExtension {
}

get hasChangelog() : boolean {
return !!(this.local && this.local.changelogUrl ? this.local.changelogUrl : '');
return !!(this.changelogUrl);
}

getChangelog() : TPromise<string> {
const changelogUrl = this.local && this.local.changelogUrl ? this.local.changelogUrl : '';
const changelogUrl = this.changelogUrl;

if (!changelogUrl) {
return TPromise.wrapError('not available');
Expand Down