Skip to content

Commit

Permalink
small fix for consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
marcomura committed Feb 6, 2025
1 parent d5db8ae commit 4e7a81f
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 36 deletions.
38 changes: 23 additions & 15 deletions src/webviews/components/issue/CreateIssuePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ const IconValue = (props: any) => (
export default class CreateIssuePage extends AbstractIssueEditorPage<Emit, Accept, {}, ViewState> {
private advancedFields: FieldUI[] = [];
private commonFields: FieldUI[] = [];
private attachingInProgress: boolean;

getProjectKey(): string {
return this.state.fieldValues['project'].key;
Expand Down Expand Up @@ -191,22 +192,29 @@ export default class CreateIssuePage extends AbstractIssueEditorPage<Emit, Accep
};

protected handleInlineAttachments = async (fieldkey: string, newValue: any) => {
if (this.attachingInProgress) {
return;
}

if (Array.isArray(newValue) && newValue.length > 0) {
readFilesContentAsync(newValue).then((filesWithContent) => {
const serFiles = filesWithContent.map((file) => {
return {
lastModified: file.lastModified,
lastModifiedDate: (file as any).lastModifiedDate,
name: file.name,
size: file.size,
type: file.type,
path: (file as any).path,
fileContent: file.fileContent,
};
});

this.setState({ fieldValues: { ...this.state.fieldValues, ...{ [fieldkey]: serFiles } } });
});
this.attachingInProgress = true;
readFilesContentAsync(newValue)
.then((filesWithContent) => {
const serFiles = filesWithContent.map((file) => {
return {
lastModified: file.lastModified,
lastModifiedDate: (file as any).lastModifiedDate,
name: file.name,
size: file.size,
type: file.type,
path: (file as any).path,
fileContent: file.fileContent,
};
});

this.setState({ fieldValues: { ...this.state.fieldValues, ...{ [fieldkey]: serFiles } } });
})
.finally(() => this.attachingInProgress = false);

Check failure on line 217 in src/webviews/components/issue/CreateIssuePage.tsx

View workflow job for this annotation

GitHub Actions / build

Replace `this.attachingInProgress·=·false` with `(this.attachingInProgress·=·false)`
}
};

Expand Down
43 changes: 22 additions & 21 deletions src/webviews/components/issue/JiraIssuePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -392,27 +392,28 @@ export default class JiraIssuePage extends AbstractIssueEditorPage<Emit, Accept,
}
this.attachingInProgress = true;

readFilesContentAsync(files).then((filesWithContent) => {
this.setState({ currentInlineDialog: '', isSomethingLoading: false, loadingField: 'attachment' });
const serFiles = filesWithContent.map((file) => {
return {
lastModified: file.lastModified,
lastModifiedDate: (file as any).lastModifiedDate,
name: file.name,
size: file.size,
type: file.type,
path: (file as any).path,
fileContent: file.fileContent,
};
});
this.postMessage({
action: 'addAttachments',
site: this.state.siteDetails,
issueKey: this.state.key,
files: serFiles,
});
this.attachingInProgress = false;
});
readFilesContentAsync(files)
.then((filesWithContent) => {
this.setState({ currentInlineDialog: '', isSomethingLoading: false, loadingField: 'attachment' });
const serFiles = filesWithContent.map((file) => {
return {
lastModified: file.lastModified,
lastModifiedDate: (file as any).lastModifiedDate,
name: file.name,
size: file.size,
type: file.type,
path: (file as any).path,
fileContent: file.fileContent,
};
});
this.postMessage({
action: 'addAttachments',
site: this.state.siteDetails,
issueKey: this.state.key,
files: serFiles,
});
})
.finally(() => this.attachingInProgress = false);

Check failure on line 416 in src/webviews/components/issue/JiraIssuePage.tsx

View workflow job for this annotation

GitHub Actions / build

Replace `this.attachingInProgress·=·false` with `(this.attachingInProgress·=·false)`
};

handleDeleteAttachment = (file: any) => {
Expand Down

0 comments on commit 4e7a81f

Please sign in to comment.