function addPrivateMessageToDB(userData, message) {
    var userNotificationArr = [];
    if(userData.notifications == undefined){
      userNotificationArr = [];
    } else {
      userNotificationArr = userData.notifications;
    }
    userNotificationArr.push(message);

    if(userData.notifications == undefined) {
      firebase.database().ref("users/" + userData.uid).update({notifications:{0:message}});
    } else {
      firebase.database().ref("users/" + userData.uid).update({
        notifications: userNotificationArr
      });
    }
  }
//This function adds the private message to the database.
This function adds the private message to the database.
This function adds the private message to the database .
function addPrivateMessageToDB(userData, message) {
    var userNotificationArr = [];
    if(userData.notifications == undefined){
      userNotificationArr = [];
    } else {
      userNotificationArr = userData.notifications;
    }
    userNotificationArr.push(message);
    if(userData.notifications == undefined) {
      firebase.database().ref("users/" + userData.uid).update({notifications:{0:message}});
    } else {
      firebase.database().ref("users/" + userData.uid).update({
        notifications: userNotificationArr
      });
    }
  }
function addPrivateMessageToDB ( userData , message ) { var userNotificationArr = [ ] ; if ( userData . notifications == undefined ) { userNotificationArr = [ ] ; } else { userNotificationArr = userData . notifications ; } userNotificationArr . push ( message ) ; if ( userData . notifications == undefined ) { firebase . database ( ) . ref ( "users/" + userData . uid ) . update ( { notifications : { 0 : message } } ) ; } else { firebase . database ( ) . ref ( "users/" + userData . uid ) . update ( { notifications : userNotificationArr } ) ; } }
This function adds the private message to the database.
This function adds the private message to the database .