From f7e5c7bf2cbd77ced0fc0a70a74791ee5f1da4d4 Mon Sep 17 00:00:00 2001 From: aonomike Date: Mon, 3 Jun 2019 23:36:04 +0300 Subject: [PATCH 1/6] Add date relative date on comments --- webapp/components/Comment.vue | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/webapp/components/Comment.vue b/webapp/components/Comment.vue index 751a11f02..5bce3d480 100644 --- a/webapp/components/Comment.vue +++ b/webapp/components/Comment.vue @@ -7,7 +7,7 @@
- + Date: Tue, 4 Jun 2019 15:16:01 +0300 Subject: [PATCH 2/6] Add cypress test to check date comment posted is displayed --- cypress/integration/common/post.js | 43 ++++++++++++++++-------------- 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/cypress/integration/common/post.js b/cypress/integration/common/post.js index f6a1bbedd..814159a34 100644 --- a/cypress/integration/common/post.js +++ b/cypress/integration/common/post.js @@ -1,25 +1,28 @@ -import { When, Then } from 'cypress-cucumber-preprocessor/steps' +import { When, Then } from "cypress-cucumber-preprocessor/steps"; -const narratorAvatar = 'https://s3.amazonaws.com/uifaces/faces/twitter/nerrsoft/128.jpg' +const narratorAvatar = + "https://s3.amazonaws.com/uifaces/faces/twitter/nerrsoft/128.jpg"; -Then('I click on the {string} button', text => { - cy.get('button').contains(text).click() -}) +Then("I click on the {string} button", text => { + cy.get("button") + .contains(text) + .click(); +}); -Then('my comment should be successfully created', () => { - cy.get('.iziToast-message') - .contains('Comment Submitted') -}) +Then("my comment should be successfully created", () => { + cy.get(".iziToast-message").contains("Comment Submitted"); +}); -Then('I should see my comment', () => { - cy.get('div.comment p') - .should('contain', 'Human Connection rocks') - .get('.ds-avatar img') - .should('have.attr', 'src') - .and('contain', narratorAvatar) -}) +Then("I should see my comment", () => { + cy.get("div.comment p") + .should("contain", "Human Connection rocks") + .get(".ds-avatar img") + .should("have.attr", "src") + .and("contain", narratorAvatar) + .get("div p.ds-text span") + .should("contain", "today at"); +}); -Then('the editor should be cleared', () => { - cy.get('.ProseMirror p') - .should('have.class', 'is-empty') -}) +Then("the editor should be cleared", () => { + cy.get(".ProseMirror p").should("have.class", "is-empty"); +}); From f1b85d525623e21fe34e619cf4594eaa78cbd31d Mon Sep 17 00:00:00 2001 From: senderfm Date: Tue, 4 Jun 2019 16:25:59 +0200 Subject: [PATCH 3/6] Fixed clean ReleaseModal and DeleteModal --- webapp/components/ContentMenu.vue | 24 ++- webapp/components/Modal.vue | 9 + webapp/components/Modal/DisableModal.spec.js | 3 + webapp/components/Modal/DisableModal.vue | 7 +- .../ReleaseModal/ReleaseModal.spec.js | 175 ++++++++++++++++++ .../components/ReleaseModal/ReleaseModal.vue | 77 ++++++++ webapp/locales/de.json | 28 ++- webapp/locales/en.json | 22 ++- 8 files changed, 333 insertions(+), 12 deletions(-) create mode 100644 webapp/components/ReleaseModal/ReleaseModal.spec.js create mode 100644 webapp/components/ReleaseModal/ReleaseModal.vue diff --git a/webapp/components/ContentMenu.vue b/webapp/components/ContentMenu.vue index 69289cb6d..5cd49fe17 100644 --- a/webapp/components/ContentMenu.vue +++ b/webapp/components/ContentMenu.vue @@ -98,13 +98,23 @@ export default { } if (!this.isOwner && this.isModerator) { - routes.push({ - name: this.$t(`disable.${this.resourceType}.title`), - callback: () => { - this.openModal('disable') - }, - icon: 'eye-slash', - }) + if (!this.resource.disabled) { + routes.push({ + name: this.$t(`disable.${this.resourceType}.title`), + callback: () => { + this.openModal('disable') + }, + icon: 'eye-slash', + }) + } else { + routes.push({ + name: this.$t(`release.${this.resourceType}.title`), + callback: () => { + this.openModal('release', this.resource.id) + }, + icon: 'eye-slash', + }) + } } if (this.isOwner && this.resourceType === 'user') { diff --git a/webapp/components/Modal.vue b/webapp/components/Modal.vue index efe1b8ab6..317b5007a 100644 --- a/webapp/components/Modal.vue +++ b/webapp/components/Modal.vue @@ -9,6 +9,13 @@ :callbacks="data.callbacks" @close="close" /> + import DeleteModal from '~/components/Modal/DeleteModal' import DisableModal from '~/components/Modal/DisableModal' +import ReleaseModal from '~/components/ReleaseModal/ReleaseModal.vue' import ReportModal from '~/components/Modal/ReportModal' import { mapGetters } from 'vuex' @@ -38,6 +46,7 @@ export default { name: 'Modal', components: { DisableModal, + ReleaseModal, ReportModal, DeleteModal, }, diff --git a/webapp/components/Modal/DisableModal.spec.js b/webapp/components/Modal/DisableModal.spec.js index 02ae3fa5d..87484f6bf 100644 --- a/webapp/components/Modal/DisableModal.spec.js +++ b/webapp/components/Modal/DisableModal.spec.js @@ -33,6 +33,9 @@ describe('DisableModal.vue', () => { $apollo: { mutate: jest.fn().mockResolvedValue(), }, + location: { + reload: jest.fn(), + }, } }) diff --git a/webapp/components/Modal/DisableModal.vue b/webapp/components/Modal/DisableModal.vue index 690dcbf70..988ecc8af 100644 --- a/webapp/components/Modal/DisableModal.vue +++ b/webapp/components/Modal/DisableModal.vue @@ -4,9 +4,7 @@