Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New: Treat _isLocked as a lockable attribute #231

Merged
merged 1 commit into from
Oct 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions js/models.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,13 +197,13 @@ export function applyLocks() {
const modelsById = {};
// Fetch the component model from the store incase it needs overriding by another extension
const TrickleButtonModel = components.getModelClass('trickle-button');
const setDescendantLocks = ((model, id) => {
const setDescendantLocks = (model, id) => {
model.getAllDescendantModels().forEach(descendant => {
const descendantId = descendant.get('_id');
modelsById[descendantId] = descendant;
locks[descendantId] = locks[id];
});
});
};
// Check all models for trickle potential
Adapt.course.getAllDescendantModels(true).filter(model => model.get('_isAvailable')).forEach(siteModel => {
const trickleConfig = getModelConfig(siteModel);
Expand Down Expand Up @@ -236,7 +236,7 @@ export function applyLocks() {
const model = modelsById[id];
const wasLocked = model.get('_isLocked');
if (wasLocked === isModelLocked) return;
model.set('_isLocked', isModelLocked);
model.set('_isLocked', isModelLocked, { pluginName: 'trickle' });
});
logTrickleState();
}
Expand Down
Loading