Skip to content

Commit

Permalink
merge with master
Browse files Browse the repository at this point in the history
  • Loading branch information
kadevgraaf committed Dec 4, 2017
1 parent b45eed3 commit 8ea664a
Show file tree
Hide file tree
Showing 80 changed files with 3,599 additions and 649 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ configs/version.js
slidewiki
migrate
.idea/
package-lock.json
5 changes: 1 addition & 4 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
[submodule "custom_modules/custom-semantic-ui"]
path = custom_modules/custom-semantic-ui
url = https://github.com/slidewiki/custom-semantic-ui.git
[submodule "custom_modules/simple-draggable"]
path = custom_modules/simple-draggable
url = https://github.com/slidewiki/simple-draggable.git
[submodule "custom_modules/reveal.js"]
path = custom_modules/reveal.js
url = https://github.com/slidewiki/reveal.js
url = https://github.com/slidewiki/reveal.js.git
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ after_success:
- openssl aes-256-cbc -K $encrypted_ecdba13b2a41_key -iv $encrypted_ecdba13b2a41_iv -in deployment_keys.tar.enc -out deployment_keys.tar -d
- if [ "$TRAVIS_BRANCH" == "master" ] && [ "$TRAVIS_PULL_REQUEST" = "false" ] ; then ./travis_scripts/dockerhub.sh ; fi
- if [ "$TRAVIS_BRANCH" == "master" ] && [ "$TRAVIS_PULL_REQUEST" = "false" ] ; then ./travis_scripts/deploy.sh ; fi
- npm run coverall
after_script:
- rm -f deployment_keys.tar
- rm -f ~/.docker/{cert.pem,key.pem,ca.pem,config.json}
Expand Down
5 changes: 5 additions & 0 deletions actions/activityfeed/likeActivity.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
const log = require('../log/clog');
import UserProfileStore from '../../stores/UserProfileStore';
import serviceUnavailable from '../error/serviceUnavailable';

