mirror of
https://github.com/ascribe/onion.git
synced 2024-12-22 09:23:13 +01:00
Guard against the notification dropdown button missing a function
This commit is contained in:
parent
826ca08073
commit
8927ccb847
@ -11,16 +11,12 @@ import Nav from 'react-bootstrap/lib/Nav';
|
||||
import NotificationActions from '../actions/notification_actions';
|
||||
import NotificationStore from '../stores/notification_store';
|
||||
|
||||
import { mergeOptions } from '../utils/general_utils';
|
||||
import { getLangText } from '../utils/lang_utils';
|
||||
|
||||
|
||||
let HeaderNotifications = React.createClass({
|
||||
|
||||
getInitialState() {
|
||||
return mergeOptions(
|
||||
NotificationStore.getState()
|
||||
);
|
||||
return NotificationStore.getState();
|
||||
},
|
||||
|
||||
componentDidMount() {
|
||||
@ -59,10 +55,14 @@ let HeaderNotifications = React.createClass({
|
||||
NOW, THAT DIDN'T WORK - the onSelect routine isnt triggered in all cases
|
||||
Hence, we do this manually
|
||||
*/
|
||||
this.refs.dropdownbutton.setDropdownState(false);
|
||||
const { dropdownButton } = this.refs;
|
||||
|
||||
if (dropdownButton && typeof dropdownButton.setDropdownState === 'function') {
|
||||
dropdownbutton.setDropdownState(false);
|
||||
}
|
||||
},
|
||||
|
||||
getPieceNotifications(){
|
||||
getPieceNotifications() {
|
||||
if (this.state.pieceListNotifications && this.state.pieceListNotifications.length > 0) {
|
||||
return (
|
||||
<div>
|
||||
@ -87,7 +87,7 @@ let HeaderNotifications = React.createClass({
|
||||
return null;
|
||||
},
|
||||
|
||||
getEditionNotifications(){
|
||||
getEditionNotifications() {
|
||||
if (this.state.editionListNotifications && this.state.editionListNotifications.length > 0) {
|
||||
return (
|
||||
<div>
|
||||
@ -114,7 +114,7 @@ let HeaderNotifications = React.createClass({
|
||||
|
||||
render() {
|
||||
if ((this.state.pieceListNotifications && this.state.pieceListNotifications.length > 0) ||
|
||||
(this.state.editionListNotifications && this.state.editionListNotifications.length > 0)){
|
||||
(this.state.editionListNotifications && this.state.editionListNotifications.length > 0)) {
|
||||
let numNotifications = 0;
|
||||
if (this.state.pieceListNotifications && this.state.pieceListNotifications.length > 0) {
|
||||
numNotifications += this.state.pieceListNotifications.length;
|
||||
@ -125,7 +125,7 @@ let HeaderNotifications = React.createClass({
|
||||
return (
|
||||
<Nav navbar right>
|
||||
<DropdownButton
|
||||
ref='dropdownbutton'
|
||||
ref='dropdownButton'
|
||||
id="header-notification-dropdown"
|
||||
eventKey="1"
|
||||
title={
|
||||
|
Loading…
Reference in New Issue
Block a user