<commit_before>'use strict';

var $cookies;
angular.injector(['ngCookies']).invoke(function(_$cookies_) {
    $cookies = _$cookies_;
});

Dashboard.config(function($httpProvider) {
    $httpProvider.defaults.headers.common = { 'Content-Type' : 'application/json;charset=utf-8' };
});

Dashboard.config(function($routeProvider, $locationProvider) {
    $routeProvider.when('/dashboard/:teamHash?/:teamName?/login', {
        templateUrl: '/dashboard/partials/login.html',
        controller: 'Login'
    }).when('/dashboard/register', {
        templateUrl: '/dashboard/partials/register.html',
        controller: 'Register'
    }).when('/dashboard/:teamHash?/:teamName?/feed/:annoId?', {
        templateUrl: '/dashboard/partials/feed.html',
        controller: 'Feed'
    }).when('/dashboard/:teamHash?/:teamName?/account', {
        templateUrl: '/dashboard/partials/account.html',
        controller: 'Account'
    }).when('/dashboard/:teamHash?/:teamName?/guide', {
        templateUrl: '/dashboard/partials/getstarted.html',
        controller: 'GetStarted'
    }).when('/dashboard/:teamHash?/:teamName?/members', {
        templateUrl: '/dashboard/partials/members.html',
        controller: 'Members'
    }).when('/dashboard/:teamHash?/:teamName?', {
        redirectTo: function(params, current_url) {
            var action_page = angular.equals($cookies.authenticated, "true") ? '/feed' : '/login';
            return current_url + action_page;
        }
    }).otherwise({
        redirectTo: '/dashboard'
    });

    $locationProvider.html5Mode({ enabled: true, requireBase: false });
});

Dashboard.run(function($rootScope, $location, $cookieStore) {
    $rootScope.$on("$routeChangeStart", function(event, next, current) {
        var redirectTo, redirectURL;

        if ($cookieStore.get('authenticated')) {
            if (next.templateUrl === "/dashboard/partials/login.html") {
                redirectTo = "feed";
            }
        } else {
            redirectTo = "login";
            if (angular.equals(next.controller, "Register")) {
                redirectTo = "register";
            }
<commit_msg>[Dashboard] Redirect to feed page if user is logged in and goes to register page<commit_after>'use strict';

var $cookies;
angular.injector(['ngCookies']).invoke(function(_$cookies_) {
    $cookies = _$cookies_;
});

Dashboard.config(function($httpProvider) {
    $httpProvider.defaults.headers.common = { 'Content-Type' : 'application/json;charset=utf-8' };
});

Dashboard.config(function($routeProvider, $locationProvider) {
    $routeProvider.when('/dashboard/:teamHash?/:teamName?/login', {
        templateUrl: '/dashboard/partials/login.html',
        controller: 'Login'
    }).when('/dashboard/register', {
        templateUrl: '/dashboard/partials/register.html',
        controller: 'Register'
    }).when('/dashboard/:teamHash?/:teamName?/feed/:annoId?', {
        templateUrl: '/dashboard/partials/feed.html',
        controller: 'Feed'
    }).when('/dashboard/:teamHash?/:teamName?/account', {
        templateUrl: '/dashboard/partials/account.html',
        controller: 'Account'
    }).when('/dashboard/:teamHash?/:teamName?/guide', {
        templateUrl: '/dashboard/partials/getstarted.html',
        controller: 'GetStarted'
    }).when('/dashboard/:teamHash?/:teamName?/members', {
        templateUrl: '/dashboard/partials/members.html',
        controller: 'Members'
    }).when('/dashboard/:teamHash?/:teamName?', {
        redirectTo: function(params, current_url) {
            var action_page = angular.equals($cookies.authenticated, "true") ? '/feed' : '/login';
            return current_url + action_page;
        }
    }).otherwise({
        redirectTo: '/dashboard'
    });

    $locationProvider.html5Mode({ enabled: true, requireBase: false });
});

Dashboard.run(function($rootScope, $location, $cookieStore) {
    $rootScope.$on("$routeChangeStart", function(event, next, current) {
        var redirectTo, redirectURL;

        if ($cookieStore.get('authenticated')) {
            if (angular.equals(next.controller, "Login") ||
                angular.equals(next.controller, "Register")) {
                redirectTo = "feed";
            }
        } else {
            redirectTo = "login";
            if (angular.equals(next.controller, "Register")) {
                redirectTo = "register";
            }

{'fraction_non_alphanumeric': 0.1662480018269011, 'fraction_numerical': 0.0009134505594884677, 'mean_word_length': 3.010989010989011, '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': '4082624', 'n_tokens_mistral': 1254, 'n_tokens_neox': 1291, 'n_words': 194}