Skip to content

Commit 859227b

Browse files
Merge pull request #2473 from adaptlearning/release/bugpatch
Release 0.10.2
2 parents 650cece + 6578437 commit 859227b

File tree

11 files changed

+87
-75
lines changed

11 files changed

+87
-75
lines changed

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,20 @@ All notable changes to the Adapt authoring tool are documented in this file.
55
**IMPORTANT**: For information on how to **correctly and safely** update your installation, please consult **INSTALL.md**.<br/>
66
_Note that we adhere to the [semantic versioning](http://semver.org/) scheme for release numbering._
77

8+
## [0.10.2] - 2019-11-08
9+
10+
Bugfix release.
11+
12+
### Fixed
13+
- Asset tags are not preserved on import ([#2439](https://github.com/adaptlearning/adapt_authoring/issues/2439))
14+
- Cannot update plugin via the UI ([#2455](https://github.com/adaptlearning/adapt_authoring/issues/2455))
15+
- Install script hangs when installing legacy framework ([#2457](https://github.com/adaptlearning/adapt_authoring/issues/2457))
16+
- Input box briefly fills screen when enering tags in asset upload modal ([#2460](https://github.com/adaptlearning/adapt_authoring/issues/2460))
17+
- Extensions go missing from components ([#2467](https://github.com/adaptlearning/adapt_authoring/issues/2467))
18+
19+
### Added
20+
- Upgrade script should check for compatible framework updates ([#2307](https://github.com/adaptlearning/adapt_authoring/issues/2307))
21+
822
## [0.10.1] - 2019-10-22
923

1024
Bugfix release.
@@ -659,6 +673,7 @@ Initial release.
659673
- Loading screen of death
660674
- Session cookie security issues
661675

676+
[0.10.2]: https://github.com/adaptlearning/adapt_authoring/compare/v0.10.1...v0.10.2
662677
[0.10.1]: https://github.com/adaptlearning/adapt_authoring/compare/v0.10.0...v0.10.1
663678
[0.10.0]: https://github.com/adaptlearning/adapt_authoring/compare/v0.9.0...v0.10.0
664679
[0.9.0]: https://github.com/adaptlearning/adapt_authoring/compare/v0.8.1...v0.9.0

frontend/src/modules/assetManagement/views/assetManagementModalNewAssetView.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ define(function(require){
3434
this.$('#tags_control').selectize({
3535
create: true,
3636
labelField: 'title',
37+
loadingClass: 'selectize-loading',
3738
load: function(query, callback) {
3839
$.ajax({
3940
url: 'api/autocomplete/tag',

frontend/src/modules/pluginManagement/views/pluginTypeView.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -81,18 +81,18 @@ define(function(require){
8181
});
8282
$icon.removeClass().addClass('fa fa-refresh fa-spin');
8383

84-
$.post(this.model.urlRoot + '/update', { 'targets': [this.model.get('_id')] }, _.bind(function(data) {
85-
if(!_.contains(data.upgraded, this.model.get('_id'))) {
86-
$btn.attr({title: Origin.l10n.t('app.updatefailed')});
84+
$.post(this.model.urlRoot + '/update', { 'targets': [ this.model.get('_id') ] })
85+
.done(function() {
86+
Origin.trigger('scaffold:updateSchemas', function() {
87+
$btn.attr('title', Origin.l10n.t('app.uptodate'));
88+
$icon.removeClass().addClass('fa fa-check');
89+
this.model.fetch();
90+
}, this);
91+
}.bind(this))
92+
.fail(function() {
93+
$btn.attr('title', Origin.l10n.t('app.updatefailed'));
8794
$icon.removeClass().addClass('fa fa-times');
88-
return;
89-
}
90-
Origin.trigger('scaffold:updateSchemas', function() {
91-
$btn.attr({title: Origin.l10n.t('app.uptodate')});
92-
$icon.removeClass().addClass('fa fa-check');
93-
this.model.fetch();
94-
}, this);
95-
}, this));
95+
});
9696

9797
return false;
9898
},

frontend/src/modules/scaffold/index.js

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ define([
1717
], function(Origin, Helpers, Schemas, BackboneForms, BackboneFormsLists, Overrides, ScaffoldAssetView, ScaffoldAssetItemView, ScaffoldCodeEditorView, ScaffoldColourPickerView, ScaffoldDisplayTitleView, ScaffoldItemsModalView, ScaffoldListView, ScaffoldTagsView, ScaffoldUsersView) {
1818

1919
var Scaffold = {};
20-
var builtSchemas = {};
2120
var alternativeModel;
2221
var alternativeAttribute;
2322
var currentModel;
@@ -32,7 +31,6 @@ define([
3231

3332
function onScaffoldUpdateSchemas(callback, context) {
3433
Origin.trigger('schemas:loadData', function() {
35-
builtSchemas = {};
3634
callback.apply(context);
3735
});
3836
}
@@ -146,20 +144,6 @@ define([
146144
}
147145

148146
function buildSchema(schema, options, type) {
149-
// these types of schemas change frequently and cannot be cached
150-
var isVolatileType = _.contains([
151-
'course',
152-
'config',
153-
'article',
154-
'block',
155-
'component'
156-
], type);
157-
158-
var builtSchema = builtSchemas[type];
159-
160-
if (!isVolatileType && builtSchema) {
161-
return builtSchema;
162-
}
163147

164148
var scaffoldSchema = {};
165149

@@ -181,11 +165,6 @@ define([
181165
}
182166
}
183167

184-
// only cache non-volatile types
185-
if (!isVolatileType) {
186-
builtSchemas[type] = scaffoldSchema;
187-
}
188-
189168
return scaffoldSchema;
190169
}
191170

frontend/src/modules/scaffold/views/scaffoldTagsView.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ define([ 'core/origin', 'backbone-forms' ], function(Origin, BackboneForms) {
2323
this.$el.selectize({
2424
create: true,
2525
labelField: 'title',
26+
loadingClass: 'selectize-loading',
2627
load: function(query, callback) {
2728
$.ajax({
2829
url: 'api/autocomplete/tag',

lib/bowermanager.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ BowerManager.prototype.installLatestCompatibleVersion = function (pluginName, ca
180180
requiredFrameworkVersion = result.framework;
181181
cb();
182182
});
183-
}, function isCompatible() {
183+
}, async function isCompatible() {
184184
return semver.satisfies(installedFrameworkVersion, requiredFrameworkVersion);
185185
}, function(error, version) {
186186
if(error) {

lib/installHelpers.js

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ var inputHelpers = {
4242
readline.moveCursor(process.stdout, 0, -1);
4343
return v;
4444
},
45-
isFalsyString: function(v) {
46-
if (typeof v !== 'string') return false;
45+
isFalsy: function(v) {
46+
if (typeof v !== 'string') return !v;
4747
switch (v.trim()) {
4848
case '':
4949
case 'N':
@@ -252,8 +252,14 @@ function getInstalledFrameworkVersion(callback) {
252252
});
253253
}
254254

255-
function getLatestFrameworkVersion(callback) {
256-
checkLatestAdaptRepoVersion('adapt_framework', pkg.framework, callback);
255+
function getLatestFrameworkVersion(installedVersion, callback) {
256+
let versionLimit;
257+
if (typeof installedVersion === 'function') {
258+
callback = installedVersion;
259+
} else {
260+
versionLimit = semver.major(installedVersion).toString();
261+
}
262+
checkLatestAdaptRepoVersion('adapt_framework', versionLimit, callback);
257263
}
258264

259265
function getInstalledVersions(callback) {
@@ -268,20 +274,20 @@ function getInstalledVersions(callback) {
268274
});
269275
}
270276

271-
function getLatestVersions(callback) {
277+
function getLatestVersions(installedVersions, callback) {
272278
async.parallel([
273279
exports.getLatestServerVersion,
274-
exports.getLatestFrameworkVersion
280+
async.apply(exports.getLatestFrameworkVersion, installedVersions.adapt_framework)
275281
], function(error, results) {
276-
callback(error, {
277-
adapt_authoring: results[0],
278-
adapt_framework: results[1]
279-
});
282+
callback(error, [
283+
installedVersions,
284+
{ adapt_authoring: results[0], adapt_framework: results[1] }
285+
]);
280286
});
281287
}
282288

283289
function getUpdateData(callback) {
284-
async.parallel([
290+
async.waterfall([
285291
exports.getInstalledVersions,
286292
exports.getLatestVersions
287293
], function(error, results) {

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "adapt_authoring",
3-
"version": "0.10.1",
3+
"version": "0.10.2",
44
"license": "GPL-3.0",
55
"description": "A server-based user interface for authoring eLearning courses using the Adapt Framework.",
66
"keywords": [
@@ -11,7 +11,6 @@
1111
"type": "git",
1212
"url": "https://github.com/adaptlearning/adapt_authoring.git"
1313
},
14-
"framework": "2",
1514
"main": "index",
1615
"engines": {
1716
"node": "10 || 12"

plugins/content/bower/index.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -552,9 +552,12 @@ BowerPlugin.prototype.initialize = function (plugin) {
552552
{ _searchItems: pluginNames }
553553
);
554554

555-
return self.updatePackages(plugin, options, function () {
556-
// @TODO figure out how to determine if the update failed?
557-
return res.json({ success: true, upgraded: upgradeTargets });
555+
return self.updatePackages(plugin, options, function(err) {
556+
if (err) {
557+
logger.log('error', err);
558+
res.statusCode = 400;
559+
}
560+
return res.json({ success: !err, message: err && err.message });
558561
});
559562
});
560563
});
@@ -808,7 +811,11 @@ function addPackage (plugin, packageInfo, options, cb) {
808811
async.some([ 'componenttype', 'extensiontype', 'menutype', 'themetype' ], (type, asyncCallback) => {
809812
if (!targetAttribute) return asyncCallback();
810813

811-
db.retrieve(type, { targetAttribute: targetAttribute }, (err, results) => {
814+
const query = type === plugin.type ?
815+
{ name: { $ne: pkgMeta.name }, targetAttribute: targetAttribute } :
816+
{ targetAttribute: targetAttribute };
817+
818+
db.retrieve(type, query, (err, results) => {
812819
asyncCallback(err, results && results.length);
813820
});
814821
}, (err, targetAttributeExists) => {

plugins/output/adapt/importsource.js

Lines changed: 27 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -172,25 +172,6 @@ function ImportSource(req, done) {
172172
var assetJson = assetsJson[assetName];
173173
var tags = [];
174174

175-
if (assetJson) {
176-
assetTitle = assetJson.title;
177-
assetDescription = assetJson.description;
178-
179-
assetJson.tags.forEach(function(tag) {
180-
const tagTitle = tag.title;
181-
const warn = (error) => logger.log('warn', `Failed to create asset tag '${tagTitle}' ${error}`);
182-
183-
if(!tagTitle) return warn(new Error('Tag has no title'));
184-
185-
app.contentmanager.getContentPlugin('tag', function(error, plugin) {
186-
if(error) return warn(error);
187-
plugin.create({ title: tagTitle }, function(error, record) { // @note retrieves if tag already exists
188-
if(error) return warn(error);
189-
tags.push(record._id);
190-
});
191-
});
192-
});
193-
}
194175
var fileMeta = {
195176
oldId: assetId,
196177
title: assetTitle,
@@ -203,15 +184,38 @@ function ImportSource(req, done) {
203184
repository: repository,
204185
createdBy: app.usermanager.getCurrentUser()._id
205186
};
206-
if(!fileMeta) {
207-
return doneAsset(new helpers.ImportError('No metadata found for asset: ' + assetName));
208-
}
209-
helpers.importAsset(fileMeta, metadata, doneAsset);
187+
188+
if (!assetJson) return helpers.importAsset(fileMeta, metadata, doneAsset);
189+
190+
addAssetTags(assetJson, function(error, assetTags) {
191+
const warn = (error) => logger.log('warn', `Failed to create asset tag ${error}`);
192+
if (error) return warn(new Error(error));
193+
fileMeta.title = assetJson.title;
194+
fileMeta.description = assetJson.description;
195+
fileMeta.tags = assetTags;
196+
helpers.importAsset(fileMeta, metadata, doneAsset);
197+
});
210198
}, doneAssetFolder);
211199
});
212200
}, done);
213201
}
214202

203+
function addAssetTags(assetJson, cb) {
204+
var assetTags = [];
205+
assetJson.tags.forEach(function(tag) {
206+
var tagTitle = tag.title;
207+
if(!tagTitle) return cb('Tag has no title');
208+
app.contentmanager.getContentPlugin('tag', function(error, plugin) {
209+
if(error) return cb(tagTitle.concat(' ', error));
210+
plugin.create({ title: tagTitle }, function(error, record) { // @note retrieves if tag already exists
211+
if(error) return cb(tagTitle.concat(' ', error));
212+
assetTags.push(record._id);
213+
});
214+
});
215+
});
216+
cb(null, assetTags);
217+
}
218+
215219
/**
216220
* Stores plugin metadata for use later
217221
*/

0 commit comments

Comments
 (0)