Skip to content

Commit

Permalink
Fix selectors for notification button
Browse files Browse the repository at this point in the history
This fixes the notifications shortcut in the desktop app to catch up with the new masterbar updates.
  • Loading branch information
mjangda committed Feb 10, 2016
1 parent 1a3525b commit 49b635c
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions client/lib/desktop/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,20 +86,26 @@ var Desktop = {
ipc.send( 'unread-notices-count', count );
},

clearNotificationBar: function() {
// todo find a better way. seems to be react component state based
var bar = document.querySelector( '#wpnt-notes-panel2' );
getNotificationLinkElement: function() {
return document.querySelector( '.masterbar__item-notifications' );
},

if ( bar.style.display === 'block' ) {
this.onToggleNotifications();
clearNotificationBar: function() {
// TODO: find a better way. seems to be react component state based
let notificationsLink = this.getNotificationLinkElement();
if ( notificationsLink && notificationsLink.className && notificationsLink.className.indexOf( 'is-active' ) !== -1 ) {
notificationsLink.click();
}
},

onToggleNotifications: function() {
// todo find a better way of doing this - masterbar seems to use state to toggle this
// TODO: find a better way of doing this - masterbar seems to use state to toggle this
debug( 'Toggle notifications' );

document.querySelector( '.notifications a' ).click();
let notificationsLink = this.getNotificationLinkElement();
if ( notificationsLink ) {
notificationsLink.click();
}
},

onSignout: function() {
Expand Down

0 comments on commit 49b635c

Please sign in to comment.