Skip to content

Commit 30bacea

Browse files
committed
(demo) restrict demo rooms deletion
1 parent 244c423 commit 30bacea

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

demo/src/ChatContainer.vue

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,8 @@ export default {
227227
this.rooms = this.rooms.concat(formattedRooms)
228228
this.rooms.map((room, index) => this.listenLastMessage(room, index))
229229
230+
if (!this.rooms.length) this.loadingRooms = false
231+
230232
this.listenUsersOnlineStatus()
231233
this.listenRoomsTypingUsers(query)
232234
// setTimeout(() => console.log('TOTAL', this.dbRequestCount), 2000)
@@ -642,6 +644,14 @@ export default {
642644
},
643645
644646
async deleteRoom(roomId) {
647+
const room = this.rooms.find(r => r.roomId === roomId)
648+
if (
649+
room.users.find(user => user._id === 'SGmFnBZB4xxMv9V4CVlW') ||
650+
room.users.find(user => user._id === '6jMsIXUrBHBj7o2cRlau')
651+
) {
652+
return alert('Nope, for demo purposes you cannot delete this room')
653+
}
654+
645655
const ref = messagesRef(roomId)
646656
647657
ref.get().then(res => {

0 commit comments

Comments
 (0)