# Wrong User Status in Sidebar

**URL:** <https://forums.rocket.chat/t/wrong-user-status-in-sidebar/8616>\
**Category:** Community Support\
**Created:** [September 22, 2020, 12:35pm UTC](https://forums.rocket.chat/t/wrong-user-status-in-sidebar/8616 "2020-09-22T12:35:18Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![danielh](https://sea1.discourse-cdn.com/flex021/user_avatar/forums.rocket.chat/danielh/32/2179_2.png) [@danielh](https://forums.rocket.chat/u/danielh)\
**Post date:** [September 22, 2020, 12:35pm UTC](https://forums.rocket.chat/t/wrong-user-status-in-sidebar/8616/1 "2020-09-22T12:35:19Z")

</div>

### Description

Our Rocket chat sidebar show almost every user as offline, even though their status is different (e.g. online or away). In the admin panel under “Users”, their correct status is displayed, but still the sidebar shows them as offine.  
Thanks you very much in advance for you help!

### Server Setup Information

- Version of Rocket.Chat Server: 3.6.2
- Operating System: Ubuntu 18.04
- Deployment Method: snaps (followed: [https://docs.rocket.chat/installation/manual-installation/ubuntu](https://docs.rocket.chat/installation/manual-installation/ubuntu))
- Number of Running Instances: 1
- DB Replicaset Oplog:
- NodeJS Version: v12.18.3
- MongoDB Version: v4.0.19
- Proxy: nginx
- Firewalls involved: no

### Any additional Information

Repeatedly found this error in the logs:

I20200921-15:14:32.677(0) Exception in defer callback: TypeError: Cannot read property ‘filter’ of undefined at RocketChatIntegrationHandler.getTriggersToExecute (app/integrations/server/lib/triggerHandler.js:505:16) at RocketChatIntegrationHandler.executeTriggers (app/integrations/server/lib/triggerHandler.js:576:34) at \_wrapperFunction (app/integrations/server/triggers.js:6:38) at app/callbacks/lib/callbacks.js:147:65 at Meteor.EnvironmentVariable.EVp.withValue (packages/meteor.js:1234:12) at packages/meteor.js:550:25 at runWithEnvironment (packages/meteor.js:1286:24)

---

<div class="post-metadata">

**Author:** ![fdellwing](https://sea1.discourse-cdn.com/flex021/user_avatar/forums.rocket.chat/fdellwing/32/1737_2.png) [@fdellwing](https://forums.rocket.chat/u/fdellwing)\
**Post date:** [September 22, 2020, 1:15pm UTC](https://forums.rocket.chat/t/wrong-user-status-in-sidebar/8616/2 "2020-09-22T13:15:25Z")

</div>

RC seems to not fetch the status of a user as long as the user is not in view. But it should fetch the status as soon as it becomes visible (usually takes 1-2 seconds).

---

<div class="post-metadata">

**Author:** ![danielh](https://sea1.discourse-cdn.com/flex021/user_avatar/forums.rocket.chat/danielh/32/2179_2.png) [@danielh](https://forums.rocket.chat/u/danielh)\
**Post date:** [September 22, 2020, 2:07pm UTC](https://forums.rocket.chat/t/wrong-user-status-in-sidebar/8616/3 "2020-09-22T14:07:43Z")

</div>

Thanks for your response. Unfortunately, even when chatting with someone they still appear as offline, but not everywhere, let me be more precise:

- offline in the user list
- offline in the header on top of the chat  
BUT
- online in the user info sidebar on the right that appears when I click the user name

Any ideas? I came across this, maybe that’s related?

> <https://github.com/RocketChat/Rocket.Chat/issues/17260>
>
> Description:
> After I upgrade to 3.1.0, All other users show offline. There is two way I can show online back:
> click the others...

The output of db.rocketchat\_room.findOne({}) gives me this, so it seems the UID field is missing? What can I do to fix this if that’s the cause?

```
rs01:PRIMARY> db.rocketchat_room.findOne({})
{
	"_id" : "386p6cvp5BqKqtnoQ8vjfBGwTZfJ3noxHq",
	"_updatedAt" : ISODate("2020-05-25T06:51:49.658Z"),
	"msgs" : 50,
	"t" : "d",
	"ts" : ISODate("2020-04-01T12:08:45.228Z"),
	"usernames" : [
		"***",
		"***"
	],
	"usersCount" : 2,
	"lastMessage" : {
		"_id" : "ZHLRs25akLEGFhQCY",
		"rid" : "386p6cvp5BqKqtnoQ8vjfBGwTZfJ3noxHq",
		"msg" : "ok alles klar",
		"ts" : ISODate("2020-05-25T06:51:49.644Z"),
		"u" : {
			"_id" : "***",
			"username" : "***",
			"name" : "***"
		},
		"mentions" : [],
		"channels" : [],
		"_updatedAt" : ISODate("2020-05-25T06:51:49.648Z"),
		"sandstormSessionId" : null
	},
	"lm" : ISODate("2020-05-25T06:51:49.644Z")
}
```

---

<div class="post-metadata">

**Author:** ![denchik](https://avatars.discourse-cdn.com/v4/letter/d/3da27b/32.png) [@denchik](https://forums.rocket.chat/u/denchik)\
**Post date:** [October 8, 2020, 7:15pm UTC](https://forums.rocket.chat/t/wrong-user-status-in-sidebar/8616/4 "2020-10-08T19:15:22Z")

</div>

Hey there.  
We have the same problem on fresh install.  
Version: 3.7.0

---

<div class="post-metadata">

**Author:** ![danielh](https://sea1.discourse-cdn.com/flex021/user_avatar/forums.rocket.chat/danielh/32/2179_2.png) [@danielh](https://forums.rocket.chat/u/danielh)\
**Post date:** [October 9, 2020, 8:03am UTC](https://forums.rocket.chat/t/wrong-user-status-in-sidebar/8616/5 "2020-10-09T08:03:33Z")

</div>

Hey,

did you upgrade from a very old version directly to 3.7.0?  
Because, in our case this seemed to be the problem, as we were bypassing some required database migrations by just restoring the old database into the new rocket chat.

Meanwhile, we found a solution that worked for us. As mentioned in one of the links in my first post, our rooms where missing the uids field, so I wrote a script to fix this.

If your problem comes from the same root cause, the following script may help (use at your own risk!):

```
db = new Mongo().getDB("rocketchat");

result = db.rocketchat_room.find({"t" : "d"}).forEach(room => {
  username1 = room.usernames[0];
  username2 = room.usernames[1];
  if(!username1 || !username2) return;

  print(`fixing room of ` + username1 + ` and ` + username2);

  user1 = db.users.findOne({"username" : username1});
  uid1 = user1._id;
  //print(uid1);
  user2 = db.users.findOne({"username" : username2});
  uid2 = user2._id;
  //print(uid2);

  print(`Currently set uids: ` + room.uids);

  room.uids = [uid1, uid2];

  print(`Newly set uids: ` + room.uids);

  db.rocketchat_room.save(room);
});
```

---

<div class="post-metadata">

**Author:** ![denchik](https://avatars.discourse-cdn.com/v4/letter/d/3da27b/32.png) [@denchik](https://forums.rocket.chat/u/denchik)\
**Post date:** [October 9, 2020, 9:33am UTC](https://forums.rocket.chat/t/wrong-user-status-in-sidebar/8616/6 "2020-10-09T09:33:06Z")

</div>

Hey,  
no, in our case it’s a new setup with a new database… But I’ll look into your script and try it in a test environment. Thanks!

---

<div class="post-metadata">

**Author:** ![denchik](https://avatars.discourse-cdn.com/v4/letter/d/3da27b/32.png) [@denchik](https://forums.rocket.chat/u/denchik)\
**Post date:** [October 10, 2020, 9:33am UTC](https://forums.rocket.chat/t/wrong-user-status-in-sidebar/8616/7 "2020-10-10T09:33:54Z")

</div>

@danielh, just checked if the rooms had “uids” field, and they do. So, it seems the root of the problem in our case lies somewhere else…

---

<div class="post-metadata">

**Author:** ![deolsunny533](https://avatars.discourse-cdn.com/v4/letter/d/5fc32e/32.png) [@deolsunny533](https://forums.rocket.chat/u/deolsunny533)\
**Post date:** [October 16, 2020, 8:38am UTC](https://forums.rocket.chat/t/wrong-user-status-in-sidebar/8616/8 "2020-10-16T08:38:16Z")

</div>

Damm even I am having a similar kind of issue, I have searched all over the internet and even have posted on number of threads on different forum, no solution seems to work. I am really frustrated, can anyone of you here help me resolve this issue, I am very much tired now.

---

<div class="post-metadata">

**Author:** ![dev-mgr](https://avatars.discourse-cdn.com/v4/letter/d/f17d59/32.png) [@dev-mgr](https://forums.rocket.chat/u/dev-mgr)\
**Post date:** [December 21, 2020, 12:38pm UTC](https://forums.rocket.chat/t/wrong-user-status-in-sidebar/8616/9 "2020-12-21T12:38:03Z")

</div>

Seems to be fixed in 3.0.8 hopefully!

> <https://github.com/RocketChat/Rocket.Chat/issues/19209>
>
> Description:
> When someone becomes online/away/offline their status is not changed until you refresh a webpage or reopen the application. Also, user status...

---

<div class="post-metadata">

**Author:** ![deolsunny533](https://avatars.discourse-cdn.com/v4/letter/d/5fc32e/32.png) [@deolsunny533](https://forums.rocket.chat/u/deolsunny533)\
**Post date:** [December 30, 2020, 11:09am UTC](https://forums.rocket.chat/t/wrong-user-status-in-sidebar/8616/10 "2020-12-30T11:09:08Z")

</div>

yea it’s fixed now thanks[!](https://cartoonhd.onl)

---

<div class="post-metadata">

**Author:** ![firmwarefile](https://avatars.discourse-cdn.com/v4/letter/f/838e76/32.png) [@firmwarefile](https://forums.rocket.chat/u/firmwarefile)\
**Post date:** [January 20, 2021, 6:22am UTC](https://forums.rocket.chat/t/wrong-user-status-in-sidebar/8616/11 "2021-01-20T06:22:25Z")

</div>

I was facing the same issue, now its resolved, Many thanks for posting this article.  
[F90m firmware](https://firmwareflashfiles.com/lyf-f90m/jio)
