Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Fix setting prepareAttachment when its not present

Oliver Günther70893d571835
diff --git a/frontend/.eslintrc.js b/frontend/.eslintrc.js
index 1a210dc2ebc..f25480bee9f 100644
--- a/frontend/.eslintrc.js
+++ b/frontend/.eslintrc.js
@@ -83,6 +83,9 @@ module.exports = {
// no param reassignment is a pain when trying to set props on elements
"no-param-reassign": "off",
+ // destructuring doesn't always look better, only when object/array destructuring
+ "prefer-destructuring": "off",
+
// No void at all collides with `@typescript-eslint/no-floating-promises` which wants us to handle each promise.
// Until we do that, `void` is a good way to explicitly mark unhandled promises.
"no-void": ["error", { allowAsStatement: true }],
diff --git a/frontend/src/app/shared/components/grids/widgets/custom-text/custom-text-edit-field.service.ts b/frontend/src/app/shared/components/grids/widgets/custom-text/custom-text-edit-field.service.ts
index 278ac4e42c3..437da1fef54 100644
--- a/frontend/src/app/shared/components/grids/widgets/custom-text/custom-text-edit-field.service.ts
+++ b/frontend/src/app/shared/components/grids/widgets/custom-text/custom-text-edit-field.service.ts
@@ -140,7 +140,7 @@ export class CustomTextEditFieldService extends EditFieldHandler {
private initializeChangeset(value:GridWidgetResource) {
const schemaHref = 'customtext-schema';
const grid:GridResource = value.grid;
- const resourceSource = {
+ const resourceSource:HalSource = {
text: value.options.text,
getEditorContext: () => ({
type: 'full',
@@ -149,13 +149,17 @@ export class CustomTextEditFieldService extends EditFieldHandler {
canAddAttachments: value.grid.canAddAttachments as boolean,
_links: {
attachments: grid.attachments as { href?:string },
- prepareAttachment: grid.prepareAttachment as { href?:string },
schema: {
href: schemaHref,
},
},
};
+ if (grid.prepareAttachment as { href?:string }) {
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access
+ resourceSource._links.prepareAttachment = grid.prepareAttachment;
+ }
+
const resource = this.halResource.createHalResource(resourceSource, true);
const schemaSource = {