Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Make the notification slider work #420

Merged
merged 8 commits into from
Aug 18, 2016
Merged

Conversation

dbkr
Copy link
Member

@dbkr dbkr commented Aug 18, 2016

Changes notification toggle from binary everything/mentions-only to the 4 level slider. Also uses the push rule account data to update the state rather than an internal dispatch, so the state remains consistent if it's changed from a different client.

Also fixes element-hq/element-web#1495

dbkr added 3 commits August 17, 2016 18:26
The previous dispatch only did binary muted/non-muted but we now have 4 states. We now just listen for the push rules account data and update on that so it stays in sync if the pishrules are changed elsewhere.

Also add util functions used here for getting the notif state and in vector for both getting and setting it.
As it now incorrectly represents the mute as a binary toggle rather than a quad-state
@@ -179,15 +184,18 @@ module.exports = React.createClass({
var notificationCount = this.props.room.getUnreadNotificationCount();
// var highlightCount = this.props.room.getUnreadNotificationCount("highlight");

var badges = notificationCount > 0 && this._shouldShowNotifBadge();
badges |= this.props.highlight && this._shouldShowMentionBadge();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not a fan of the use of bitwise | here

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about factoring out the sub-clauses to local vars?

@richvdh richvdh assigned dbkr and unassigned richvdh Aug 18, 2016
@dbkr dbkr assigned richvdh and unassigned dbkr Aug 18, 2016
@@ -18,12 +18,19 @@ import MatrixClientPeg from './MatrixClientPeg';
import PushProcessor from 'matrix-js-sdk/lib/pushprocessor';
import q from 'q';

export const ALL_MESSAGES_LOUD = 'all_messages_loud';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would have gone for

export const NOTIFICATION_STATES = {
    ALL_MESSAGES_LOUD: 'all_messages_loud',
    ...
}

but this is fine too

@richvdh
Copy link
Member

richvdh commented Aug 18, 2016

just some minor quibbling

@richvdh richvdh assigned dbkr and unassigned richvdh Aug 18, 2016
@dbkr dbkr assigned richvdh and unassigned dbkr Aug 18, 2016
@richvdh richvdh merged commit e29be61 into develop Aug 18, 2016
@richvdh richvdh deleted the dbkr/make_notif_silder_work branch February 15, 2017 13:16
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Now push rule changes come down the eventstream as account_data, refresh when we see new rules
2 participants