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
Reload the events after saving, so we avoid lock errors
Oliver Günthercc0fb8e47cac
diff --git a/frontend/src/app/features/calendar/wp-calendar/wp-calendar.component.ts b/frontend/src/app/features/calendar/wp-calendar/wp-calendar.component.tsindex 0aaa46c13e2..68b8e5c13c2 100644--- a/frontend/src/app/features/calendar/wp-calendar/wp-calendar.component.ts+++ b/frontend/src/app/features/calendar/wp-calendar/wp-calendar.component.ts@@ -26,14 +26,7 @@// See COPYRIGHT and LICENSE files for more details.//++-import {- ChangeDetectionStrategy,- Component,- ElementRef,- Input,- OnInit,- ViewChild,-} from '@angular/core';+import { ChangeDetectionStrategy, Component, ElementRef, Input, OnInit, ViewChild } from '@angular/core';import {CalendarOptions,DateSelectArg,@@ -64,11 +57,7 @@ import { ConfigurationService } from 'core-app/core/config/configuration.serviceimport { UntilDestroyedMixin } from 'core-app/shared/helpers/angular/until-destroyed.mixin';import { SchemaCacheService } from 'core-app/core/schemas/schema-cache.service';import { CurrentProjectService } from 'core-app/core/current-project/current-project.service';-import interactionPlugin, {- EventDragStartArg,- EventDragStopArg,- EventResizeDoneArg,-} from '@fullcalendar/interaction';+import interactionPlugin, { EventDragStartArg, EventDragStopArg, EventResizeDoneArg } from '@fullcalendar/interaction';import {HalResourceEditingService,} from 'core-app/shared/components/fields/edit/services/hal-resource-editing.service';@@ -81,11 +70,7 @@ import {import { OpCalendarService } from 'core-app/features/calendar/op-calendar.service';import { WeekdayService } from 'core-app/core/days/weekday.service';import { DayResourceService } from 'core-app/core/state/days/day.service';-import {- EffectCallback,- EffectHandler,- registerEffectCallbacks,-} from 'core-app/core/state/effects/effect-handler.decorator';+import { EffectCallback, registerEffectCallbacks } from 'core-app/core/state/effects/effect-handler.decorator';import { calendarRefreshRequest } from 'core-app/features/calendar/calendar.actions';import { ActionsService } from 'core-app/core/state/actions/actions.service';import {@@ -350,6 +335,7 @@ export class WorkPackagesCalendarComponent extends UntilDestroyedMixin implementtry {const result = await this.halEditing.save(changeset);this.halNotification.showSave(result.resource, result.wasNew);+ this.reloadOnRefreshRequest();} catch (e) {this.halNotification.handleRawError(e, changeset.projectedResource);info.revert();diff --git a/modules/calendar/spec/features/calendar_widget_spec.rb b/modules/calendar/spec/features/calendar_widget_spec.rbindex f98375c84e8..143cf914e96 100644--- a/modules/calendar/spec/features/calendar_widget_spec.rb+++ b/modules/calendar/spec/features/calendar_widget_spec.rb@@ -28,6 +28,7 @@require 'spec_helper'require_relative '../../../overviews/spec/support/pages/overview'+require_relative '../support/pages/calendar'RSpec.describe 'Calendar Widget', :js, :with_cuprite dolet(:project) do@@ -44,9 +45,13 @@ RSpec.describe 'Calendar Widget', :js, :with_cuprite doPages::Overview.new(project)endlet(:wp_full_view) { Pages::FullWorkPackage.new(work_package, project) }+ let(:calendar) { Pages::Calendar.new project }current_user do- create(:user, member_with_permissions: { project => %w[view_work_packages view_calendar manage_overview] })+ create(:user,+ member_with_permissions: {+ project => %w[view_work_packages edit_work_packages view_calendar manage_overview]+ })endbefore do@@ -66,4 +71,25 @@ RSpec.describe 'Calendar Widget', :js, :with_cuprite dowp_full_view.go_backexpect(page).to have_text('Overview')end++ it 'can resize the same work package twice (Regression #48333)', with_cuprite: false do+ # within top-left area, add an additional widget+ overview_page.add_widget(1, 1, :row, 'Calendar')++ overview_page.expect_and_dismiss_toaster message: I18n.t('js.notice_successful_update')++ expect(page).to have_selector('.fc-event-title', text: work_package.subject)++ calendar.resize_date(work_package, work_package.due_date - 1.day)+ overview_page.expect_and_dismiss_toaster message: I18n.t('js.notice_successful_update')++ work_package.reload+ expect(work_package.due_date).to eq Time.zone.today.beginning_of_week.next_occurring(:wednesday)++ calendar.resize_date(work_package, work_package.due_date - 1.day)+ overview_page.expect_and_dismiss_toaster message: I18n.t('js.notice_successful_update')++ work_package.reload+ expect(work_package.due_date).to eq Time.zone.today.beginning_of_week.next_occurring(:tuesday)+ endenddiff --git a/modules/calendar/spec/support/pages/calendar.rb b/modules/calendar/spec/support/pages/calendar.rbindex 2592a221ebb..01ef1487643 100644--- a/modules/calendar/spec/support/pages/calendar.rb+++ b/modules/calendar/spec/support/pages/calendar.rb@@ -58,20 +58,22 @@ module Pagesenddef resize_date(work_package, date, end_date: true)- wp_strip = event(work_package)+ retry_block do+ wp_strip = event(work_package)- page- .driver- .browser- .action- .move_to(wp_strip.native)- .perform+ page+ .driver+ .browser+ .action+ .move_to(wp_strip.native)+ .perform- selector = end_date ? '.fc-event-resizer-end' : '.fc-event-resizer-start'- resizer = wp_strip.find(selector)- end_container = date_container date+ selector = end_date ? '.fc-event-resizer-end' : '.fc-event-resizer-start'+ resizer = wp_strip.find(selector)+ end_container = date_container date- drag_n_drop_element(from: resizer, to: end_container)+ drag_n_drop_element(from: resizer, to: end_container)+ endenddef drag_event(work_package, target)