Direct message to some users fails for one specific user

Summary

Direct message to some users fails for one specific native mattermost user.

Steps to reproduce

Im a bit unsure of how to reproduce as this only happens to one user, not observed in any other user.
This user is not imported but natively created in mattermost.
Version and configuration in our setup:
version => ‘4.9.1’
‘EnablePostUsernameOverride’ => true,
‘ExperimentalGroupUnreadChannels’ => true,

Expected behaviour

Message successfully delivered between users.

Observed behaviour

My user consequently fails to send or receive DMs to and from specific users. (like they are on some block list) Chatting with the same users in public or private channels is not issue.

When I try to initiate DM to the affected users I only receive a “Retry - Cancel” message, and no chat history is loaded. When they send me messages they dont receive any errors and the conversation is added to the chat history but it never arrives.

Hi @aro! Thank you for reporting this.

Is the issue occurring on desktop app / mobile / webapp and which browser is being used?

Hi @amy.blais, I can observe this behaviour in the webapp in Safari and Chrome, I also get it on the iOS version of the app on my iPhone and also if I connect matterircd and uses weechat, so I’m fairly certain this problem is server side and not client side.

@aro Thank you for the additional information! I am not aware of known issues around this so I will get an engineer to take a look - in the meanwhile can you help with any details on the following to narrow down the case:

  1. Can you check what your setting is set to for opening direct messages: https://docs.mattermost.com/administration/config-settings.html?highlight=direct%20message#enable-users-to-open-direct-message-channels-with?
  2. When you try to send a DM to the user, would you be able to gather any logs from around the time to see if there are any errors?
  3. Can you think of anything else that might be different for this user, e.g. any settings that might be different for them, etc.?
  1. “RestrictDirectMessage”: “any”
  2. I have access to the server, however I cant find any MM specific logs in /var/log/. I can easily get apache logs etc, but if mattermost have internal logging im unsure where I can find it.
  3. My user is part of the ops team, but it does not have sysadmin privileges. I was suspecting the matterircd plugin to be the source, but the problem persisted after I disconnected and stopped the matterircd daemon.

After reviewing the answers in the similar looking thread “Some users can not initiate Direct Message (DM)” I suspect that my user somehow have gotten its role unset.

I changed my user role to system_admin with:
./platform roles system_admin name.of.user -c /etc/mattermost.json
and suddenly DM was working however if I changed the role back to member
./platform roles member name.of.user -c /etc/mattermost.json
DM stopped working again.

So the issue is not fixed, but it looks like its a permission/role problem for my user.

https://docs.mattermost.com/administration/command-line-tools.html#platform-roles

If you followed the default Mattermost installation instructions the logs are located in /opt/mattermost/logs/mattermost.log. If they’re not there, check the Logging section of the System Console or config.json to find the location.

Also, could you find that the value for user’s role in the database when it’s not working?

@paulrothrock and @amy.blais

When its not working the roles are: "roles": "system_user" and when its working "roles":"system_admin system_user" (from /api/v3/users/me)

In the mattermost log I get the following (I have replaced the values) when I try sending a message to one of affected users:

[2018/05/16 22:56:47 CEST] [EROR] /api/v4/channels/fakerchannelpg8qdxtfbpbr/members/me:Permissions code=403 rid=fakeridgpec8a1bpsjuredcg uid=fakeuidqiqxfzqgde3ygde3y6ee ip=192.0.2.1 You do not have the appropriate permissions [details: userId=fakeuidqiqxfzqgde3ygde3y6ee, permission=read_channel]
[2018/05/16 22:56:47 CEST] [EROR] /api/v4/channels/fakerchannelpg8qdxtfbpbr/stats:Permissions code=403 rid=fakeridz1pg8qdxtfbpbrx5m uid=fakeuidqiqxfzqgde3ygde3y6ee ip=192.0.2.1 You do not have the appropriate permissions [details: userId=fakeuidqiqxfzqgde3ygde3y6ee, permission=read_channel]
[2018/05/16 22:56:48 CEST] [EROR] /api/v4/channels/fakerchannelpg8qdxtfbpbr/posts:Permissions code=403 rid=fakeride64yiwt3dtb1fdnvx uid=fakeuidqiqxfzqgde3ygde3y6ee ip=192.0.2.1 You do not have the appropriate permissions [details: userId=fakeuidqiqxfzqgde3ygde3y6ee, permission=read_channel]
[2018/05/16 22:57:12 CEST] [EROR] /api/v4/channels/fakerchannelpg8qdxtfbpbr/posts:Permissions code=403 rid=fakeridn5xfufzqcfbeecfvx uid=fakeuidqiqxfzqgde3ygde3y6ee ip=192.0.2.1 You do not have the appropriate permissions [details: userId=fakeuidqiqxfzqgde3ygde3y6ee, permission=read_channel]
[2018/05/16 22:57:14 CEST] [EROR] /api/v4/posts:Permissions code=403 rid=fakeridjy3xf5hen4sysihfa uid=fakeuidqiqxfzqgde3ygde3y6ee ip=192.0.2.1 You do not have the appropriate permissions [details: userId=fakeuidqiqxfzqgde3ygde3y6ee, permission=create_post]
[2018/05/16 22:57:21 CEST] [EROR] /api/v4/posts:Permissions code=403 rid=fakeridxwxqt1o53a97tpjy3 uid=fakeuidqiqxfzqgde3ygde3y6ee ip=192.0.2.1 You do not have the appropriate permissions [details: userId=fakeuidqiqxfzqgde3ygde3y6ee, permission=create_post]
[2018/05/16 23:00:21 CEST] [EROR] /api/v4/posts:Permissions code=403 rid=fakeridjybeih5yj8njianat uid=fakeuidqiqxfzqgde3ygde3y6ee ip=192.0.2.1 You do not have the appropriate permissions [details: userId=fakeuidqiqxfzqgde3ygde3y6ee, permission=create_post]

@aro, can you share the value of the Roles column of the ChannelMembers table for the direct message “channel” in question? The Type of a direct message “channel” will be D and its name will be a composition of the two user ids, but you can probably find this more easily if you just look in the ChannelMembers table for a channel where only you and an affected user are members.