<commit_before>angular.module('app.directives').directive('callerInfo', callerInfo);

function callerInfo() {
    return {
        restrict: 'E',
        scope: true,
        templateUrl: 'base/directives/caller_info.html',
        controller: CallerInfoController,
        controllerAs: 'vm',
        transclude: true,
        bindToController: true,
    };
}

CallerInfoController.$inject = ['$state', 'Account', 'Call'];
function CallerInfoController($state, Account, Call) {
    var vm = this;

    vm.fetchCallerInfo = fetchCallerInfo;

    function fetchCallerInfo() {
        ga('send', 'event', 'Caller info', 'Open', 'Topnav');

        // Get the latest call of the current user based on the internal number.
        Call.getLatestCall().$promise.then(function(callInfo) {
            var call = callInfo.call;

            if (call) {
                // There was a call for the current user, so try to find an account with the given number.
                Account.searchByPhoneNumber({number: call.caller_number}).$promise.then(function(response) {
                    if (response.data) {
                        // Account found so redirect to the account.
                        $state.go('base.accounts.detail', {id: response.data.id}, {reload: true});<commit_msg>Removed GA event from caller info controller<commit_after>angular.module('app.directives').directive('callerInfo', callerInfo);

function callerInfo() {
    return {
        restrict: 'E',
        scope: true,
        templateUrl: 'base/directives/caller_info.html',
        controller: CallerInfoController,
        controllerAs: 'vm',
        transclude: true,
        bindToController: true,
    };
}

CallerInfoController.$inject = ['$state', 'Account', 'Call'];
function CallerInfoController($state, Account, Call) {
    var vm = this;

    vm.fetchCallerInfo = fetchCallerInfo;

    function fetchCallerInfo() {
        // Get the latest call of the current user based on the internal number.
        Call.getLatestCall().$promise.then(function(callInfo) {
            var call = callInfo.call;

            if (call) {
                // There was a call for the current user, so try to find an account with the given number.
                Account.searchByPhoneNumber({number: call.caller_number}).$promise.then(function(response) {
                    if (response.data) {
                        // Account found so redirect to the account.
                        $state.go('base.accounts.detail', {id: response.data.id}, {reload: true});
{'fraction_non_alphanumeric': 0.11571879936808847, 'fraction_numerical': 0.0, 'mean_word_length': 2.460382513661202, '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': '5515729', 'n_tokens_mistral': 694, 'n_tokens_neox': 678, 'n_words': 185}