Skip to content

Commit

Permalink
Merge pull request #3209 from Automattic/fix/desktop-notif-shortcut
Browse files Browse the repository at this point in the history
Desktop: Fix selectors for notification button
  • Loading branch information
mjangda committed Feb 10, 2016
2 parents d9c9cad + 378bda4 commit 23b9855
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
const 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();
const notificationsLink = this.getNotificationLinkElement();
if ( notificationsLink ) {
notificationsLink.click();
}
},

onSignout: function() {
Expand Down

0 comments on commit 23b9855

Please sign in to comment.