mattermost / mattermost-plugin-msteams

MS Teams plugin for Mattermost
Other
13 stars 11 forks source link

MM-60005: dont notify if present #727

Closed lieut-data closed 3 months ago

lieut-data commented 3 months ago

Summary

If a user gets a Teams notification in Mattermost and then hops over to Teams, they continue to get “spammed” by messages in the ensuing chat. Let’s detect user presence and only notify users if they aren’t available in Teams.

This also means that while a user is "Available" in Teams, they won't get notifications in Mattermost. By default, this will be the state for 5 minutes after a user was last active. Note that if a user has their mobile device connected, but in the background, it won't count against the user being seen by Mattermost as "Available" in Teams.

Ticket Link

Fixes: https://mattermost.atlassian.net/browse/MM-60005

lieut-data commented 3 months ago

@crspeller, wondering if I can get an "out of band" set of eyes on this change? Interested not only in the review itself, but any feedback you have from looking at this and related code with fresh eyes :)

lieut-data commented 3 months ago

I don't understand the Teams side - Activity vs Availability, user actions, etc.

Indeed, this is somewhat blurry for me as well @sbishel. The combination I've picked above was derived partly from documentation at https://learn.microsoft.com/en-us/microsoftteams/presence-admins and partly from manual testing.

You already know this, but I can see this causing confusion as to "When do I get notifications?"

Also agreed. It's no consolation to the enduser, but we'll be explicitly in logs when this happens. And while this swings us neatly away from the problem being solved, we could tweak it back a bit later by monitoring chats that don't get marked as read and "catch you up" in Mattermost.