function inviteUserDB(invitedUser) {
    var invitedUserInvites;
    if(invitedUser.invites == undefined || invitedUser.invites == null){
      invitedUserInvites = [];
    } else {
      invitedUserInvites = invitedUser.invites;
    }
    invitedUserInvites.push(user.uid);

    if(invitedUser.invites != undefined) {
      firebase.database().ref("users/" + invitedUser.uid).update({
        invites: invitedUserInvites
      });
    } else {
      //console.log("New Invite List");
      firebase.database().ref("users/" + invitedUser.uid).update({invites:{0:user.uid}});
    }

    var notificationString = generateNotificationString(user.name, "invites.html");
    var invitedUserNotificiations;
    if(invitedUser.notifications == undefined || invitedUser.notifications == null){
      invitedUserNotificiations = [];
    } else {
      invitedUserNotificiations = invitedUser.notifications;
    }
    invitedUserNotificiations.push(notificationString);

    if(invitedUser.notifications != undefined) {
      firebase.database().ref("users/" + invitedUser.uid).update({
        notifications: invitedUserNotificiations
      });
    } else {
      console.log("New Notifications List");
      firebase.database().ref("users/" + invitedUser.uid).update({notifications:{0:notificationString}});
    }
  }
//This function invites a valid user to view the current user's friend list.
This function invites a valid user to view the current user's friend list.
This function invites a valid user to view the current user ' s friend list .
function inviteUserDB(invitedUser) {
    var invitedUserInvites;
    if(invitedUser.invites == undefined || invitedUser.invites == null){
      invitedUserInvites = [];
    } else {
      invitedUserInvites = invitedUser.invites;
    }
    invitedUserInvites.push(user.uid);
    if(invitedUser.invites != undefined) {
      firebase.database().ref("users/" + invitedUser.uid).update({
        invites: invitedUserInvites
      });
    } else {
      firebase.database().ref("users/" + invitedUser.uid).update({invites:{0:user.uid}});
    }
    var notificationString = generateNotificationString(user.name, "invites.html");
    var invitedUserNotificiations;
    if(invitedUser.notifications == undefined || invitedUser.notifications == null){
      invitedUserNotificiations = [];
    } else {
      invitedUserNotificiations = invitedUser.notifications;
    }
    invitedUserNotificiations.push(notificationString);
    if(invitedUser.notifications != undefined) {
      firebase.database().ref("users/" + invitedUser.uid).update({
        notifications: invitedUserNotificiations
      });
    } else {
      console.log("New Notifications List");
      firebase.database().ref("users/" + invitedUser.uid).update({notifications:{0:notificationString}});
    }
  }
function inviteUserDB ( invitedUser ) { var invitedUserInvites ; if ( invitedUser . invites == undefined || invitedUser . invites == null ) { invitedUserInvites = [ ] ; } else { invitedUserInvites = invitedUser . invites ; } invitedUserInvites . push ( user . uid ) ; if ( invitedUser . invites != undefined ) { firebase . database ( ) . ref ( "users/" + invitedUser . uid ) . update ( { invites : invitedUserInvites } ) ; } else { firebase . database ( ) . ref ( "users/" + invitedUser . uid ) . update ( { invites : { 0 : user . uid } } ) ; } var notificationString = generateNotificationString ( user . name , "invites.html" ) ; var invitedUserNotificiations ; if ( invitedUser . notifications == undefined || invitedUser . notifications == null ) { invitedUserNotificiations = [ ] ; } else { invitedUserNotificiations = invitedUser . notifications ; } invitedUserNotificiations . push ( notificationString ) ; if ( invitedUser . notifications != undefined ) { firebase . database ( ) . ref ( "users/" + invitedUser . uid ) . update ( { notifications : invitedUserNotificiations } ) ; } else { console . log ( "New Notifications List" ) ; firebase . database ( ) . ref ( "users/" + invitedUser . uid ) . update ( { notifications : { 0 : notificationString } } ) ; } }
This function invites a valid user to view the current user's friend list.
This function invites a valid user to view the current user ' s friend list .
//console.log("New Invite List");