_isLocked set via _lockType is overridden by trickle #584
Description
Subject of the issue
We have a plugin that shows blocks in an article where the article has _lockType: sequential
on its block models, the article also has trickle enabled at the article level.
The block models are set to _isLocked: true
initially:
adapt-contrib-core/js/models/adaptModel.js
Line 783 in e5a18ef
Trickle then overrides the block models when it comes to set the _isLocked
attributes on the course descendants:
https://github.com/adaptlearning/adapt-contrib-trickle/blob/6a84eb56fef11116860c4fabdd0d41281498fd14/js/models.js#L239
// Apply only changed locking states
Object.entries(locks).forEach(([ id, isModelLocked ]) => {
const model = modelsById[id];
const wasLocked = model.get('_isLocked');
if (wasLocked === isModelLocked) return;
model.set('_isLocked', isModelLocked);
});
This can be fixed using the lockedAttributes
for the AdaptModel
, allowing trickle and core to force the model attribute to _isLocked: true
until the same plugin unlocks it. Core essentially overrides trickle at the attribute level until core is ready to unlock the model.
Metadata
Assignees
Type
Projects
Status
Recently Released