diff --git a/backend/src/graphql/messages.ts b/backend/src/graphql/messages.ts
index 59694914a..c51950cc8 100644
--- a/backend/src/graphql/messages.ts
+++ b/backend/src/graphql/messages.ts
@@ -21,11 +21,13 @@ export const messageQuery = () => {
return gql`
query($roomId: ID!) {
Message(roomId: $roomId) {
+ _id
id
content
- author {
- id
- }
+ senderId
+ username
+ avatar
+ date
}
}
`
diff --git a/backend/src/schema/resolvers/messages.spec.ts b/backend/src/schema/resolvers/messages.spec.ts
index e3e9db17a..3ee905be9 100644
--- a/backend/src/schema/resolvers/messages.spec.ts
+++ b/backend/src/schema/resolvers/messages.spec.ts
@@ -184,20 +184,23 @@ describe('Message', () => {
describe('room exists with authenticated user chatting', () => {
it('returns the messages', async () => {
- await expect(query({
+ const result = await query({
query: messageQuery(),
variables: {
roomId,
},
- })).resolves.toMatchObject({
+ })
+ expect(result).toMatchObject({
errors: undefined,
data: {
Message: [{
id: expect.any(String),
+ _id: result.data.Message[0].id,
content: 'Some nice message to other chatting user',
- author: {
- id: 'chatting-user',
- },
+ senderId: 'chatting-user',
+ username: 'Chatting User',
+ avatar: expect.any(String),
+ date: expect.any(String),
}],
},
})
@@ -235,29 +238,32 @@ describe('Message', () => {
{
id: expect.any(String),
content: 'Some nice message to other chatting user',
- author: {
- id: 'chatting-user',
- },
+ senderId: 'chatting-user',
+ username: 'Chatting User',
+ avatar: expect.any(String),
+ date: expect.any(String),
},
{
id: expect.any(String),
content: 'A nice response message to chatting user',
- author: {
- id: 'other-chatting-user',
- },
+ senderId: 'other-chatting-user',
+ username: 'Other Chatting User',
+ avatar: expect.any(String),
+ date: expect.any(String),
},
{
id: expect.any(String),
content: 'And another nice message to other chatting user',
- author: {
- id: 'chatting-user',
- },
- }
+ senderId: 'chatting-user',
+ username: 'Chatting User',
+ avatar: expect.any(String),
+ date: expect.any(String),
+ },
],
},
})
})
- })
+ })
})
describe('room exists, authenticated user not in room', () => {
diff --git a/backend/src/schema/resolvers/messages.ts b/backend/src/schema/resolvers/messages.ts
index b692d3848..0be0298d1 100644
--- a/backend/src/schema/resolvers/messages.ts
+++ b/backend/src/schema/resolvers/messages.ts
@@ -13,7 +13,13 @@ export default {
id: context.user.id,
},
}
- return neo4jgraphql(object, params, context, resolveInfo)
+ const resolved = await neo4jgraphql(object, params, context, resolveInfo)
+ if (resolved) {
+ resolved.forEach((message) => {
+ message._id = message.id
+ })
+ }
+ return resolved
},
},
Mutation: {
diff --git a/backend/src/schema/types/type/Message.gql b/backend/src/schema/types/type/Message.gql
index 5b14104db..4a3346079 100644
--- a/backend/src/schema/types/type/Message.gql
+++ b/backend/src/schema/types/type/Message.gql
@@ -11,6 +11,11 @@ type Message {
author: User! @relation(name: "CREATED", direction: "IN")
room: Room! @relation(name: "INSIDE", direction: "OUT")
+
+ senderId: String! @cypher(statement: "MATCH (this)<-[:CREATED]-(user:User) RETURN user.id")
+ username: String! @cypher(statement: "MATCH (this)<-[:CREATED]-(user:User) RETURN user.name")
+ avatar: String @cypher(statement: "MATCH (this)<-[:CREATED]-(:User)-[:AVATAR_IMAGE]->(image:Image) RETURN image.url")
+ date: String! @cypher(statement: "RETURN this.createdAt")
}
type Mutation {
diff --git a/webapp/components/Registration/RegistrationSlideCreate.vue b/webapp/components/Registration/RegistrationSlideCreate.vue
index 0906fc8a4..141db1c4a 100644
--- a/webapp/components/Registration/RegistrationSlideCreate.vue
+++ b/webapp/components/Registration/RegistrationSlideCreate.vue
@@ -89,13 +89,13 @@
@@ -123,20 +123,22 @@
import { VERSION } from '~/constants/terms-and-conditions-version.js'
import links from '~/constants/links'
import emails from '~/constants/emails'
+import { SignupVerificationMutation } from '~/graphql/Registration.js'
+import { SweetalertIcon } from 'vue-sweetalert-icons'
import PasswordStrength from '~/components/Password/Strength'
import EmailDisplayAndVerify from './EmailDisplayAndVerify'
-import { SweetalertIcon } from 'vue-sweetalert-icons'
+import PageParamsLink from '~/components/_new/features/PageParamsLink/PageParamsLink'
import PasswordForm from '~/components/utils/PasswordFormHelper'
-import { SignupVerificationMutation } from '~/graphql/Registration.js'
import ShowPassword from '../ShowPassword/ShowPassword.vue'
export default {
name: 'RegistrationSlideCreate',
components: {
- PasswordStrength,
EmailDisplayAndVerify,
- SweetalertIcon,
+ PageParamsLink,
+ PasswordStrength,
ShowPassword,
+ SweetalertIcon,
},
props: {
sliderData: { type: Object, required: true },
diff --git a/webapp/components/_new/features/PageParamsLink/PageParamsLink.vue b/webapp/components/_new/features/PageParamsLink/PageParamsLink.vue
index 391c4722e..5d7cdeea2 100644
--- a/webapp/components/_new/features/PageParamsLink/PageParamsLink.vue
+++ b/webapp/components/_new/features/PageParamsLink/PageParamsLink.vue
@@ -1,17 +1,12 @@
-
+
@@ -21,6 +16,24 @@ export default {
name: 'PageParamsLink',
props: {
pageParams: { type: Object, required: true },
+ forceTargetBlank: { type: Boolean, default: false },
+ },
+ computed: {
+ href() {
+ return this.pageParams.isInternalPage
+ ? this.pageParams.internalPage.pageRoute
+ : this.pageParams.externalLink.url
+ },
+ target() {
+ return this.forceTargetBlank
+ ? '_blank'
+ : !this.pageParams.isInternalPage
+ ? this.pageParams.externalLink.target
+ : ''
+ },
+ isInternalLink() {
+ return !this.forceTargetBlank && this.pageParams.isInternalPage
+ },
},
}