diff --git a/backend/src/schema/resolvers/groups.js b/backend/src/schema/resolvers/groups.js index 4a13dcc88..5ec1700b9 100644 --- a/backend/src/schema/resolvers/groups.js +++ b/backend/src/schema/resolvers/groups.js @@ -16,6 +16,7 @@ export default { Group: async (_object, params, context, _resolveInfo) => { const { isMember, id, slug, first, offset } = params let pagination = '' + const orderBy = 'ORDER BY group.createdAt DESC' if (first !== undefined && offset !== undefined) pagination = `SKIP ${offset} LIMIT ${first}` const matchParams = { id, slug } removeUndefinedNullValuesFromObject(matchParams) @@ -29,6 +30,7 @@ export default { WITH group, membership WHERE (group.groupType IN ['public', 'closed']) OR (group.groupType = 'hidden' AND membership.role IN ['usual', 'admin', 'owner']) RETURN group {.*, myRole: membership.role} + ${orderBy} ${pagination} ` } else { @@ -39,6 +41,7 @@ export default { WITH group WHERE group.groupType IN ['public', 'closed'] RETURN group {.*, myRole: NULL} + ${orderBy} ${pagination} ` } else { @@ -48,6 +51,7 @@ export default { WITH group, membership WHERE (group.groupType IN ['public', 'closed']) OR (group.groupType = 'hidden' AND membership.role IN ['usual', 'admin', 'owner']) RETURN group {.*, myRole: membership.role} + ${orderBy} ${pagination} ` } diff --git a/webapp/components/NotificationsTable/NotificationsTable.spec.js b/webapp/components/NotificationsTable/NotificationsTable.spec.js index e48610034..0d3560787 100644 --- a/webapp/components/NotificationsTable/NotificationsTable.spec.js +++ b/webapp/components/NotificationsTable/NotificationsTable.spec.js @@ -59,8 +59,8 @@ describe('NotificationsTable.vue', () => { wrapper = Wrapper() }) - it('renders a table', () => { - expect(wrapper.find('.ds-table').exists()).toBe(true) + it('renders a grid table', () => { + expect(wrapper.find('.notification-grid').exists()).toBe(true) }) describe('renders 4 columns', () => { @@ -84,7 +84,7 @@ describe('NotificationsTable.vue', () => { describe('Post', () => { let firstRowNotification beforeEach(() => { - firstRowNotification = wrapper.findAll('tbody tr').at(0) + firstRowNotification = wrapper.findAll('.notification-grid-row').at(0) }) it('renders the author', () => { @@ -117,7 +117,7 @@ describe('NotificationsTable.vue', () => { describe('Comment', () => { let secondRowNotification beforeEach(() => { - secondRowNotification = wrapper.findAll('tbody tr').at(1) + secondRowNotification = wrapper.findAll('.notification-grid-row').at(1) }) it('renders the author', () => { diff --git a/webapp/components/NotificationsTable/NotificationsTable.vue b/webapp/components/NotificationsTable/NotificationsTable.vue index 07db4f9a2..7065b2624 100644 --- a/webapp/components/NotificationsTable/NotificationsTable.vue +++ b/webapp/components/NotificationsTable/NotificationsTable.vue @@ -1,62 +1,108 @@ - - - - - - - - - - - - - {{ $t(`notifications.reason.${scope.row.reason}`) }} - - - - + + + + + {{ field.label }} + + + + - {{ scope.row.from.title || scope.row.from.post.title | truncate(50) }} - - - - - {{ scope.row.from.contentExcerpt | removeHtml }} - - - + + + + + + + + + + + + + + + + + + + + + {{ $t(`notifications.reason.${notification.reason}`) }} + + + + + + + + + + + + + {{ notification.from.title || notification.from.post.title | truncate(50) }} + + + + + + + + {{ notification.from.contentExcerpt | removeHtml }} + + + + + + + + +