Skip to content

Commit

Permalink
Merge branch 'master' into SWIK-1830_Like_button_activity_missing_JWT
Browse files Browse the repository at this point in the history
  • Loading branch information
kadevgraaf committed Dec 4, 2017
2 parents c6192fc + 0ab7781 commit 9779fa9
Show file tree
Hide file tree
Showing 84 changed files with 19,330 additions and 746 deletions.
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
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
92 changes: 59 additions & 33 deletions assets/css/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
font-size: 20px;
position: absolute;
right: 0;
width: 200px;
width: 150px;
height: 100vh;
}

Expand All @@ -50,7 +50,7 @@

.top-diff .reveal {
position: relative;
width: calc(100% - 200px);
width: calc(100% - 150px);
}

.top-diff .reveal .slides {
Expand Down Expand Up @@ -84,6 +84,8 @@

.top-diff .inlineContent {
padding: 2%;
display: flex;
flex-direction: column;
}

@media screen and (max-width: 900px) {
Expand All @@ -100,60 +102,76 @@
.top-diff .helpers {
width: 100vw;
position: relative;
height: 180px;
background-color: rgba(255,153,0,0.2);
}

.top-diff .helpers .inlineContent {
display: flex;
flex-direction: column;
}

.top-diff .helpers .checkbox {
flex: 1;
}

.top-diff .helpers .diff-header {
display: none
height: 240px;
}

}

/* HTML DOM Node related */
.diff-view .added, .modified, .deleted {
padding: 5px;
.diff-view .added,
.diff-view .modified,
.diff-view .deleted {
padding: 5px 5px 5px 5px;
margin: 0px -10px;
display: inline-block;
position: relative;
}

.diff-view .added::before,
.diff-view .modified::before,
.diff-view .deleted::before {
color: rgba(0,0,0,0.8);
position: absolute;
font-size: 20px;
right: 5px;
top: -3px;
font-weight: 700;
}

.diff-view ul, .diff-view ol {
display: flex;
flex-direction: column;
}

.diff-view ul .added,
.diff-view ul .modified,
.diff-view ul .deleted {
display: inline-table !important;
}

.diff-view p {
margin: 1em;
}

.diff-view .added {
border: 5px solid #93ca3b;
background-color: rgba(147,202,59,0.2);
border: 2px solid #2196F3;
background-color: rgba(0, 188, 212,0.2);
}
.diff-view .added::before { content: "+" }

.diff-view .modified {
border: 5px solid #FFCC00;
background-color: rgba(255,204,0,0.1);
border: 2px solid #FFCC00;
background-color: rgba(255,204,0,0.2);
}
.diff-view .modified::before { content: "+/-" }

.diff-view .deleted {
border: 5px solid #ff0030;
background-color: rgba(255,0,48,0.1);
border: 2px solid #ff0030;
background-color: rgba(255,0,48,0.2);
}
.diff-view .deleted::before { content: "x" }

.diff-view.inverse .added {
border: 5px solid #2ecc71;
border: 2px solid #2ecc71;
background-color: rgba(46,204,113,0.2);
}
.diff-view.inverse .modified {
border: 5px solid #FF9800;
background-color: rgba(255,152,0,0.1);
border: 2px solid #FF9800;
background-color: rgba(255,152,0,0.2);
}
.diff-view.inverse .deleted {
border: 5px solid #9C27B0;
background-color: rgba(156,39,176,0.1);
border: 2px solid #9C27B0;
background-color: rgba(156,39,176,0.2);
}

/* Text related */
Expand All @@ -171,12 +189,20 @@
line-height: 32px;
}

.diff-view.hide-add .added, .diff-view.hide-mod .modified, .diff-view.hide-del .deleted {
border: 5px solid transparent;
.diff-view.hide-add .added,
.diff-view.hide-mod .modified,
.diff-view.hide-del .deleted {
border: 2px solid transparent;
background-color: transparent;
}
.diff-view.hide-add .added::before,
.diff-view.hide-mod .modified::before,
.diff-view.hide-del .deleted::before {
display: none;
}

.diff-view.hide-text .ins, .diff-view.hide-text .del{
.diff-view.hide-text .ins,
.diff-view.hide-text .del{
color: #333;
background-color: transparent;
text-decoration: none;
Expand Down

0 comments on commit 9779fa9

Please sign in to comment.