Skip to content

Commit

Permalink
Merge pull request #329 from ExtensionEngine/release/3.2.1
Browse files Browse the repository at this point in the history
Release 3.2.1
  • Loading branch information
underscope authored Aug 12, 2019
2 parents ba7ba09 + a43a8ef commit e32c90b
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 21 deletions.
3 changes: 0 additions & 3 deletions client/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import 'dom-shims/shim/Element.classList';
import 'dom-shims/shim/Element.mutation';
import 'event-source-polyfill';
import 'bootstrap-sass/assets/javascripts/bootstrap';
import 'vue-directive-tooltip/css/index.css';

import assetsApi from '@/api/asset';
import colors from 'vuetify/es5/util/colors';
Expand All @@ -14,7 +13,6 @@ import FileFilter from '@/directives/file-filter';
import QuestionContainer from 'tce-core/QuestionContainer';
import { sync } from 'vuex-router-sync';
import Timeago from 'vue-timeago';
import Tooltip from 'vue-directive-tooltip';
import VeeValidate from './utils/validation';
import Vue from 'vue';
import VueHotkey from 'v-hotkey';
Expand Down Expand Up @@ -42,7 +40,6 @@ Vue.use(Vuetify, {
}
});
Vue.use(VuetifySnackbar);
Vue.use(Tooltip, { delay: 50 });
Vue.use(VeeValidate, {
delay: 700,
fieldsBagName: 'vFields',
Expand Down
12 changes: 2 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tailor",
"version": "3.2.0",
"version": "3.2.1",
"codename": "silk",
"description": "Content authoring platform",
"author": "ExtensionEngine <[email protected]>",
Expand Down Expand Up @@ -122,7 +122,6 @@
"vue-avatar": "^2.1.1",
"vue-color": "^2.7.0",
"vue-datetime": "^1.0.0-beta.3",
"vue-directive-tooltip": "^1.4.2",
"vue-focus": "^2.1.0",
"vue-infinite-loading": "^2.4.4",
"vue-infinite-scroll": "^2.0.0",
Expand Down
8 changes: 6 additions & 2 deletions server/activity/activity.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,13 @@ function clone({ activity, body }, res) {
}

function getPreviewUrl({ course, activity }, res) {
return fetchActivityContent(course, activity)
return fetchActivityContent(course, activity, true)
.then(content => {
const body = { uid: activity.uid, ...content };
const body = {
...pick(activity, ['id', 'uid', 'type']),
meta: activity.data,
...content
};
return request.post(previewUrl, body);
})
.then(({ data: { url } }) => {
Expand Down
32 changes: 28 additions & 4 deletions server/shared/publishing/helpers.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
'use strict';

const { getLevelRelationships } = require('../../../config/shared/activities');
const { TeachingElement } = require('../database');
const filter = require('lodash/filter');
const find = require('lodash/find');
const findIndex = require('lodash/findIndex');
const get = require('lodash/get');
const { getLevelRelationships } = require('../../../config/shared/activities');
const hash = require('hash-obj');
const keys = require('lodash/keys');
const map = require('lodash/map');
const omit = require('lodash/omit');
const pick = require('lodash/pick');
const Promise = require('bluebird');
const reduce = require('lodash/reduce');
const { resolveStatics } = require('../storage/helpers');
const storage = require('../storage');
const { TeachingElement } = require('../database');
const without = require('lodash/without');

const { FLAT_REPO_STRUCTURE } = process.env;
Expand Down Expand Up @@ -100,12 +101,17 @@ function getPublishedStructure(repository) {
});
}

function fetchActivityContent(repository, activity) {
return Promise.all([
async function fetchActivityContent(repository, activity, signed = false) {
const res = await Promise.all([
fetchContainers(repository, activity),
fetchAssessments(activity),
fetchExams(activity)
]).spread((containers, assessments, exams) => ({ containers, assessments, exams }));
if (!signed) return res;
res.containers = await Promise.map(res.containers, resolveContainer);
res.assessments = await resolveAssessments(res.assessments);
res.exams = await Promise.map(res.exams, resolveExam);
return res;
}

function publishContent(repository, activity) {
Expand Down Expand Up @@ -185,6 +191,24 @@ async function fetchQuestionGroups(exam) {
};
}

async function resolveContainer(container) {
container.elements = await Promise.map(container.elements, resolveStatics);
return container;
}

function resolveAssessments(assessments) {
return Promise.map(assessments, resolveStatics);
}

async function resolveExam(exam) {
exam.groups = await Promise.map(exam.groups, async group => {
group.intro = await Promise.map(group.intro, resolveStatics);
group.assessments = await Promise.map(group.assessments, resolveStatics);
return group;
});
return exam;
}

function saveFile(parent, key, data) {
const buffer = Buffer.from(JSON.stringify(data), 'utf8');
const baseUrl = getBaseUrl(parent.courseId, parent.id);
Expand Down

0 comments on commit e32c90b

Please sign in to comment.