Skip to content

Commit

Permalink
Merged Master
Browse files Browse the repository at this point in the history
  • Loading branch information
rmeissn committed Dec 5, 2017
2 parents e1f4b0b + 6e153cc commit 46c77fd
Show file tree
Hide file tree
Showing 130 changed files with 4,435 additions and 1,110 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
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
language: node_js
node_js: 6
node_js: 8
sudo: required
git:
depth: 5
Expand All @@ -23,6 +23,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
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM slidewiki/runtime:latest
FROM slidewiki/runtime:nodejs-8-slim
MAINTAINER Ali Khalili "[email protected]"

ARG BUILD_ENV=local
Expand Down
5 changes: 5 additions & 0 deletions actions/activityfeed/addActivities.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
import UserProfileStore from '../../stores/UserProfileStore';
import serviceUnavailable from '../error/serviceUnavailable';
const log = require('../log/clog');

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

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

context.service.create('activities.newarray', payload, {timeout: 20 * 1000}, (err, res) => {
if (err) {
log.error(context, {filepath: __filename});
Expand Down
5 changes: 5 additions & 0 deletions actions/activityfeed/addActivity.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
import UserProfileStore from '../../stores/UserProfileStore';
import serviceUnavailable from '../error/serviceUnavailable';
const log = require('../log/clog');

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

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

context.service.create('activities.new', payload, {timeout: 20 * 1000}, (err, res) => {
if (err) {
log.error(context, {filepath: __filename});
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();
});
}
43 changes: 43 additions & 0 deletions actions/media/uploadMediaFile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import UserProfileStore from '../../stores/UserProfileStore';
import {Microservices} from '../../configs/microservices';
const log = require('../log/clog');

export default function uploadMediaFile(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) => {
delete payload.jwt;
delete payload.userid;

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;

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();
});
}
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();
});
}
29 changes: 29 additions & 0 deletions actions/media/uploadProfilePicture.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import UserProfileStore from '../../stores/UserProfileStore';
import {Microservices} from '../../configs/microservices';
const log = require('../log/clog');

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

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

// console.log('uploadProfilePicture', payload);
context.dispatch('START_UPLOADING_MEDIA_FILE', {type: payload.type, name: 'profile picture'});

context.service.create('media.uploadProfilePicture', payload, { timeout: 20 * 1000 }, { timeout: 20 * 1000 }, (err, res) => {
delete payload.jwt;
delete payload.userid;
delete payload.username;

if (err) {
context.dispatch('FAILURE_UPLOADING_MEDIA_FILE', err);
}
else {
payload.url = res;
context.dispatch('SUCCESS_UPLOADING_MEDIA_FILE', payload);
}
done();
});
}
6 changes: 1 addition & 5 deletions actions/report/closeReportModal.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
/**
* Created by lfernandes on 24.03.17.
*/

const log = require('../log/clog');
import log from '../log/clog';

export default function closeReportModal(context, payload, done) {
log.info(context);
Expand Down
6 changes: 1 addition & 5 deletions actions/report/openReportModal.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
/**
* Created by lfernandes on 24.03.17.
*/

const log = require('../log/clog');
import log from '../log/clog';

export default function openReportModal(context, payload, done) {
log.info(context);
Expand Down
36 changes: 33 additions & 3 deletions actions/report/sendReport.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,34 @@
/**
* Created by lfernandes on 12.03.17.
*/
import log from '../log/clog';

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

context.service.create('email', {subject: payload.subject, message: payload.text}, { timeout: 20 * 1000 }, (err, res) => {

if (err) {
swal({
title: payload.swal_messages.title,
text: payload.swal_messages.error_text,
type: 'error',
confirmButtonText: payload.swal_messages.error_confirmButtonText,
confirmButtonClass: 'positive ui button',
allowEscapeKey: false,
allowOutsideClick: false,
buttonsStyling: false
});

} else {
swal({
title: payload.swal_messages.title,
text:payload.swal_messages.text,
type: 'success',
confirmButtonText: payload.swal_messages.confirmButtonText,
confirmButtonClass: 'positive ui button',
allowEscapeKey: false,
allowOutsideClick: false,
buttonsStyling: false
});
}
done();
});
}
6 changes: 1 addition & 5 deletions actions/report/sendReportShowWrongFields.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
/**
* Created by lfernandes on 12.03.17.
*/

const log = require('../log/clog');
import log from '../log/clog';

export default function SendReportShowWrongFields(context, payload, done) {
log.info(context);
Expand Down
4 changes: 4 additions & 0 deletions actions/slide/loadSlideView.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ export default function loadSlideView(context, payload, done) {
context.executeAction(slideIdTypeError, payload, done);
return;
}
console.log('send to load');
context.dispatch('LOAD_SLIDE_CONTENT_LOAD', {loadingIndicator: 'true'});
//context.dispatch('LOAD_SLIDE_CONTENT_LOAD');
//console.log('get content');

context.service.read('slide.content', payload, {timeout: 20 * 1000}, (err, res) => {
if (err) {
Expand Down
Loading

0 comments on commit 46c77fd

Please sign in to comment.