<commit_before>define(['app', 'underscore', 'ngDialog',
    '/app/views/search/search-directive.js', 'scbd-angularjs-services/generic-service'], function (app, _) {

    app.directive("userPreferenceFilter", ['$rootScope', 'ngDialog', function ($rootScope, ngDialog) {

        return {
            restrict: "EA",
            templateUrl: "/app/views/register/user-preferences/user-preference-filter.html",
            replace: true,
            scope: {
                runQuery: '&',
                collection  :  '@',
                collectionFilter : '@?'
            },
            link: function ($scope, element, attrs) { 
            },
            controller: ['$scope', '$http', 'IGenericService', 'realm', function ($scope, $http, IGenericService, realm) {

                $scope.user = $rootScope.user;
                $scope.skipKeywordsFilter = false;
                $scope.skipTextFilter = false;
                if($scope.collection == "subscriptions"){
                    $scope.skipKeywordsFilter = true;
                    $scope.skipTextFilter = true;
                }

                function loadSavedFilters(){
                    if($scope.user && $scope.user.isAuthenticated){
                        var query = {};
                        if($scope.collectionFilter)
                            query = JSON.parse($scope.collectionFilter);
                        IGenericService.query('v2016', 'me/' + $scope.collection, query)
                        .then(function (data) {
                            $scope.userFilters = data
                        });
                    }
                }
                $rootScope.$on('signIn', function(evt, user){
                    $scope.user = user;
                    loadSavedFilters()
                });

                $scope.runUserQuery = function (record) {
                    if ($scope.runQuery)
                        $scope.runQuery({ filter: record });
                }

                $scope.confirmDelete = function(record){
                    $scope.loading = true;                                            
                    $http.delete('/api/v2016/me/search-queries/' + record._id)
                    .then(function () {
                        $scope.userFilters.splice($scope.userFilters.indexOf(record), 1);
                    });
                    $scope.loading = false;     
                }<commit_msg>fix alerts delete<commit_after>define(['app', 'underscore', 'ngDialog',
    '/app/views/search/search-directive.js', 'scbd-angularjs-services/generic-service'], function (app, _) {

    app.directive("userPreferenceFilter", ['$rootScope', 'ngDialog', function ($rootScope, ngDialog) {

        return {
            restrict: "EA",
            templateUrl: "/app/views/register/user-preferences/user-preference-filter.html",
            replace: true,
            scope: {
                runQuery: '&',
                collection  :  '@',
                collectionFilter : '@?'
            },
            link: function ($scope, element, attrs) { 
            },
            controller: ['$scope', '$http', 'IGenericService', 'realm', function ($scope, $http, IGenericService, realm) {

                $scope.user = $rootScope.user;
                $scope.skipKeywordsFilter = false;
                $scope.skipTextFilter = false;
                if($scope.collection == "subscriptions"){
                    $scope.skipKeywordsFilter = true;
                    $scope.skipTextFilter = true;
                }

                function loadSavedFilters(){
                    if($scope.user && $scope.user.isAuthenticated){
                        var query = {};
                        if($scope.collectionFilter)
                            query = JSON.parse($scope.collectionFilter);
                        IGenericService.query('v2016', 'me/' + $scope.collection, query)
                        .then(function (data) {
                            $scope.userFilters = data
                        });
                    }
                }
                $rootScope.$on('signIn', function(evt, user){
                    $scope.user = user;
                    loadSavedFilters()
                });

                $scope.runUserQuery = function (record) {
                    if ($scope.runQuery)
                        $scope.runQuery({ filter: record });
                }

                $scope.confirmDelete = function(record){
                    $scope.loading = true;                                            
                    $http.delete('/api/v2016/me/' + $scope.collection + '/' + record._id)
                    .then(function () {
                        $scope.userFilters.splice($scope.userFilters.indexOf(record), 1);
                    });
                    $scope.loading = false;     
                }
{'fraction_non_alphanumeric': 0.12364158294033217, 'fraction_numerical': 0.0036907935206069303, 'mean_word_length': 1.2386415787058285, '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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2559215', 'n_tokens_mistral': 1223, 'n_tokens_neox': 1136, 'n_words': 189}