Skip to content

Conversation

@mpdbl
Copy link
Contributor

@mpdbl mpdbl commented Jun 14, 2019

Introduce setting to enable infinite desktop notification duration until user interacts

These changes implement this feature request

These changes allow for the desktop notifications on browser clients to stay visible indefinitly until the user acknowledges the notification by closing the widget or clicking on the notification to get to the message.
Therefore the parameter Notification.requireInteraction is used, which is available for Google Chrome Version > 50 or other browsers

Benefits

If needed the site administrator can use this setting to enable their users to reduce the count of missed messages due to the user not beeing present in front of the client at any moment.

Using this settings the notification ...

image
... stays on top of other opened windows despite the fact that the message duration is set to the browsers default settings (approximately 20s) until the user interacts with it (close or click at the message)

Changes and additions in detail

Accounts - Default User Preferences

The global default preference. Default value is false.
image

User - Preferences - Notifications

The users preference defaults to the value of the global preference or the otherwise selected value.
image

REST API: Endpoint users.setPreferences

Added the parameter desktopNotificationRequireInteraction to change the setting for a specific user.

curl -H "X-Auth-Token: 9HqLlyZOugoStsXCUfD_0YdwnNnunAJF8V47U3QHXSq" \
     -H "X-User-Id: aobEdbYhXfu5hkeqG" \
     -H "Content-type:application/json" \
     http://localhost:3000/api/v1/users.setPreferences \
     -d '{ "userId": "xyz", "data": {"desktopNotificationRequireInteraction": true } }'

Results in:

{
    "user": {
        "_id": "xyz",
        "settings": {
            "preferences": {
                "desktopNotificationRequireInteraction": true,
                "language": "en"
            }
        }
    },
    "success": true
}

@mpdbl
Copy link
Contributor Author

mpdbl commented Jun 25, 2019

@tassoevan it would be great if you could review this. Thank you.

@mpdbl
Copy link
Contributor Author

mpdbl commented Aug 5, 2019

@tassoevan do you have any other recommendations on this PR, because I believe this setting could improve usage for users depending on browser clients and therefor would like it to see it progressing.

@ggazzo ggazzo added this to the 2.3.0 milestone Oct 21, 2019
@sampaiodiego sampaiodiego added the documentation: needed Needs addition/changes to documentation label Nov 21, 2019
@sampaiodiego sampaiodiego changed the title [NEW] Introduce optional setting desktop notification require interaction [NEW] Setting to dismiss desktop notification only after interaction Nov 21, 2019
@sampaiodiego sampaiodiego merged commit b3be11b into RocketChat:develop Nov 21, 2019
@sampaiodiego
Copy link
Member

thank you @mpdbl for your contribution.. =D

do you mind opening a PR to update our documentation as well? this doc needs to updated with the new property you have added.

@mpdbl mpdbl deleted the desktop-notification-require-interaction branch November 21, 2019 10:14
@danel1
Copy link

danel1 commented Nov 29, 2019

@mpdbl @tassoevan @sampaiodiego is there a way to implement this to the desktop (electron) clients too?

@mpdbl
Copy link
Contributor Author

mpdbl commented Dec 2, 2019

@mpdbl @tassoevan @sampaiodiego is there a way to implement this to the desktop (electron) clients too?

@danel1 I took a closer look at the electron client when implementing this. As far as I understod the code the desktop client uses only standard functions of the electron framework which implement the OS interface. It would have to be implemented to support all kinds of OS. This was a bit far out of my scope so I concentrated on the setting for the browser client.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants