<commit_before>'use strict';
exports = module.exports = [
    '$log',
    '$location',
    '$window',
    '$rootScope',
    '$scope',
    '$timeout',

    'Account',
    'respoke',

    function ($log, $location, $window, $rootScope, $scope, $timeout, Account, respoke) {
        respoke.log.setLevel('debug');
        $rootScope.justLoggedIn = false;
        $rootScope.justLoggedOut = false;
        $scope.authFailureMessage = $location.search().authFailure;

        // When failing to get a token from the server, the interval will count up
        // during respokeConnect() and continue to request tokens.
        $scope.tokenRefreshInterval = 0;

        $rootScope.systemGroupId = '';
        $rootScope.systemEndpointId = '';

        $rootScope.audio = {
            messagePrivate: new Audio('/audio/message-private.ogg'),
            messageGroup: new Audio('/audio/message-group.ogg'),
            callIncoming: new Audio('/audio/call-incoming.ogg')
        };
        // keep the audio a little low - these sounds are pretty loud.
        for (var a in $rootScope.audio) {
            $rootScope.audio[a].volume = 0.3;
        }

        $rootScope.recents = $window.recents = {};
        $rootScope.notifications = [];
        $rootScope.account = {};
        $rootScope.client = $window.client = respoke.createClient();
        $rootScope.client.listen('connect', function () {
            $log.debug('connected');
            $rootScope.$apply();

            $rootScope.client.join({
                id: $rootScope.systemGroupId,
                onSuccess: function (evt) {
                    $log.debug('joined ' + $rootScope.systemGroupId);
                },
                onError: function (evt) {
                    $log.debug('FAIL joining ' + $rootScope.systemGroupId, evt);
                }
            });

        });
        
        Account.getMe(function (err, account) {
            if (err) {
                $log.error('getMe', err);
                return;
            }
            $log.debug('getMe', account);
            $rootScope.account = account;
            $rootScope.recents[account._id] = account;
            if (!account || !account._id) {
                $location.path('/welcome');
                return;
            }<commit_msg>attempt to fix account being blank occasionally<commit_after>'use strict';
exports = module.exports = [
    '$log',
    '$location',
    '$window',
    '$rootScope',
    '$scope',
    '$timeout',

    'Account',
    'respoke',

    function ($log, $location, $window, $rootScope, $scope, $timeout, Account, respoke) {
        respoke.log.setLevel('debug');
        $rootScope.justLoggedIn = false;
        $rootScope.justLoggedOut = false;
        $scope.authFailureMessage = $location.search().authFailure;

        // When failing to get a token from the server, the interval will count up
        // during respokeConnect() and continue to request tokens.
        $scope.tokenRefreshInterval = 0;

        $rootScope.systemGroupId = '';
        $rootScope.systemEndpointId = '';

        $rootScope.audio = {
            messagePrivate: new Audio('/audio/message-private.ogg'),
            messageGroup: new Audio('/audio/message-group.ogg'),
            callIncoming: new Audio('/audio/call-incoming.ogg')
        };
        // keep the audio a little low - these sounds are pretty loud.
        for (var a in $rootScope.audio) {
            $rootScope.audio[a].volume = 0.3;
        }

        $rootScope.recents = $window.recents = {};
        $rootScope.notifications = [];
        $rootScope.account = {};
        $rootScope.client = $window.client = respoke.createClient();
        $rootScope.client.listen('connect', function () {
            $log.debug('connected');
            $rootScope.$apply();

            $rootScope.client.join({
                id: $rootScope.systemGroupId,
                onSuccess: function (evt) {
                    $log.debug('joined ' + $rootScope.systemGroupId);
                },
                onError: function (evt) {
                    $log.debug('FAIL joining ' + $rootScope.systemGroupId, evt);
                }
            });

        });
        
        Account.getMe(function (err, account) {
            if (err) {
                $log.error('getMe', err);
                return;
            }
            $log.debug('getMe', account);
            $rootScope.account = $rootScope.recents[account._id] = account;
            if (!account || !account._id) {
                $location.path('/welcome');
                return;
            }
{'fraction_non_alphanumeric': 0.13663107430812813, 'fraction_numerical': 0.0013074743952930922, 'mean_word_length': 1.7919708029197081, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '6427064', 'n_tokens_mistral': 1274, 'n_tokens_neox': 1225, 'n_words': 257}