<commit_before>import Ember from 'ember';
import Session from 'simple-auth/session';

var ObjectPromiseProxy = Ember.ObjectProxy.extend(Ember.PromiseProxyMixin);

export default Session.extend({
  firebase: Ember.inject.service(),

  getCurrentUser: function() {
    var firebase = this.get('firebase');
    var authData = firebase.getAuth();
    var {provider, uid} = authData.auth;

    return new Ember.RSVP.Promise((resolve) => {
      this.get('dataStore').query('user', {orderBy: 'uid', equalTo: uid}).then((users) => {
        var user = users.get('firstObject');

        if (user) {
          return resolve(user);
        } else {
          user = this.get('dataStore').createRecord('user', {uid, provider});

          user.save().then(() => {
            resolve(user);
          });
        }
      });
    });
  },
  currentUser: function() {
    return ObjectPromiseProxy.create({
      promise: this.getCurrentUser()
    });
  }.property('content.secure.user')
});<commit_msg>Updated current user when not logged in... WHOOPS!<commit_after>import Ember from 'ember';
import Session from 'simple-auth/session';

var ObjectPromiseProxy = Ember.ObjectProxy.extend(Ember.PromiseProxyMixin);

export default Session.extend({
  firebase: Ember.inject.service(),

  getCurrentUser: function() {
    var firebase = this.get('firebase');
    var authData = firebase.getAuth();

    if (authData) {
      var {provider, uid} = authData.auth;

      return new Ember.RSVP.Promise((resolve) => {
        this.get('dataStore').query('user', {orderBy: 'uid', equalTo: uid}).then((users) => {
          var user = users.get('firstObject');

          if (user) {
            return resolve(user);
          } else {
            user = this.get('dataStore').createRecord('user', {uid, provider});

            user.save().then(() => {
              resolve(user);
            });
          }
        });
      });
    }
  },
  currentUser: function() {
    return ObjectPromiseProxy.create({
      promise: this.getCurrentUser()
    });
  }.property('content.secure.user')
});
{'fraction_non_alphanumeric': 0.1608863198458574, 'fraction_numerical': 0.0, 'mean_word_length': 2.735611510791367, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2944502', 'n_tokens_mistral': 613, 'n_tokens_neox': 603, 'n_words': 123}