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 getting the schema before moving a time entry

ulferts82a9fab7f626
diff --git a/frontend/src/app/modules/calendar/te-calendar/te-calendar.component.ts b/frontend/src/app/modules/calendar/te-calendar/te-calendar.component.ts
index 6ff248cb0d6..50d4011cd09 100644
--- a/frontend/src/app/modules/calendar/te-calendar/te-calendar.component.ts
+++ b/frontend/src/app/modules/calendar/te-calendar/te-calendar.component.ts
@@ -33,6 +33,7 @@ import {ColorsService} from "core-app/modules/common/colors/colors.service";
import {BrowserDetector} from "core-app/modules/common/browser/browser-detector.service";
import {HalResourceNotificationService} from 'core-app/modules/hal/services/hal-resource-notification.service';
import {APIV3Service} from "core-app/modules/apiv3/api-v3.service";
+import {SchemaCacheService} from "core-components/schemas/schema-cache.service";
interface CalendarViewEvent {
el:HTMLElement;
@@ -131,6 +132,7 @@ export class TimeEntryCalendarComponent implements AfterViewInit {
private timezone:TimezoneService,
private timeEntryEdit:TimeEntryEditService,
private timeEntryCreate:TimeEntryCreateService,
+ private schemaCache:SchemaCacheService,
private colors:ColorsService,
private browserDetector:BrowserDetector) {
}
@@ -359,19 +361,23 @@ export class TimeEntryCalendarComponent implements AfterViewInit {
// on the day before by fullcalendar.
entry.spentOn = moment(event.event.end!).format('YYYY-MM-DD');
-
this
- .apiV3Service
- .time_entries
- .id(entry)
- .patch(entry, entry.schema)
- .subscribe(
- event => this.updateEventSet(event, 'update'),
- e => {
- this.notifications.handleRawError(e);
- event.revert();
- }
- );
+ .schemaCache
+ .ensureLoaded(entry)
+ .then(schema => {
+ this
+ .apiV3Service
+ .time_entries
+ .id(entry)
+ .patch(entry, schema)
+ .subscribe(
+ event => this.updateEventSet(event, 'update'),
+ e => {
+ this.notifications.handleRawError(e);
+ event.revert();
+ }
+ );
+ });
}
public addEventToday() {