From e5780cd5dc3d83c3567ec0e7ddcc3e2a28be5c5b Mon Sep 17 00:00:00 2001 From: Nikos G Date: Wed, 24 Jun 2020 15:19:03 +0200 Subject: [PATCH 01/28] Delete and edit threads/replies in progress.. --- src/api/project.js | 16 ++++++++++ src/components/Forum/CommentReply.vue | 8 +++-- src/store/modules/project.js | 46 +++++++++++++++++++++++++-- 3 files changed, 65 insertions(+), 5 deletions(-) diff --git a/src/api/project.js b/src/api/project.js index 7a680f3..c77902a 100644 --- a/src/api/project.js +++ b/src/api/project.js @@ -174,5 +174,21 @@ export default { 'X-CSRFToken': csrf } }) + }, + + deleteCommentsOptions(comment_id){ + return axios.get(process.env.BASE_ENDPOINT_URL + 'project/forum/comment/' + comment_id + '/delete', { + withCredentials: true, + data: {} + }) + }, + + deleteComment(csrf,comment_id){ + return axios.post(process.env.BASE_ENDPOINT_URL + 'project/forum/comment/' + comment_id + '/delete',{}, { + withCredentials: true, + headers: { + 'X-CSRFToken': csrf + } + }) } } diff --git a/src/components/Forum/CommentReply.vue b/src/components/Forum/CommentReply.vue index 4331b9a..3c824fe 100644 --- a/src/components/Forum/CommentReply.vue +++ b/src/components/Forum/CommentReply.vue @@ -10,7 +10,8 @@
{{ giveDateTime(reply.created) }} , {{ reply.role }} - + {{$t('forum-delete-comment')}}
@@ -25,7 +26,7 @@ + + diff --git a/src/components/Project/Project.vue b/src/components/Project/Project.vue index effe1bb..5cb3b5a 100644 --- a/src/components/Project/Project.vue +++ b/src/components/Project/Project.vue @@ -89,7 +89,7 @@
- {{ $t('project-contribute') }} + {{ $t('project-contribute') }}
@@ -113,7 +113,7 @@
- {{ $t('project-contribute') }} + {{ $t('project-contribute') }}
diff --git a/src/components/Task/TemplateRenderer.vue b/src/components/Task/TemplateRenderer.vue index 7e64756..8f00212 100644 --- a/src/components/Task/TemplateRenderer.vue +++ b/src/components/Task/TemplateRenderer.vue @@ -13,7 +13,7 @@ :label="$t('task-template-renderer-loading')"> - +
{{ $t('task-template-renderer-no-task-presenter') }} @@ -103,6 +103,7 @@ export default { taskPresenterLoaded: false, taskLoaded: false, showMulti: false, + showProjectPassModal:true, modal: { mediaType: 'image', mediaUrl: '#', @@ -116,7 +117,10 @@ export default { // the current project where is displayed the task presenter project: state => state.selectedProject, // user task progress - userProgress: state => state.selectedProjectUserProgress + userProgress: state => state.selectedProjectUserProgress, + //get access for selected project + accessForSelectedProject : state => state.accessForSelectedProject + }), ...mapState('task', { @@ -152,7 +156,7 @@ export default { ]), ...mapActions('project', [ - 'getUserProgress', 'getProject' + 'getUserProgress', 'getProject','isProjectPrivate' ]), ...mapActions('osm', [ @@ -163,14 +167,15 @@ export default { 'showError' ]), ...mapMutations('project', [ - 'setSelectedProjectUserProgress' + 'setSelectedProjectUserProgress', + 'setProjectPassModal' ]), /** * Called when the dynamic component start */ run () { - this.newTask() + this.newTask() }, /** @@ -183,18 +188,31 @@ export default { if(this.userProgress.total > 0){ this.setSelectedProjectUserProgress({'done':this.userProgress.done+1,'total':this.userProgress.total}) } + //check if anonymous users are allowed. if not redirect to project page if (!allowed) { this.showError({ title: this.$t('template-renderer-not-allowed-contribute'), content: this.$t('template-renderer-not-allowed-anonymous') }) this.$router.push({ name: 'project', params: { id: this.project.id } }) + } else { - if(this.userProgressInPercent < 100 && !allowed.id){ - this.skipTaskWithOffset({'id':this.project.id,'offset':0}) - } - this.getUserProgress(this.project) - this.taskLoaded = true + //check if project is private and user has been granted access. if not redirect to project page and show pass modal. + this.isProjectPrivate({'id':this.project.id}).then(response => { + //set accessForSelectedProject to array of objects for multiple private projects. + if (response.private && !this.accessForSelectedProject) { + this.setProjectPassModal(true) + this.$router.push({ name: 'project', params: { id: this.project.id } }) + } else { + this.setProjectPassModal(false) + if(this.userProgressInPercent < 100 && !allowed.id){ + this.skipTaskWithOffset({'id':this.project.id,'offset':0}) + } + this.getUserProgress(this.project) + this.taskLoaded = true + } + }) + } }) }, diff --git a/src/store/modules/project.js b/src/store/modules/project.js index 081f637..61e28cf 100644 --- a/src/store/modules/project.js +++ b/src/store/modules/project.js @@ -52,7 +52,10 @@ const state = { projectShareableKey: {}, enableTestEnvironment: false, - privateProjectOptions:{} + privateProjectOptions:{}, + + showProjectPassModal: false, + accessForSelectedProject: false } // filter methods on the state data @@ -761,6 +764,12 @@ const mutations = { }, setPrivateProjectOptions(state,status){ state.privateProjectOptions = status + }, + setProjectPassModal(state,status){ + state.showProjectPassModal = status + }, + setAccessForSelectedProject(state,status){ + state.accessForSelectedProject = status } } From 2c2b5f1299763303d6f514747bfa693f840a3063 Mon Sep 17 00:00:00 2001 From: Nikos Georgomanolis Date: Mon, 10 Aug 2020 14:51:10 +0200 Subject: [PATCH 18/28] Translations and project access checks --- src/assets/messages.json | 10 ++++++++-- src/components/Common/ProjectPasswordModal.vue | 9 +++++---- src/components/Task/TemplateRenderer.vue | 5 ++++- src/store/modules/project.js | 5 ++++- 4 files changed, 21 insertions(+), 8 deletions(-) diff --git a/src/assets/messages.json b/src/assets/messages.json index e2d17b1..bac4982 100644 --- a/src/assets/messages.json +++ b/src/assets/messages.json @@ -794,7 +794,10 @@ "new-task-was-imported-successfully":"new task was imported successfully", "import-the-selected-files":"Import selected files", - "modify-draft-modal-content":"This button will delete your Task Presenter design and take you back to Tasks Import (see Step 2 of the '{HowitWorks}' procedure)" + "modify-draft-modal-content":"This button will delete your Task Presenter design and take you back to Tasks Import (see Step 2 of the '{HowitWorks}' procedure)", + + "private-project-title":"Private project", + "private-project-content":"This is a private project with restricted access. Please contact the project owner for more information." }, "de": { @@ -1585,7 +1588,10 @@ "new-task-was-imported-successfully":"neue Aufgabe wurde erfolgreich importiert", "import-the-selected-files":"Importieren Sie die ausgewählten Dateien", - "modify-draft-modal-content":"Diese Schaltfläche löscht Ihr Task Presenter-Design und bringt Sie zurück zum Aufgabenimport (siehe Schritt 2 der Prozedur '{HowitWorks}')." + "modify-draft-modal-content":"Diese Schaltfläche löscht Ihr Task Presenter-Design und bringt Sie zurück zum Aufgabenimport (siehe Schritt 2 der Prozedur '{HowitWorks}').", + + "private-project-title":"Privates Projekt", + "private-project-content":"Das ist ein privates Projekt mit eingeschränktem Zugriff. Bitte kontaktieren Sie den Projektbesitzer für weitere Informationen" } diff --git a/src/components/Common/ProjectPasswordModal.vue b/src/components/Common/ProjectPasswordModal.vue index 5a0ea1c..15e6a6f 100644 --- a/src/components/Common/ProjectPasswordModal.vue +++ b/src/components/Common/ProjectPasswordModal.vue @@ -4,13 +4,14 @@ :visible="value" ref="my-modal" hide-footer - title="Private project" + :title="$t('private-project-title')" :ok-title="$t('submit-btn')" :cancel-title="$t('cancel-c')" @show="resetModal" @ok="submitPass"> - + { if (response.status == 'success'){ - this.setAccessForSelectedProject(true) + this.setAccessForSelectedProject({'access':true,'project_id':this.project.id}) this.setProjectPassModal(false) this.$refs['my-modal'].hide() this.$router.push({ name: 'project.task.presenter'}) } else { - this.showError({ + this.showError({ title: 'Access denied', content: response.status }) diff --git a/src/components/Task/TemplateRenderer.vue b/src/components/Task/TemplateRenderer.vue index 8f00212..3cb5faf 100644 --- a/src/components/Task/TemplateRenderer.vue +++ b/src/components/Task/TemplateRenderer.vue @@ -200,7 +200,10 @@ export default { //check if project is private and user has been granted access. if not redirect to project page and show pass modal. this.isProjectPrivate({'id':this.project.id}).then(response => { //set accessForSelectedProject to array of objects for multiple private projects. - if (response.private && !this.accessForSelectedProject) { + if (response.private && + (this.accessForSelectedProject.access && + !(this.accessForSelectedProject.project_id==this.project.id) + )) { this.setProjectPassModal(true) this.$router.push({ name: 'project', params: { id: this.project.id } }) } else { diff --git a/src/store/modules/project.js b/src/store/modules/project.js index 61e28cf..a9f78d6 100644 --- a/src/store/modules/project.js +++ b/src/store/modules/project.js @@ -55,7 +55,10 @@ const state = { privateProjectOptions:{}, showProjectPassModal: false, - accessForSelectedProject: false + accessForSelectedProject: { + access:false, + project_id:null + } } // filter methods on the state data From 9f3b7063a4222c47c6f973071e08550b00558a61 Mon Sep 17 00:00:00 2001 From: Nikos G Date: Wed, 12 Aug 2020 20:28:50 +0200 Subject: [PATCH 19/28] Private project done. --- src/assets/messages.json | 8 +++-- .../Common/ProjectPasswordModal.vue | 4 +-- src/components/Project/ProjectEditor.vue | 30 ++++++++++++++++--- src/components/Task/TemplateRenderer.vue | 9 +++--- 4 files changed, 39 insertions(+), 12 deletions(-) diff --git a/src/assets/messages.json b/src/assets/messages.json index bac4982..0778ae9 100644 --- a/src/assets/messages.json +++ b/src/assets/messages.json @@ -797,7 +797,9 @@ "modify-draft-modal-content":"This button will delete your Task Presenter design and take you back to Tasks Import (see Step 2 of the '{HowitWorks}' procedure)", "private-project-title":"Private project", - "private-project-content":"This is a private project with restricted access. Please contact the project owner for more information." + "private-project-content":"This is a private project with restricted access. Please contact the project owner for more information.", + "access-denied":"Access denied", + "project-protect-with-password":"Protect project with password" }, "de": { @@ -1591,7 +1593,9 @@ "modify-draft-modal-content":"Diese Schaltfläche löscht Ihr Task Presenter-Design und bringt Sie zurück zum Aufgabenimport (siehe Schritt 2 der Prozedur '{HowitWorks}').", "private-project-title":"Privates Projekt", - "private-project-content":"Das ist ein privates Projekt mit eingeschränktem Zugriff. Bitte kontaktieren Sie den Projektbesitzer für weitere Informationen" + "private-project-content":"Das ist ein privates Projekt mit eingeschränktem Zugriff. Bitte kontaktieren Sie den Projektbesitzer für weitere Informationen", + "access-denied":"Zugriff abgelehnt", + "project-protect-with-password":"Projekt mit Passwort schützen" } diff --git a/src/components/Common/ProjectPasswordModal.vue b/src/components/Common/ProjectPasswordModal.vue index 15e6a6f..9681205 100644 --- a/src/components/Common/ProjectPasswordModal.vue +++ b/src/components/Common/ProjectPasswordModal.vue @@ -69,8 +69,8 @@ export default { this.$router.push({ name: 'project.task.presenter'}) } else { this.showError({ - title: 'Access denied', - content: response.status + title: response.status, + content: this.$t('access-denied') }) } }) diff --git a/src/components/Project/ProjectEditor.vue b/src/components/Project/ProjectEditor.vue index 559503e..e6878fc 100644 --- a/src/components/Project/ProjectEditor.vue +++ b/src/components/Project/ProjectEditor.vue @@ -40,6 +40,22 @@ {{ $t('project-editor-anonymous-contributors') }} + + + + + + {{ $t('project-protect-with-password') }} + + + + @@ -177,7 +193,9 @@ export default { how: '', who: '', keepTrack: '', - allowAnonymousContributors: true + allowAnonymousContributors: true, + password: '', + protect: null }, picture: '', @@ -203,6 +221,9 @@ export default { }, keepTrack: { maxLength: 800 + }, + password : { + maxLength: 18 } } } @@ -218,7 +239,6 @@ export default { ...mapMutations('notification', [ 'showSuccess', 'showError', 'showInfo' ]), - initForm (project) { this.form.name = project.name this.form.shortDescription = project.description @@ -253,7 +273,9 @@ export default { who: this.form.who, keepTrack: this.form.keepTrack }), - allow_anonymous_contributors: this.form.allowAnonymousContributors + allow_anonymous_contributors: this.form.allowAnonymousContributors, + protect: this.form.protect, + password: this.form.password } }).then(response => { if ('form' in response && 'errors' in response.form) { @@ -357,7 +379,7 @@ export default { * @returns {boolean} */ isFormValid () { - const formKeys = Object.keys(this.form).filter(el => el !== 'category' && el !== 'allowAnonymousContributors') + const formKeys = Object.keys(this.form).filter(el => el !== 'category' && el !== 'allowAnonymousContributors' && el !== 'protect' && el !== 'password') let isValidated = true for (let field of formKeys) { diff --git a/src/components/Task/TemplateRenderer.vue b/src/components/Task/TemplateRenderer.vue index 3cb5faf..71d1cab 100644 --- a/src/components/Task/TemplateRenderer.vue +++ b/src/components/Task/TemplateRenderer.vue @@ -200,10 +200,11 @@ export default { //check if project is private and user has been granted access. if not redirect to project page and show pass modal. this.isProjectPrivate({'id':this.project.id}).then(response => { //set accessForSelectedProject to array of objects for multiple private projects. - if (response.private && - (this.accessForSelectedProject.access && - !(this.accessForSelectedProject.project_id==this.project.id) - )) { + + if (response.private && response.redirect && !(this.accessForSelectedProject.project_id==this.project.id) + /* (this.accessForSelectedProject.access && + + )*/) { this.setProjectPassModal(true) this.$router.push({ name: 'project', params: { id: this.project.id } }) } else { From cf75234822d7ade3207bde218ede9011601af064 Mon Sep 17 00:00:00 2001 From: Nikos G Date: Sun, 16 Aug 2020 12:33:47 +0200 Subject: [PATCH 20/28] Private project translation fix --- src/assets/messages.json | 6 ++++-- src/components/Common/ProjectCard.vue | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/assets/messages.json b/src/assets/messages.json index 0778ae9..bec24c0 100644 --- a/src/assets/messages.json +++ b/src/assets/messages.json @@ -799,7 +799,8 @@ "private-project-title":"Private project", "private-project-content":"This is a private project with restricted access. Please contact the project owner for more information.", "access-denied":"Access denied", - "project-protect-with-password":"Protect project with password" + "project-protect-with-password":"Protect project with password", + "private-c":"Private" }, "de": { @@ -1595,7 +1596,8 @@ "private-project-title":"Privates Projekt", "private-project-content":"Das ist ein privates Projekt mit eingeschränktem Zugriff. Bitte kontaktieren Sie den Projektbesitzer für weitere Informationen", "access-denied":"Zugriff abgelehnt", - "project-protect-with-password":"Projekt mit Passwort schützen" + "project-protect-with-password":"Projekt mit Passwort schützen", + "private-c":"Privat" } diff --git a/src/components/Common/ProjectCard.vue b/src/components/Common/ProjectCard.vue index fbe415f..2aea8ab 100644 --- a/src/components/Common/ProjectCard.vue +++ b/src/components/Common/ProjectCard.vue @@ -3,7 +3,7 @@
- Private + {{$t('private-c')}} From 032588f0cceb4b401c05cceafe63d8f6b44ab562 Mon Sep 17 00:00:00 2001 From: Nikos Georgomanolis Date: Mon, 17 Aug 2020 10:00:40 +0200 Subject: [PATCH 21/28] CHeckbox control added in ProjectEditor for enabling/disabling restricted access --- src/components/Project/ProjectEditor.vue | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/components/Project/ProjectEditor.vue b/src/components/Project/ProjectEditor.vue index e6878fc..4e74d96 100644 --- a/src/components/Project/ProjectEditor.vue +++ b/src/components/Project/ProjectEditor.vue @@ -44,9 +44,10 @@ - - {{ $t('project-protect-with-password') }} + + {{ $t('project-protect-with-password') }} + :placeholder="$t('password-editor-new-password')"> @@ -404,6 +405,9 @@ export default { let fieldLength = this.$data['form'][field].replace(/<[^>]*>?/gm, '').length; fieldLength = fieldLength < 0 ? 0 : fieldLength return fieldLength === 0 ? this.$t('mandatory-field') : this.$t('field-should-not-exceed')+' ' + this.validation[field].maxLength + ' ' + this.$t('characters') + }, + privateProjectBoxChanged(boxValue){ + this.form.protect = boxValue } }, computed: { From dd9b37d9cf3db10dbac16ddaf00115e87d876740 Mon Sep 17 00:00:00 2001 From: Nikos G Date: Wed, 19 Aug 2020 10:22:33 +0200 Subject: [PATCH 22/28] Fixed bug in Forum Threads --- .gitignore | 5 ++- src/components/Forum/CommentReply.vue | 12 +++++++- src/components/Forum/CommentThread.vue | 42 +++++++++++++++++++------- src/scss/comment.scss | 1 + src/store/index.js | 6 ++-- src/store/modules/comments.js | 34 +++++++++++++++++++++ src/store/modules/project.js | 1 + 7 files changed, 86 insertions(+), 15 deletions(-) create mode 100644 src/store/modules/comments.js diff --git a/.gitignore b/.gitignore index 5bd3ce5..4f0ce07 100644 --- a/.gitignore +++ b/.gitignore @@ -18,4 +18,7 @@ selenium-debug.log *.sln .now -now.json \ No newline at end of file +now.json + +config/nginx.conf +Dockerfile \ No newline at end of file diff --git a/src/components/Forum/CommentReply.vue b/src/components/Forum/CommentReply.vue index 085c325..424a83a 100644 --- a/src/components/Forum/CommentReply.vue +++ b/src/components/Forum/CommentReply.vue @@ -61,7 +61,7 @@