export default function likeActivity(context, payload, done) {
log.info(context);

//enrich with jwt
payload.jwt = context.getStore(UserProfileStore).jwt;

context.service.create('like.likeActivity', payload, {}, {timeout: 20 * 1000}, (err, res) => {
if (err) {
log.error(context, {filepath: __filename});
Expand Down
12 changes: 11 additions & 1 deletion actions/activityfeed/loadActivities.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,16 @@ export default function loadActivities(context, payload, done) {
// context.dispatch('UPDATE_PAGE_TITLE', {
// pageTitle: pageTitle
// });
done();
if (payload.params.stype !== 'deck')
return done();
context.service.read('presentation.live', {id: payload.params.sid}, {timeout: 20 * 1000}, (err, res) => {
if (err) {
log.error(context, {filepath: __filename});
context.executeAction(serviceUnavailable, payload, done);
} else {
context.dispatch('LOAD_PRESENTATIONS_SUCCESS', res);
}
done();
});
});
}
10 changes: 10 additions & 0 deletions actions/decktree/moveTreeNode.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import UserProfileStore from '../../stores/UserProfileStore';
import addActivity from '../activityfeed/addActivity';
const log = require('../log/clog');

export default function moveTreeNode(context, payload, done) {
Expand Down Expand Up @@ -42,6 +43,15 @@ export default function moveTreeNode(context, payload, done) {
context.dispatch('MOVE_TREE_NODE_FAILURE', err);
} else {
context.dispatch('MOVE_TREE_NODE_SUCCESS', payload);

let activity = {
activity_type: 'move',
user_id: String(userid),
content_name: res.title,
content_id: String(res.id),
content_kind: res.type
};
context.executeAction(addActivity, {activity: activity});
}
done(null, res);
});
Expand Down
17 changes: 17 additions & 0 deletions actions/loadSupportedLanguages.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import serviceUnavailable from './error/serviceUnavailable';
const log = require('./log/clog');

export default function loadSupportedLanguages(context, payload, done) {
log.info(context);
context.service.read('translation.supported', payload, {timeout: 20 * 1000}, (err, res) => {
// console.log('Executing loadPresentation action');
if (err) {
log.error(context, {filepath: __filename, err: err});
context.executeAction(serviceUnavailable, payload, done);
//context.dispatch('LOAD_FEATURED_FAILURE', err);
} else {
context.dispatch('LOAD_SUPPORTED_LANGS_SUCCESS', res);
}
done();
});
}
34 changes: 13 additions & 21 deletions actions/loadTranslations.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,20 @@ const log = require('./log/clog');

export default function loadTranslations(context, payload, done) {
log.info(context);
if(!(['deck', 'slide', 'question'].indexOf(payload.params.stype) > -1 || payload.params.stype === undefined)) {
context.executeAction(deckContentTypeError, payload, done);
return;
if(!(['deck'].indexOf(payload.params.stype) > -1 || payload.params.stype === undefined)) { //this is slide
done();
}else{
context.service.read('translation.list', payload, {timeout: 20 * 1000}, (err, res) => {
if (err) {
log.error(context, {filepath: __filename});
context.executeAction(serviceUnavailable, payload, done);
context.dispatch('LOAD_TRANSLATIONS_FAILURE', err);
} else {
context.dispatch('LOAD_TRANSLATIONS_SUCCESS', res);
}
done();
});
}

if (!(AllowedPattern.SLIDE_ID.test(payload.params.sid) || payload.params.sid === undefined)) {
context.executeAction(slideIdTypeError, payload, done);
return;
}

context.service.read('translation.list', payload, {timeout: 20 * 1000}, (err, res) => {
if (err) {
log.error(context, {filepath: __filename});
context.executeAction(serviceUnavailable, payload, done);
context.dispatch('LOAD_TRANSLATIONS_FAILURE', err);
} else {
context.dispatch('LOAD_TRANSLATIONS_SUCCESS', res);
}
let pageTitle = shortTitle + ' | Translations | ' + payload.params.stype + ' | ' + payload.params.sid;
context.dispatch('UPDATE_PAGE_TITLE', {
pageTitle: pageTitle
});
done();
});
}
1 change: 0 additions & 1 deletion actions/media/uploadMediaFile.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ export default function uploadMediaFile(context, payload, done) {
payload.userid = context.getStore(UserProfileStore).userid;
payload.jwt = context.getStore(UserProfileStore).jwt;

console.log('uploadMediaFile', payload);
context.dispatch('START_UPLOADING_MEDIA_FILE', {type: payload.type, name: payload.title});

context.service.create('media.create', payload, { timeout: 20 * 1000 }, { timeout: 20 * 1000 }, (err, res) => {
Expand Down
44 changes: 44 additions & 0 deletions actions/media/uploadMediaFiles.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import UserProfileStore from '../../stores/UserProfileStore';
import {Microservices} from '../../configs/microservices';
const log = require('../log/clog');

export default function uploadMediaFiles(context, payload, done) {
log.info(context);

payload.userid = context.getStore(UserProfileStore).userid;
payload.jwt = context.getStore(UserProfileStore).jwt;

context.dispatch('START_UPLOADING_MEDIA_FILE', {type: payload.type, name: payload.title});

context.service.create('media.create', payload, { timeout: 20 * 1000 }, { timeout: 20 * 1000 }, (err, res) => {
if (err) {
// Every file send to the file-service gets checked if its distinct, if so 409 is returned
// All images of all users are regarded thus the 409 response is really common
if (err.statusCode === 409) {
let parts = err.message.split(' ');
let filename = parts[parts.length-1];
filename = filename.substring(0, filename.length - 4);
payload.url = Microservices.file.uri + '/picture/' + filename;

let thumbnailName = filename.substring(0, filename.lastIndexOf('.')) + '_thumbnail' + filename.substr(filename.lastIndexOf('.'));
payload.thumbnailUrl = Microservices.file.uri + '/picture/' + thumbnailName;

delete payload.jwt;
delete payload.userid;

console.log('Got 409 from file service', payload);
context.dispatch('SUCCESS_UPLOADING_MEDIA_FILE', payload);
}
else {
context.dispatch('FAILURE_UPLOADING_MEDIA_FILE', err);
}
}
else {
payload.url = Microservices.file.uri + '/picture/' + res.fileName;
payload.thumbnailUrl = Microservices.file.uri + '/picture/' + res.thumbnailName;
context.dispatch('SUCCESS_UPLOADING_MEDIA_FILE', payload);

}
done();
});
}
54 changes: 54 additions & 0 deletions actions/translateDeckRevision.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import UserProfileStore from '../stores/UserProfileStore';
import ContentStore from '../stores/ContentStore';
import striptags from 'striptags';
import TreeUtil from '../components/Deck/TreePanel/util/TreeUtil';
import {navigateAction} from 'fluxible-router';
import serviceUnavailable from './error/serviceUnavailable';
import addActivity from './activityfeed/addActivity';
const log = require('./log/clog');
const common = require('../common.js');

export default function translateDeckRevision(context, payload, done) {
context.dispatch('START_TRANSLATION', 'success');
log.info(context);
console.log('action translateDeckRevision: got payload', payload);
//enrich with user id
let user = context.getStore(UserProfileStore).userid;
//if (!user) user = '3'; //NEED TO REMOVE THE LINE

payload.user = user.toString();
payload.deckId = context.getStore(ContentStore).selector.id;
payload.jwt = context.getStore(UserProfileStore).jwt;
console.log(payload);
//enrich with root deck id if deck to be revised is not uppermost deck
// let parent = TreeUtil.getParentId(payload.selector);
// payload.root_deck = parent;
context.service.create('deck.translate', payload, null, {timeout: 30 * 1000}, (err, res) => {
if (err) {
//context.dispatch('UPDATE_DECKEDIT_VIEW_STATE', 'error');
//context.dispatch('SAVE_DECK_REVISION_FAILURE', err);
log.error(context, {filepath: __filename, err: err});
// context.executeAction(serviceUnavailable, payload, done);
done();
} else {
//console.log('res:' + res.id);

// let activity = {
// activity_type: 'edit',
// user_id: String(context.getStore(UserProfileStore).userid),
// content_id: String(newSid),
// content_kind: 'deck'
// };
// context.executeAction(addActivity, {activity: activity});

context.dispatch('END_TRANSLATION', 'success');

context.executeAction(navigateAction, {
url: '/deck/' + res.root_deck //ADD HERE NEW DECK ID
});

done();

}
});
}
4 changes: 4 additions & 0 deletions actions/user/notifications/loadUserNotifications.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ const log = require('../../log/clog');

export default function loadUserNotifications(context, payload, done) {
log.info(context);

// start loading
context.dispatch('SHOW_NOTIFICATIONS_LOADING', payload);

context.service.read('notifications.list', payload, {timeout: 20 * 1000}, (err, res) => {
if (err) {
log.error(context, {filepath: __filename});
Expand Down
Loading

0 comments on commit 8ea664a

Please sign in to comment.