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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
[#61316] subject field gets readonly on type change
Eric Schubert0d3fa2a6e8ff
diff --git a/frontend/src/app/features/work-packages/components/wp-edit/work-package-changeset.ts b/frontend/src/app/features/work-packages/components/wp-edit/work-package-changeset.tsindex a41c40b0a80..e9c1ba2e3f3 100644--- a/frontend/src/app/features/work-packages/components/wp-edit/work-package-changeset.ts+++ b/frontend/src/app/features/work-packages/components/wp-edit/work-package-changeset.ts@@ -26,17 +26,30 @@ export class WorkPackageChangeset extends ResourceChangeset<WorkPackageResource>// Otherwise, the backend will set it for us.delete payload.description;+ // Explicitly not send the subject, if the subject was not editable.+ // In this case a generated template is rendered in the subject and+ // must not get submitted.+ // eslint-disable-next-line @typescript-eslint/no-unsafe-call+ if (!this.schema.isAttributeEditable('subject')) {+ delete (payload as { subject?:string }).subject;+ }+return super.applyChanges(payload);}protected setNewDefaultFor(key:string, val:unknown) {- // Special handling for taking over the description- // to the pristine resource+ // Special handling for taking over the description and+ // the subject to the pristine resource.if (key === 'description' && isNewResource(this.pristineResource)) {this.pristineResource.description = val;return;}+ if (key === 'subject' && isNewResource(this.pristineResource)) {+ this.pristineResource.subject = val as string;+ return;+ }+super.setNewDefaultFor(key, val);}diff --git a/frontend/src/app/shared/components/fields/changeset/resource-changeset.ts b/frontend/src/app/shared/components/fields/changeset/resource-changeset.tsindex 12e6cf79832..1744c83abb1 100644--- a/frontend/src/app/shared/components/fields/changeset/resource-changeset.ts+++ b/frontend/src/app/shared/components/fields/changeset/resource-changeset.ts@@ -488,7 +488,7 @@ export class ResourceChangeset<T extends HalResource = HalResource> {protected setNewDefaults(form:FormResource) {_.each(form.payload, (val:unknown, key:string) => {const fieldSchema:IFieldSchema|null = this.schema.ofProperty(key);- if (!fieldSchema?.writable) {+ if (!fieldSchema?.writable && !fieldSchema?.required) {return;}diff --git a/frontend/src/app/shared/components/fields/edit/field/editable-attribute-field.component.ts b/frontend/src/app/shared/components/fields/edit/field/editable-attribute-field.component.tsindex f001f010915..f7a49e3cb1d 100644--- a/frontend/src/app/shared/components/fields/edit/field/editable-attribute-field.component.ts+++ b/frontend/src/app/shared/components/fields/edit/field/editable-attribute-field.component.ts@@ -126,7 +126,11 @@ export class EditableAttributeFieldComponent extends UntilDestroyedMixin impleme).subscribe((resource) => {this.resource = resource;- this.render();+ if (this.isEditable) {+ this.render();+ } else {+ this.reset();+ }});}