<commit_before>'use strict';

function headerController($scope, notificationService, $location, appSettings, gistData, onlineStatus) {

    notificationService.login();

    notificationService.forward('receiveNotification', $scope);
    notificationService.forward('notificationRead', $scope);
    notificationService.forward('identify', $scope);
    notificationService.forward('disconnect', $scope);

    $scope.avatar = 'https://secure.gravatar.com/avatar/' + JSON.parse(localStorage.settings).avatar;
    $scope.notifications = notificationService.notifications;

    $scope.logOut = function () {

        console.log('logging out');
        notificationService.logout();

        gistData.list = [];
        appSettings.logOut();
    };

    $scope.onlineStatus = onlineStatus;

    $scope.$watch('onlineStatus.isOnline()', function(online) {
       if (online && (!window.ioSocket.socket.connected || !window.ioSocket.socket.reconnecting) ) {
           notificationService.login();
       } else if (!online) {
           notificationService.disconnected();
       }
    });

    $scope.$on('socket:disconnect', function(e) {
       console.log('disconnected');
        notificationService.disconnected();
    });

    $scope.$on('socket:identify', function(e, data) {<commit_msg>Fixed #65 where notifications do not clear when switching user on a single session.<commit_after>'use strict';

function headerController($scope, notificationService, $location, appSettings, gistData, onlineStatus) {

    notificationService.login();

    notificationService.forward('receiveNotification', $scope);
    notificationService.forward('notificationRead', $scope);
    notificationService.forward('identify', $scope);
    notificationService.forward('disconnect', $scope);

    $scope.avatar = 'https://secure.gravatar.com/avatar/' + JSON.parse(localStorage.settings).avatar;
    $scope.notifications = notificationService.notifications;

    $scope.logOut = function () {

        console.log('logging out');
        $scope.notifications.length = 0;
        notificationService.logout();

        gistData.list = [];
        appSettings.logOut();
    };

    $scope.onlineStatus = onlineStatus;

    $scope.$watch('onlineStatus.isOnline()', function(online) {
       if (online && (!window.ioSocket.socket.connected || !window.ioSocket.socket.reconnecting) ) {
           notificationService.login();
       } else if (!online) {
           notificationService.disconnected();
       }
    });

    $scope.$on('socket:disconnect', function(e) {
       console.log('disconnected');
        notificationService.disconnected();
    });

    $scope.$on('socket:identify', function(e, data) {
{'fraction_non_alphanumeric': 0.14391967274079584, 'fraction_numerical': 0.0011156563778356265, 'mean_word_length': 3.7359154929577465, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '4996342', 'n_tokens_mistral': 728, 'n_tokens_neox': 700, 'n_words': 115}