diff --git a/webapp/components/_new/features/FiledTable/FiledTable.vue b/webapp/components/_new/features/FiledTable/FiledTable.vue deleted file mode 100644 index 20b00b82e..000000000 --- a/webapp/components/_new/features/FiledTable/FiledTable.vue +++ /dev/null @@ -1,68 +0,0 @@ - - - - diff --git a/webapp/components/_new/features/ReportList/ReportList.vue b/webapp/components/_new/features/ReportList/ReportList.vue deleted file mode 100644 index 0200e4cca..000000000 --- a/webapp/components/_new/features/ReportList/ReportList.vue +++ /dev/null @@ -1,142 +0,0 @@ - - - - diff --git a/webapp/components/_new/features/ReportRow/ReportRow.vue b/webapp/components/_new/features/ReportRow/ReportRow.vue deleted file mode 100644 index d1bfe8d05..000000000 --- a/webapp/components/_new/features/ReportRow/ReportRow.vue +++ /dev/null @@ -1,185 +0,0 @@ - - - - - diff --git a/webapp/components/_new/features/ReportsTable/ReportsTable.spec.js b/webapp/components/_new/features/ReportsTable/ReportsTable.spec.js deleted file mode 100644 index cedb01713..000000000 --- a/webapp/components/_new/features/ReportsTable/ReportsTable.spec.js +++ /dev/null @@ -1,216 +0,0 @@ -import { config, mount, RouterLinkStub } from '@vue/test-utils' -import Vuex from 'vuex' -import ReportsTable from './ReportsTable.vue' -import { reports } from './ReportsTable.story.js' -import BaseIcon from '~/components/_new/generic/BaseIcon/BaseIcon' - -const localVue = global.localVue - -config.stubs['client-only'] = '' - -describe('ReportsTable', () => { - let propsData, mocks, stubs, getters, wrapper, reportsTable - - beforeEach(() => { - propsData = {} - mocks = { - $t: jest.fn(string => string), - } - stubs = { - NuxtLink: RouterLinkStub, - } - getters = { - 'auth/user': () => { - return { slug: 'awesome-user' } - }, - 'auth/isModerator': () => true, - } - }) - - describe('mount', () => { - const Wrapper = () => { - const store = new Vuex.Store({ - getters, - }) - return mount(ReportsTable, { propsData, mocks, stubs, localVue, store }) - } - - describe('given no reports', () => { - beforeEach(() => { - propsData = { ...propsData, reports: [] } - wrapper = Wrapper() - }) - - it('shows a placeholder', () => { - expect(wrapper.text()).toContain('moderation.reports.empty') - }) - }) - - describe('given reports', () => { - beforeEach(() => { - propsData = { ...propsData, reports } - wrapper = Wrapper() - reportsTable = wrapper.find('.ds-table') - }) - - it('renders a table', () => { - expect(reportsTable.exists()).toBe(true) - }) - - describe('Comment', () => { - let commentRow - beforeEach(() => { - commentRow = wrapper.find('[data-test="report-comment"]') - }) - - it('renders a comments icon', () => { - const commentsIcon = commentRow.find(BaseIcon).props().name - expect(commentsIcon).toEqual('comments') - }) - - it('renders a link to the post, with the comment contentExcerpt', () => { - const postLink = commentRow.find('[data-test="report-content"] a') - expect(postLink.text()).toEqual('@peter-lustig Lorem ipsum dolor sit amet, …') - }) - - it('renders the author', () => { - const username = commentRow.find('[data-test="report-author"] b') - expect(username.text()).toEqual('Louie') - }) - - describe('given it has been reviewed', () => { - it('renders the enabled icon', () => { - expect( - commentRow - .find('.status-line') - .find(BaseIcon) - .props().name, - ).toEqual('eye') - }) - - it('renders its current status', () => { - expect(commentRow.find('.status-line').text()).toEqual('moderation.reports.enabledBy') - }) - - it('renders the moderator who reviewed the resource', () => { - const username = commentRow.find('[data-test="report-reviewer"]') - expect(username.text()).toContain('@moderator') - }) - }) - - describe('give report has not been closed', () => { - let confirmButton - beforeEach(() => { - confirmButton = commentRow.find('[data-test="confirm"]') - }) - it('renders a confirm button', () => { - expect(confirmButton.exists()).toBe(true) - }) - - it('emits confirm event', () => { - confirmButton.trigger('click') - expect(wrapper.emitted().confirm[0][0]).toEqual(reports[0]) - }) - }) - }) - - describe('Post', () => { - let postRow - beforeEach(() => { - postRow = wrapper.find('[data-test="report-post"]') - }) - - it('renders a bookmark icon', () => { - const postIcon = postRow.find(BaseIcon).props().name - expect(postIcon).toEqual('bookmark') - }) - - it('renders a link to the post', () => { - const postLink = postRow.find('[data-test="report-content"] a') - expect(postLink.text()).toEqual("I'm a bigoted post!") - }) - - it('renders the author', () => { - const username = postRow.find('[data-test="report-author"]') - expect(username.text()).toContain('Dagobert') - }) - - describe('given it has not been reviewed', () => { - it('renders the enabled icon', () => { - expect( - postRow - .find('.status-line') - .find(BaseIcon) - .props().name, - ).toEqual('eye') - }) - - it('renders its current status', () => { - expect(postRow.find('.status-line').text()).toEqual('moderation.reports.enabled') - }) - }) - - describe('give report has not been closed', () => { - let confirmButton - beforeEach(() => { - confirmButton = postRow.find('[data-test="confirm"]') - }) - - it('renders a confirm button', () => { - expect(confirmButton.exists()).toBe(true) - }) - - it('emits confirm event', () => { - confirmButton.trigger('click') - expect(wrapper.emitted().confirm[0][0]).toEqual(reports[1]) - }) - }) - }) - - describe('User', () => { - let userRow - beforeEach(() => { - userRow = wrapper.find('[data-test="report-user"]') - }) - - it('renders a bookmark icon', () => { - const userIcon = userRow.find(BaseIcon).props().name - expect(userIcon).toEqual('user') - }) - - it('renders a link to the user profile', () => { - const userLink = userRow.find('[data-test="report-content"] a') - expect(userLink.text()).toContain('Abusive user') - }) - - describe('given it has been reviewed', () => { - it('renders the disabled icon', () => { - expect( - userRow - .find('.status-line') - .find(BaseIcon) - .props().name, - ).toEqual('eye-slash') - }) - - it('renders its current status', () => { - expect(userRow.find('.status-line').text()).toEqual('moderation.reports.disabledBy') - }) - - it('renders the moderator who reviewed the resource', () => { - const username = userRow.find('[data-test="report-reviewer"]') - expect(username.text()).toContain('Peter Lustig') - }) - }) - - describe('give report has been closed', () => { - it('renders Decided text', () => { - expect(userRow.find('[data-test="report-closed"]').text()).toEqual( - 'moderation.reports.decided', - ) - }) - }) - }) - }) - }) -}) diff --git a/webapp/components/_new/features/ReportsTable/ReportsTable.story.js b/webapp/components/_new/features/ReportsTable/ReportsTable.story.js deleted file mode 100644 index 3c7abec5d..000000000 --- a/webapp/components/_new/features/ReportsTable/ReportsTable.story.js +++ /dev/null @@ -1,169 +0,0 @@ -import { storiesOf } from '@storybook/vue' -import { withA11y } from '@storybook/addon-a11y' -import { action } from '@storybook/addon-actions' -import ReportsTable from '~/components/_new/features/ReportsTable/ReportsTable' -import helpers from '~/storybook/helpers' -import { post } from '~/components/PostCard/PostCard.story.js' -import { user } from '~/components/User/User.story.js' - -helpers.init() -export const reports = [ - { - __typename: 'Report', - closed: false, - createdAt: '2019-10-29T15:36:02.106Z', - updatedAt: '2019-12-02T15:56:35.651Z', - disable: false, - filed: [ - { - __typename: 'FILED', - createdAt: '2019-12-02T15:56:35.676Z', - reasonCategory: 'pornographic_content_links', - reasonDescription: 'This comment is porno!!!', - submitter: { - ...user, - }, - }, - ], - resource: { - __typename: 'Comment', - id: 'b6b38937-3efc-4d5e-b12c-549e4d6551a5', - createdAt: '2019-10-29T15:38:25.184Z', - updatedAt: '2019-10-30T15:38:25.184Z', - disabled: false, - deleted: false, - content: - '

@peter-lustig

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Turpis egestas pretium aenean pharetra magna ac placerat. Tempor id eu nisl nunc mi ipsum faucibus vitae. Nibh praesent tristique magna sit amet purus gravida quis blandit. Magna eget est lorem ipsum dolor. In fermentum posuere urna nec. Eleifend donec pretium vulputate sapien nec sagittis aliquam. Augue interdum velit euismod in pellentesque. Id diam maecenas ultricies mi eget mauris pharetra. Donec pretium vulputate sapien nec. Dolor morbi non arcu risus quis varius quam quisque. Blandit turpis cursus in hac habitasse. Est ultricies integer quis auctor elit sed vulputate mi sit. Nunc consequat interdum varius sit amet mattis vulputate enim. Semper feugiat nibh sed pulvinar. Eget felis eget nunc lobortis mattis aliquam. Ultrices vitae auctor eu augue. Tellus molestie nunc non blandit massa enim nec dui. Pharetra massa massa ultricies mi quis hendrerit dolor. Nisl suscipit adipiscing bibendum est ultricies integer.

', - contentExcerpt: - '

@peter-lustig

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Turpis egestas pretium aenean pharetra …

', - post, - author: user, - }, - reviewed: [ - { - updatedAt: '2019-10-30T15:38:25.184Z', - moderator: { - __typename: 'User', - ...user, - name: 'Moderator', - id: 'moderator', - slug: 'moderator', - }, - }, - { - updatedAt: '2019-10-29T15:38:25.184Z', - moderator: { - __typename: 'User', - ...user, - name: 'Peter Lustig', - id: 'u3', - slug: 'peter-lustig', - }, - }, - ], - }, - { - __typename: 'Report', - closed: false, - createdAt: '2019-10-31T15:36:02.106Z', - updatedAt: '2019-12-03T15:56:35.651Z', - disable: true, - filed: [ - { - __typename: 'FILED', - createdAt: '2019-10-31T15:36:02.106Z', - reasonCategory: 'discrimination_etc', - reasonDescription: 'This post is bigoted', - submitter: { - ...user, - }, - }, - ], - resource: { - __typename: 'Post', - author: { - ...user, - id: 'u7', - name: 'Dagobert', - slug: 'dagobert', - }, - deleted: false, - disabled: false, - id: 'p2', - slug: 'bigoted-post', - title: "I'm a bigoted post!", - }, - reviewed: null, - }, - { - __typename: 'Report', - closed: true, - createdAt: '2019-10-30T15:36:02.106Z', - updatedAt: '2019-12-01T15:56:35.651Z', - disable: true, - filed: [ - { - __typename: 'FILED', - createdAt: '2019-10-30T15:36:02.106Z', - reasonCategory: 'discrimination_etc', - reasonDescription: 'this user is attacking me for who I am!', - submitter: { - ...user, - }, - }, - ], - resource: { - __typename: 'User', - commentedCount: 0, - contributionsCount: 0, - deleted: false, - disabled: true, - followedByCount: 0, - id: 'u5', - name: 'Abusive user', - slug: 'abusive-user', - }, - reviewed: [ - { - updatedAt: '2019-12-01T15:56:35.651Z', - moderator: { - __typename: 'User', - ...user, - name: 'Peter Lustig', - id: 'u3', - slug: 'peter-lustig', - }, - }, - { - updatedAt: '2019-11-30T15:56:35.651Z', - moderator: { - __typename: 'User', - ...user, - name: 'Moderator', - id: 'moderator', - slug: 'moderator', - }, - }, - ], - }, -] - -storiesOf('ReportsTable', module) - .addDecorator(withA11y) - .addDecorator(helpers.layout) - .add('with reports', () => ({ - components: { ReportsTable }, - store: helpers.store, - data: () => ({ - reports, - }), - methods: { - confirm: action('confirm'), - }, - template: ``, - })) - .add('without reports', () => ({ - components: { ReportsTable }, - store: helpers.store, - template: ``, - })) diff --git a/webapp/components/_new/features/ReportsTable/ReportsTable.vue b/webapp/components/_new/features/ReportsTable/ReportsTable.vue deleted file mode 100644 index e172b1863..000000000 --- a/webapp/components/_new/features/ReportsTable/ReportsTable.vue +++ /dev/null @@ -1,50 +0,0 @@ - - - diff --git a/webapp/pages/moderation/index.vue b/webapp/pages/moderation/index.vue index 35abcaff7..abf957cac 100644 --- a/webapp/pages/moderation/index.vue +++ b/webapp/pages/moderation/index.vue @@ -3,7 +3,7 @@