From aecc24e37494ca2b740849b8a1539a7c2802eb64 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Mon, 10 Jul 2023 16:21:39 +0200 Subject: [PATCH 1/7] chat message capability --- webapp/components/Chat/Chat.vue | 106 ++++++++++---------------------- webapp/graphql/Messages.js | 13 ++++ 2 files changed, 44 insertions(+), 75 deletions(-) diff --git a/webapp/components/Chat/Chat.vue b/webapp/components/Chat/Chat.vue index 9cd3e391a..d3fe9c4d5 100644 --- a/webapp/components/Chat/Chat.vue +++ b/webapp/components/Chat/Chat.vue @@ -28,7 +28,7 @@ diff --git a/webapp/store/chat.js b/webapp/store/chat.js index 2ee8a47ad..be4ddaec0 100644 --- a/webapp/store/chat.js +++ b/webapp/store/chat.js @@ -1,14 +1,14 @@ export const state = () => { return { showChat: false, - roomID: 'u0', + roomID: null, } } export const mutations = { SET_OPEN_CHAT(state, ctx) { state.showChat = ctx.showChat || false - state.roomID = ctx.roomID || 'u0' + state.roomID = ctx.roomID || null }, } From a4bb523cb4d1e50abc1f3c528dc01460fabf3a7d Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Tue, 11 Jul 2023 12:57:37 +0200 Subject: [PATCH 6/7] unit test for error when creating room with self --- backend/src/schema/resolvers/rooms.spec.ts | 15 +++++++++++++++ backend/src/schema/resolvers/rooms.ts | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/backend/src/schema/resolvers/rooms.spec.ts b/backend/src/schema/resolvers/rooms.spec.ts index d27c64e57..03c3d4456 100644 --- a/backend/src/schema/resolvers/rooms.spec.ts +++ b/backend/src/schema/resolvers/rooms.spec.ts @@ -92,6 +92,21 @@ describe('Room', () => { }) }) + describe('user id is self', () => { + it('throws error', async () => { + await expect( + mutate({ + mutation: createRoomMutation(), + variables: { + userId: 'chatting-user', + }, + }), + ).resolves.toMatchObject({ + errors: [{ message: 'Cannot create a room with self' }], + }) + }) + }) + describe('user id exists', () => { it('returns the id of the room', async () => { const result = await mutate({ diff --git a/backend/src/schema/resolvers/rooms.ts b/backend/src/schema/resolvers/rooms.ts index 293cd6e91..d5015a03b 100644 --- a/backend/src/schema/resolvers/rooms.ts +++ b/backend/src/schema/resolvers/rooms.ts @@ -33,7 +33,7 @@ export default { user: { id: currentUserId }, } = context if (userId === currentUserId) { - throw new Error('Cannot create a room with yourself') + throw new Error('Cannot create a room with self') } const session = context.driver.session() const writeTxResultPromise = session.writeTransaction(async (transaction) => { From 40dea1736011662c1251c6f80c8b56e266771cd8 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Tue, 11 Jul 2023 13:05:01 +0200 Subject: [PATCH 7/7] update TODO-next-update.md for 2.7.0-470 --- deployment/TODO-next-update.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/deployment/TODO-next-update.md b/deployment/TODO-next-update.md index 8630275b7..8e30d1f47 100644 --- a/deployment/TODO-next-update.md +++ b/deployment/TODO-next-update.md @@ -2,6 +2,10 @@ When you overtake this deploy and rebrand repo to your network you have to recognize the following changes and doings: +## Version >= 2.7.0 with 'ocelotDockerVersionTag' 2.7.0-470 + +- You have to rename all `.js` files to `.ts` in `branding/constants` + ## Version >= 2.4.0 with 'ocelotDockerVersionTag' 2.4.0-298 - You have to set `SHOW_CONTENT_FILTER_HEADER_MENU` and `SHOW_CONTENT_FILTER_MASONRY_GRID` in `branding/constants/filter.js` originally in main code file `webapp/constants/filter.js` to your preferred value.