# Chat channels broke after user deleted

**URL:** https://meta.discourse.org/t/chat-channels-broke-after-user-deleted/234858
**Category:** Bug
**Tags:** chat
**Created:** [August 2, 2022, 6:10pm UTC](https://meta.discourse.org/t/chat-channels-broke-after-user-deleted/234858 "2022-08-02T18:10:47Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Don](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/don/32/228726_2.png) [@Don](https://meta.discourse.org/u/Don)
#### Post date: [August 2, 2022, 6:10pm UTC](https://meta.discourse.org/t/chat-channels-broke-after-user-deleted/234858/1 "2022-08-02T18:10:47Z")

</div>

Hello,

I noticed on our forum the chat channels are empty after we deleted a user from Discourse, who wrote in the specific channel. I updated before I write this topic so Discourse and Discourse Chat is also on latest.

Repro:

1. Write a message in a channel with UserA
2. Delete UserA from Discourse
3. The channel is seems to empty _(the other members messages also disappears)_ with the following console error.  
 ![Screenshot 2022-08-02 at 19.44.35](https://global.discourse-cdn.com/meta/original/4X/e/8/2/e829a5b0afc7e5e115466debfbc8d2d04401196b.png)  
`Uncaught TypeError: Cannot read properties of null (reading 'username')`

Thanks 🙂

---

<div class="post-metadata">

### Author: ![mcwumbly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mcwumbly/32/103861_2.png) [@mcwumbly](https://meta.discourse.org/u/mcwumbly)
#### Post date: [August 2, 2022, 6:40pm UTC](https://meta.discourse.org/t/chat-channels-broke-after-user-deleted/234858/2 "2022-08-02T18:40:07Z")

</div>

Just confirming that I can reproduce this issue. We’ll take a look!

---

<div class="post-metadata">

### Author: ![mcwumbly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mcwumbly/32/103861_2.png) [@mcwumbly](https://meta.discourse.org/u/mcwumbly)
#### Post date: [August 5, 2022, 4:22pm UTC](https://meta.discourse.org/t/chat-channels-broke-after-user-deleted/234858/5 "2022-08-05T16:22:11Z")

</div>

We have this at the top of our list now and should have a fix sometime next week.

---

<div class="post-metadata">

### Author: ![mcwumbly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mcwumbly/32/103861_2.png) [@mcwumbly](https://meta.discourse.org/u/mcwumbly)
#### Post date: [August 8, 2022, 6:09pm UTC](https://meta.discourse.org/t/chat-channels-broke-after-user-deleted/234858/6 "2022-08-08T18:09:49Z")

</div>

Here’s the fix we just merged for this issue:

[https://github.com/discourse/discourse-chat/commit/90621d3de466f875f623e0086b19ee97eacca3f1](https://github.com/discourse/discourse-chat/commit/90621d3de466f875f623e0086b19ee97eacca3f1)

Let us know how things look after you get a chance to update your plugin.

---

<div class="post-metadata">

### Author: ![Don](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/don/32/228726_2.png) [@Don](https://meta.discourse.org/u/Don)
#### Post date: [August 8, 2022, 7:49pm UTC](https://meta.discourse.org/t/chat-channels-broke-after-user-deleted/234858/7 "2022-08-08T19:49:16Z")

</div>

Thank you so much! Works perfect! 🙂

---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [August 9, 2022, 7:00am UTC](https://meta.discourse.org/t/chat-channels-broke-after-user-deleted/234858/8 "2022-08-09T07:00:55Z")

</div>

This topic was automatically closed after 10 hours. New replies are no longer allowed.
