mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
lint
This commit is contained in:
parent
961a260044
commit
41cca4f4ec
@ -238,15 +238,17 @@ export default {
|
|||||||
fetchPolicy: 'no-cache',
|
fetchPolicy: 'no-cache',
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
const rms = []
|
const rms = []
|
||||||
const rmsIds = []
|
const rmsIds = []
|
||||||
;[...Room, ...this.rooms].forEach((r) => {
|
;[...Room, ...this.rooms].forEach((r) => {
|
||||||
if(!rmsIds.find((v) => v === r.id)){
|
if (!rmsIds.find((v) => v === r.id)) {
|
||||||
rms.push({...r, index: r.lastMessage.date,
|
rms.push({
|
||||||
users: r.users.map((u) => {
|
...r,
|
||||||
return { ...u, username: u.name, avatar: u.avatar?.url }
|
index: r.lastMessage.date,
|
||||||
})})
|
users: r.users.map((u) => {
|
||||||
|
return { ...u, username: u.name, avatar: u.avatar?.url }
|
||||||
|
}),
|
||||||
|
})
|
||||||
rmsIds.push(r.id)
|
rmsIds.push(r.id)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -285,10 +287,12 @@ export default {
|
|||||||
fetchPolicy: 'no-cache',
|
fetchPolicy: 'no-cache',
|
||||||
})
|
})
|
||||||
|
|
||||||
const newMsgIds = Message.filter((m) => m.seen === false && m.senderId !== this.currentUser.id).map((m) => m.id)
|
const newMsgIds = Message.filter(
|
||||||
|
(m) => m.seen === false && m.senderId !== this.currentUser.id,
|
||||||
|
).map((m) => m.id)
|
||||||
if (newMsgIds.length) {
|
if (newMsgIds.length) {
|
||||||
const roomIndex = this.rooms.findIndex((r) => r.id === room.id)
|
const roomIndex = this.rooms.findIndex((r) => r.id === room.id)
|
||||||
const changedRoom = {...this.rooms[roomIndex]}
|
const changedRoom = { ...this.rooms[roomIndex] }
|
||||||
changedRoom.unreadCount = changedRoom.unreadCount - newMsgIds.length
|
changedRoom.unreadCount = changedRoom.unreadCount - newMsgIds.length
|
||||||
this.rooms[roomIndex] = changedRoom
|
this.rooms[roomIndex] = changedRoom
|
||||||
this.$apollo
|
this.$apollo
|
||||||
@ -330,7 +334,7 @@ export default {
|
|||||||
|
|
||||||
async chatMessageAdded({ data }) {
|
async chatMessageAdded({ data }) {
|
||||||
const roomIndex = this.rooms.findIndex((r) => r.id === data.chatMessageAdded.room.id)
|
const roomIndex = this.rooms.findIndex((r) => r.id === data.chatMessageAdded.room.id)
|
||||||
const changedRoom = {...this.rooms[roomIndex]}
|
const changedRoom = { ...this.rooms[roomIndex] }
|
||||||
changedRoom.lastMessage = data.chatMessageAdded
|
changedRoom.lastMessage = data.chatMessageAdded
|
||||||
changedRoom.lastMessageAt = data.chatMessageAdded.date
|
changedRoom.lastMessageAt = data.chatMessageAdded.date
|
||||||
this.rooms[roomIndex] = changedRoom
|
this.rooms[roomIndex] = changedRoom
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user