Skip to content

CW: Improved Autosave and UnlockObject

Farbod Zamani requested to merge biest-1310 into main

This MR fixes #1310

Description

The autosave mechanism in CW is only limited to the Blocks and it happens only when the user is navigating through CW Elements (e.g. The CW Vue instance) because it is only happening on beforeDestroy in CoursewareBlockEdit.vue. The Problem is, when the user perform other actions on StructuralElement, Containers, etc. is also needs some sort of release mechanism in order to unlock the object for others, if the user navigates to other pages or close the tab. Otherwise, the locked object remains locked for others until they perform the unlock action by themselves.

Solution

By using beforeunload event listener in StudIP entry-base level and emitting the event using the StudIP eventBus, it is now possible to listen to that event when it is happening. In general, if this event happens and the condition is fitted, the tab won't be closed unless the user answer the dialog to confirm the termination or stay! The places in CW that needed the autosave or unlock the object are now utilised with this feature: When navigating to other pages or closing the tab it now checks if the current object is currently locked by the current user or needs an autosave, then it performs unlocking or autosaving. In a case that user wanted to stay in the current page, then those unfinished actions/processes that lockObject is needed, will be resetted in order to avoid any conflict in locking and unlocking system!

NOTE: because it is a newly introduced feature, the MR might be considered as a proposal.

Merge request reports