Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bots have standard notification properties set and get notified via Email #15769

Closed
apollo13 opened this issue Oct 5, 2020 · 10 comments
Closed
Labels
Bug Report/Open Bug report/issue

Comments

@apollo13
Copy link

apollo13 commented Oct 5, 2020

Summary

Bot accounts get email notification delivered to botaccountname@localhost

Steps to reproduce

I am not 100% sure if this is actually the way to reproduce, but it seems simple enough:

  • Install the gitlab mattermost plugin and activate it
  • Open a private channel with the gitlab bot
  • Send a normal text message to it (no slash command)
  • Wait till the mail notification watcher triggers

Expected behavior

Bots should not get notifications

Observed behavior (that appears unintentional)

I get a bounce notification from my mailserver since the gitlab bot received a notification for gitlab@localhost:

Auto-Submitted: auto-generated
Date: Mon, 05 Oct 2020 09:25:36 +0200
Precedence: bulk
From: "Mattermost" <mattermost@xxx>
To: gitlab@localhost
Subject: [GitLab Mattermost] New Notification for October 5, 2020
Content-Type: multipart/alternative;
 boundary=20a6a74cebc505baa3046ac6060fdf87d3f7a199cfea0debaa10b786c5be

Possible fixes

Disable notifications for bot accounts (Possibly via the EnsureBot api function)

@apollo13
Copy link
Author

apollo13 commented Oct 5, 2020

Please note that the notification is not triggered immediately (I saw a 15 minute delay or so).

@amyblais
Copy link
Member

amyblais commented Oct 5, 2020

@apollo13 What Mattermost server version are you on?

@apollo13
Copy link
Author

apollo13 commented Oct 5, 2020

@amyblais Oh sorry, not sure how I missed that. I have whatever the gitlab omnibus installer installs, which currently is:

Mattermost Version: 5.26.2
Database Schema Version: 5.26.0
Database: postgres

@amyblais
Copy link
Member

amyblais commented Oct 6, 2020

@DHaussermann Wondering if you can help test this?

@DHaussermann
Copy link

This seems quite possible but, I'm having a hard time confirming where I can see what's happening on the mail server.

Ideally what should happen when you create a bot (or convert a user to a bot), is that the email notification setting at the user level should be set to never. I'm not sure if this was ever implemented.

I'm trying to confirm this behavior on my local but I'm not sure where in the DB the user level email notification can be found.
@larkox maybe you have some suggestions on this?

@apollo13
Copy link
Author

apollo13 commented Oct 6, 2020

@DHaussermann Try the users table and the notifyprops field there. I fixed this yesterday by updating the table like this:

update users set notifyprops='{"channel":"true","comments":"never","desktop":"mention","desktop_sound":"false","email":"false","first_name":"false","mention_keys":"","push":"mention","push_status":"away"}'::json where email like '%@localhost';

The email key was true before my update.

@DHaussermann
Copy link

Thanks @apollo13 I saw that but it wasn't updating for me based on setting it in the UI (on a non-bot user). I'll take another look 👍

@apollo13
Copy link
Author

apollo13 commented Oct 6, 2020

@DHaussermann I just tested. The email key switches between true/false if you select "immediatelly"/"never" in the account settings -> notifications tab. But it will stay true also for "every hour" & "every 15 minutes" -- so that might be saved somewhere else.

@DHaussermann
Copy link

@apollo13 thanks for the help. I see the value change as expected. Somehow the query results must not have been refreshing for me when I checked earlier.

You're correct about the email notification issue. It seems there is no exception made for bot accounts to prevent this. I have opened a Jira ticket here https://mattermost.atlassian.net/browse/MM-29374 to address this. Thank you for pointing this out. Much appreciated.
cc @amyblais

@hanzei
Copy link
Contributor

hanzei commented Oct 12, 2020

Create a HW ticket: #15921

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Report/Open Bug report/issue
Projects
None yet
Development

No branches or pull requests

4 participants