<commit_before>app.controller('RequestController', function ($controller, $routeParams, $scope, ServiceRepo, StorageService, UserService) {

    angular.extend(this, $controller('AuthenticationController', {
        $scope: $scope
    }));

    if (StorageService.get('role') === 'ROLE_ANONYMOUS') {
        $scope.login();
    } else {
        UserService.userReady().then(function () {
            $scope.email = UserService.getCurrentUser().allCredentials.email;
        });

        $scope.requestForm = undefined;

        // needs to be an object for ng-disabled
        $scope.request = {};

        $scope.services = ServiceRepo.getAll();

        var clear = function (type) {
            delete $scope.type;
            delete $scope.title;
            delete $scope.description;
            delete $scope.service;
            $scope.request.sendUpdates = true;
            if ($scope.requestForm) {
                $scope.requestForm.$setPristine();
                $scope.requestForm.$setUntouched();
            }
            if (type) {
                $scope.type = type;
            }
            if ($routeParams.service) {
                $scope.service = $routeParams.service;
            }
        };

        $scope.reset = function () {
            clear();
        };

        $scope.clear = function () {
            clear($scope.type);
        };

        $scope.submit = function () {
            var request = {
                type: $scope.type,
                title: $scope.title,
                description: $scope.description
            };
            if ($scope.service) {
                request.service = $scope.service;
            }
            if ($scope.request.sendUpdates) {
                request.email = $scope.email;
            }
            ServiceRepo.submitRequest(request).then(function (res) {
                if (angular.fromJson(res.body).meta.status === 'SUCCESS') {
                    clear();
                }
            });
        };

        clear();
    }

});<commit_msg>Handled response check in the repo, not needed in controller<commit_after>app.controller('RequestController', function ($controller, $routeParams, $scope, ServiceRepo, StorageService, UserService) {

    angular.extend(this, $controller('AuthenticationController', {
        $scope: $scope
    }));

    if (StorageService.get('role') === 'ROLE_ANONYMOUS') {
        $scope.login();
    } else {
        UserService.userReady().then(function () {
            $scope.email = UserService.getCurrentUser().allCredentials.email;
        });

        $scope.requestForm = undefined;

        // needs to be an object for ng-disabled
        $scope.request = {};

        $scope.services = ServiceRepo.getAll();

        var clear = function (type) {
            delete $scope.type;
            delete $scope.title;
            delete $scope.description;
            delete $scope.service;
            $scope.request.sendUpdates = true;
            if ($scope.requestForm) {
                $scope.requestForm.$setPristine();
                $scope.requestForm.$setUntouched();
            }
            if (type) {
                $scope.type = type;
            }
            if ($routeParams.service) {
                $scope.service = $routeParams.service;
            }
        };

        $scope.reset = function () {
            clear();
        };

        $scope.clear = function () {
            clear($scope.type);
        };

        $scope.submit = function () {
            var request = {
                type: $scope.type,
                title: $scope.title,
                description: $scope.description
            };
            if ($scope.service) {
                request.service = $scope.service;
            }
            if ($scope.request.sendUpdates) {
                request.email = $scope.email;
            }
            ServiceRepo.submitRequest(request).then(function () {
                clear();
            });
        };

        clear();
    }

});
{'fraction_non_alphanumeric': 0.12786069651741294, 'fraction_numerical': 0.0, 'mean_word_length': 1.4975155279503105, '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': '3851380', 'n_tokens_mistral': 1048, 'n_tokens_neox': 1013, 'n_words': 183}