@@ -265,6 +269,7 @@ import SearchField from '~/components/features/SearchField/SearchField.vue'
import NotificationMenu from '~/components/NotificationMenu/NotificationMenu'
import links from '~/constants/links.js'
import PageParamsLink from '~/components/_new/features/PageParamsLink/PageParamsLink.vue'
+import ChatNotificationMenu from '~/components/ChatNotificationMenu/ChatNotificationMenu'
export default {
components: {
@@ -278,6 +283,7 @@ export default {
NotificationMenu,
PageParamsLink,
SearchField,
+ ChatNotificationMenu,
},
props: {
showMobileMenu: { type: Boolean, default: false },
diff --git a/webapp/components/NotificationMenu/NotificationMenu.vue b/webapp/components/NotificationMenu/NotificationMenu.vue
index a8609f582..72f539a42 100644
--- a/webapp/components/NotificationMenu/NotificationMenu.vue
+++ b/webapp/components/NotificationMenu/NotificationMenu.vue
@@ -149,7 +149,7 @@ export default {
return {
notifications: unionBy(
[newNotification],
- previousResult.notifications,
+ previousResult?.notifications,
(notification) => notification.id,
).sort((a, b) => new Date(b.updatedAt) - new Date(a.updatedAt)),
}
diff --git a/webapp/graphql/Messages.js b/webapp/graphql/Messages.js
new file mode 100644
index 000000000..099a7265e
--- /dev/null
+++ b/webapp/graphql/Messages.js
@@ -0,0 +1,15 @@
+import gql from 'graphql-tag'
+
+export const messageQuery = () => {
+ return gql`
+ query ($roomId: ID!) {
+ Message(roomId: $roomId) {
+ id
+ content
+ author {
+ id
+ }
+ }
+ }
+ `
+}
diff --git a/webapp/graphql/PostMutations.js b/webapp/graphql/PostMutations.js
index c3a9369c3..73e9f8ebe 100644
--- a/webapp/graphql/PostMutations.js
+++ b/webapp/graphql/PostMutations.js
@@ -39,6 +39,7 @@ export default () => {
deleted
postType
author {
+ id
name
}
categories {
diff --git a/webapp/graphql/Rooms.js b/webapp/graphql/Rooms.js
new file mode 100644
index 000000000..e8f1d9f6f
--- /dev/null
+++ b/webapp/graphql/Rooms.js
@@ -0,0 +1,12 @@
+import gql from 'graphql-tag'
+
+export const roomQuery = () => gql`
+ query {
+ Room {
+ id
+ users {
+ id
+ }
+ }
+ }
+`
diff --git a/webapp/graphql/User.js b/webapp/graphql/User.js
index f7fd3c940..fcdac0989 100644
--- a/webapp/graphql/User.js
+++ b/webapp/graphql/User.js
@@ -243,6 +243,7 @@ export const notificationAdded = () => {
${userFragment}
${commentFragment}
${postFragment}
+ ${groupFragment}
subscription notifications($userId: ID!) {
notificationAdded(userId: $userId) {
@@ -251,6 +252,9 @@ export const notificationAdded = () => {
reason
createdAt
updatedAt
+ to {
+ ...user
+ }
from {
__typename
... on Post {
@@ -271,6 +275,12 @@ export const notificationAdded = () => {
}
}
}
+ ... on Group {
+ ...group
+ }
+ }
+ relatedUser {
+ ...user
}
}
}
diff --git a/webapp/layouts/default.spec.js b/webapp/layouts/default.spec.js
index bf54d3581..1b83491d7 100644
--- a/webapp/layouts/default.spec.js
+++ b/webapp/layouts/default.spec.js
@@ -36,6 +36,9 @@ describe('default.vue', () => {
store = new Vuex.Store({
getters: {
'auth/isLoggedIn': () => true,
+ 'chat/showChat': () => {
+ return { showChat: false, roomID: 'u0' }
+ },
},
})
})
diff --git a/webapp/layouts/default.vue b/webapp/layouts/default.vue
index 524a530d1..ae6c10b73 100644
--- a/webapp/layouts/default.vue
+++ b/webapp/layouts/default.vue
@@ -13,21 +13,32 @@
+
+
+ RoomID: {{ $store.getters['chat/showChat'].roomID }}
+
+ x
+
+
+
+
+ >
-
diff --git a/webapp/pages/profile/_id/_slug.vue b/webapp/pages/profile/_id/_slug.vue
index 06e95abb4..62d2f1be7 100644
--- a/webapp/pages/profile/_id/_slug.vue
+++ b/webapp/pages/profile/_id/_slug.vue
@@ -79,6 +79,15 @@
@optimistic="optimisticFollow"
@update="updateFollow"
/>
+
+
+
diff --git a/webapp/plugins/vue-advanced-chat.js b/webapp/plugins/vue-advanced-chat.js
new file mode 100644
index 000000000..487f1d213
--- /dev/null
+++ b/webapp/plugins/vue-advanced-chat.js
@@ -0,0 +1,6 @@
+import { register } from 'vue-advanced-chat'
+export default ({ app }) => {
+ if (process.client) {
+ register()
+ }
+}
diff --git a/webapp/static/img/empty/chat-bubble.svg b/webapp/static/img/empty/chat-bubble.svg
new file mode 100644
index 000000000..b840e9c37
--- /dev/null
+++ b/webapp/static/img/empty/chat-bubble.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/webapp/store/chat.js b/webapp/store/chat.js
new file mode 100644
index 000000000..2ee8a47ad
--- /dev/null
+++ b/webapp/store/chat.js
@@ -0,0 +1,22 @@
+export const state = () => {
+ return {
+ showChat: false,
+ roomID: 'u0',
+ }
+}
+
+export const mutations = {
+ SET_OPEN_CHAT(state, ctx) {
+ state.showChat = ctx.showChat || false
+ state.roomID = ctx.roomID || 'u0'
+ },
+}
+
+export const getters = {
+ showChat(state) {
+ return state
+ },
+ roomID(state) {
+ return state
+ },
+}
diff --git a/webapp/yarn.lock b/webapp/yarn.lock
index df00613b7..6b95b979b 100644
--- a/webapp/yarn.lock
+++ b/webapp/yarn.lock
@@ -10503,6 +10503,11 @@ emittery@^0.13.1:
resolved "https://registry.yarnpkg.com/emittery/-/emittery-0.13.1.tgz#c04b8c3457490e0847ae51fced3af52d338e3dad"
integrity sha512-DeWwawk6r5yR9jFgnDKYt4sLS0LmHJJi3ZOnb5/JdbYwj3nW+FxQnHIjhBKz8YLC7oRNPVM9NQ47I3CVx34eqQ==
+emoji-picker-element@1.12.1:
+ version "1.12.1"
+ resolved "https://registry.yarnpkg.com/emoji-picker-element/-/emoji-picker-element-1.12.1.tgz#854a9bbae4d9a04fa2b5cd0763845921f4904c83"
+ integrity sha512-F9AY/re8uqZmBcCXLHLGvyy7fxuMQdZl9R8OToLRH8Vnns+WMX8RYUbI2nSJklzl5+82qzpYWeus1/puDepWcQ==
+
emoji-regex@^7.0.1:
version "7.0.3"
resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-7.0.3.tgz#933a04052860c85e83c122479c4748a8e4c72156"
@@ -14729,6 +14734,11 @@ linkify-it@~3.0.2:
dependencies:
uc.micro "^1.0.1"
+linkifyjs@2.1.9:
+ version "2.1.9"
+ resolved "https://registry.yarnpkg.com/linkifyjs/-/linkifyjs-2.1.9.tgz#af06e45a2866ff06c4766582590d098a4d584702"
+ integrity sha512-74ivurkK6WHvHFozVaGtQWV38FzBwSTGNmJolEgFp7QgR2bl6ArUWlvT4GcHKbPe1z3nWYi+VUdDZk16zDOVug==
+
listr-silent-renderer@^1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/listr-silent-renderer/-/listr-silent-renderer-1.1.1.tgz#924b5a3757153770bf1a8e3fbf74b8bbf3f9242e"
@@ -21951,6 +21961,14 @@ vt-pbf@^3.1.1:
"@mapbox/vector-tile" "^1.3.1"
pbf "^3.2.1"
+vue-advanced-chat@^2.0.7:
+ version "2.0.7"
+ resolved "https://registry.yarnpkg.com/vue-advanced-chat/-/vue-advanced-chat-2.0.7.tgz#bd35830c19fc5eb4e26545dc554d88e7808913cc"
+ integrity sha512-s+6v+KtVT46lFM8YohneLLS/vN10sSTAPfZiqAczXf13Q8vQWD9rSeWAokL0zuJeQ+jguNgFI6oN2wbI/RC1iw==
+ dependencies:
+ emoji-picker-element "1.12.1"
+ linkifyjs "2.1.9"
+
vue-apollo@^3.0.2:
version "3.0.2"
resolved "https://registry.yarnpkg.com/vue-apollo/-/vue-apollo-3.0.2.tgz#b198ecfa3765850a0b9f2b84ffaa7fbd8ec15f52"