Skip to content

Commit cb23e4b

Browse files
authored
allow users to delete project descriptions (#11113)
1 parent 8678494 commit cb23e4b

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

react-common/components/share/ShareInfo.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ export const ShareInfo = (props: ShareInfoProps) => {
386386
<Textarea
387387
ariaDescribedBy="share-description-title"
388388
ariaLabel={lf("Type a description for your project")}
389-
initialValue={description || projectDescription || ''}
389+
initialValue={description !== undefined ? description : (projectDescription || '')}
390390
onChange={setDescription}
391391
id="projectDescriptionTextareaShare"
392392
maxLength={pxt.MAX_DESCRIPTION_LENGTH}

webapp/src/app.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4456,7 +4456,7 @@ export class ProjectView
44564456

44574457
async publishAsync (name: string, description?: string,screenshotUri?: string, forceAnonymous?: boolean): Promise<pxt.editor.ShareData> {
44584458
pxt.tickEvent("menu.embed.publish", undefined, { interactiveConsent: true });
4459-
if ((name && this.state.projectName != name) || description) {
4459+
if ((name && this.state.projectName != name) || description !== undefined) {
44604460
await this.updateHeaderNameAsync(name, description);
44614461
}
44624462

@@ -4606,18 +4606,18 @@ export class ProjectView
46064606

46074607
updateHeaderNameAsync(name: string, description?: string): Promise<void> {
46084608
// nothing to do?
4609-
if (pkg.mainPkg.config.name == name && (!description || pkg.mainPkg.config.description == description))
4609+
if (pkg.mainPkg.config.name == name && (description === undefined || pkg.mainPkg.config.description == description))
46104610
return Promise.resolve();
46114611

46124612
//Save the name in the target MainPackage as well
46134613
pkg.mainPkg.config.name = name;
4614-
pkg.mainPkg.config.description = description || pkg.mainPkg.config.description;
4614+
pkg.mainPkg.config.description = description !== undefined ? description : pkg.mainPkg.config.description;
46154615

46164616
pxt.debug('saving project name to ' + name);
46174617
let f = pkg.mainEditorPkg().lookupFile("this/" + pxt.CONFIG_NAME);
46184618
let config = JSON.parse(f.content) as pxt.PackageConfig;
46194619
config.name = name;
4620-
config.description = description || config.description;
4620+
config.description = description !== undefined ? description : config.description;
46214621
return f.setContentAsync(pxt.Package.stringifyConfig(config))
46224622
.then(() => {
46234623
if (this.state.header)

0 commit comments

Comments
 (0)