diff --git a/test/api/v3/integration/notifications/POST-notifications_notificationId_read.test.js b/test/api/v3/integration/notifications/POST-notifications_notificationId_read.test.js index 9d62f960e1..02d3fd04e4 100644 --- a/test/api/v3/integration/notifications/POST-notifications_notificationId_read.test.js +++ b/test/api/v3/integration/notifications/POST-notifications_notificationId_read.test.js @@ -13,14 +13,44 @@ describe('POST /notifications/:notificationId/read', () => { it('errors when notification is not found', async () => { let dummyId = generateUUID(); - await expect(user.post(`/notifications/${dummyId}/read`)) - .to.eventually.be.rejected.and.eql({ - code: 404, - error: 'NotFound', - message: t('messageNotificationNotFound'), - }); + + await expect(user.post(`/notifications/${dummyId}/read`)).to.eventually.be.rejected.and.eql({ + code: 404, + error: 'NotFound', + message: t('messageNotificationNotFound'), + }); }); - xit('removes a notification', async () => { + it('removes a notification', async () => { + expect(user.notifications.length).to.equal(0); + + const id = generateUUID(); + const id2 = generateUUID(); + + await user.update({ + notifications: [{ + id, + type: 'DROPS_ENABLED', + data: {}, + }, { + id: id2, + type: 'LOGIN_INCENTIVE', + data: {}, + }], + }); + + await user.sync(); + expect(user.notifications.length).to.equal(2); + + const res = await user.post(`/notifications/${id}/read`); + expect(res).to.deep.equal([{ + id: id2, + type: 'LOGIN_INCENTIVE', + data: {}, + }]); + + await user.sync(); + expect(user.notifications.length).to.equal(1); + expect(user.notifications[0].id).to.equal(id2); }); }); diff --git a/test/api/v3/integration/notifications/POST-notifications_read.test.js b/test/api/v3/integration/notifications/POST-notifications_read.test.js new file mode 100644 index 0000000000..80061e220a --- /dev/null +++ b/test/api/v3/integration/notifications/POST-notifications_read.test.js @@ -0,0 +1,66 @@ +import { + generateUser, + translate as t, +} from '../../../../helpers/api-v3-integration.helper'; +import { v4 as generateUUID } from 'uuid'; + +describe('POST /notifications/:notificationId/read', () => { + let user; + + before(async () => { + user = await generateUser(); + }); + + it('errors when notification is not found', async () => { + let dummyId = generateUUID(); + + await expect(user.post('/notifications/read', { + notificationIds: [dummyId], + })).to.eventually.be.rejected.and.eql({ + code: 404, + error: 'NotFound', + message: t('messageNotificationNotFound'), + }); + }); + + it('removes multiple notifications', async () => { + expect(user.notifications.length).to.equal(0); + + const id = generateUUID(); + const id2 = generateUUID(); + const id3 = generateUUID(); + + await user.update({ + notifications: [{ + id, + type: 'DROPS_ENABLED', + data: {}, + }, { + id: id2, + type: 'LOGIN_INCENTIVE', + data: {}, + }, { + id: id3, + type: 'CRON', + data: {}, + }], + }); + + await user.sync(); + expect(user.notifications.length).to.equal(3); + + const res = await user.post('/notifications/read', { + notificationIds: [id, id3], + }); + + expect(res).to.deep.equal([{ + id: id2, + type: 'LOGIN_INCENTIVE', + data: {}, + }]); + + await user.sync(); + expect(user.notifications.length).to.equal(1); + expect(user.notifications[0].id).to.equal(id2); + }); +}); diff --git a/website/client/app.vue b/website/client/app.vue index d6953d7663..2f348969b4 100644 --- a/website/client/app.vue +++ b/website/client/app.vue @@ -292,7 +292,7 @@ export default { // @TODO: This part is hacky and could be solved with two options: // 1 - Find a way to pass fromRoot to hidden // 2 - Enforce that all modals use the hide::modal event - this.$root.$on('hidden::modal', (modalId) => { + this.$root.$on('bv::hide::modal', (modalId) => { let modalStackLength = this.$store.state.modalStack.length; let modalOnTop = this.$store.state.modalStack[modalStackLength - 1]; let modalSecondToTop = this.$store.state.modalStack[modalStackLength - 2]; diff --git a/website/client/components/auth/registerLoginReset.vue b/website/client/components/auth/registerLoginReset.vue index 4ee4a901ee..79ac0494a3 100644 --- a/website/client/components/auth/registerLoginReset.vue +++ b/website/client/components/auth/registerLoginReset.vue @@ -4,7 +4,7 @@ .seamless_stars_varied_opacity_repeat form#login-form( - v-on:submit.prevent='handleSubmit', + @submit.prevent='handleSubmit', @keyup.enter="handleSubmit", v-if="!forgotPassword && !resetPasswordSetNewOne", ) diff --git a/website/client/components/chat/chatMessages.vue b/website/client/components/chat/chatMessages.vue index 79b82846a0..2c437eca9a 100644 --- a/website/client/components/chat/chatMessages.vue +++ b/website/client/components/chat/chatMessages.vue @@ -22,7 +22,7 @@ .mentioned-icon(v-if='isUserMentioned(msg)') .message-hidden(v-if='msg.flagCount === 1 && user.contributor.admin') Message flagged once, not hidden .message-hidden(v-if='msg.flagCount > 1 && user.contributor.admin') Message hidden - .card-block + .card-body h3.leader( :class='userLevelStyle(cachedProfileData[msg.uuid])' @click="showMemberModal(msg.uuid)", @@ -59,7 +59,7 @@ .mentioned-icon(v-if='isUserMentioned(msg)') .message-hidden(v-if='msg.flagCount === 1 && user.contributor.admin') Message flagged once, not hidden .message-hidden(v-if='msg.flagCount > 1 && user.contributor.admin') Message hidden - .card-block + .card-body h3.leader( :class='userLevelStyle(cachedProfileData[msg.uuid])', @click="showMemberModal(msg.uuid)", diff --git a/website/client/components/groups/publicGuildItem.vue b/website/client/components/groups/publicGuildItem.vue index c27c6f2d11..1aeb75cce5 100644 --- a/website/client/components/groups/publicGuildItem.vue +++ b/website/client/components/groups/publicGuildItem.vue @@ -1,7 +1,7 @@