<commit_before>define(['app',
    "text!views/register/user-preferences/user-alerts.html",
    'underscore',
    'moment',
    'ngDialog',
    'views/search/search-directive',
    'js/common',
    'views/register/directives/register-top-menu',
    'ngDialog',
    'views/register/user-preferences/user-alerts',
    'services/local-storage-service',
    'components/scbd-angularjs-services/services/generic-service',
    'services/role-service'
], function (app, template, _, moment) {

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

        return {
            restrict: "EA",
            template: template,
            replace: true,
            scope: {
                runQuery: '&',
                collection: '@',
                runQueryInPage: '@',
                collectionFilter: '@?'
            },
            link: function ($scope, element, attrs) {},
            controller: ['$rootScope', '$scope', '$http', 'IGenericService', 'realm', '$timeout', '$location', 'roleService', '$route', '$element', 'localStorageService',
                function ($rootScope, $scope, $http, IGenericService, realm, $timeout, $location, roleService, $route, $element, localStorageService) {

                    var systemSearches = [];
                    $scope.user = $rootScope.user;
                    $scope.skipKeywordsFilter = false;
                    $scope.skipTextFilter = false;
                    $scope.systemAlertsSubscription = [];

                    $scope.skipKeywordsFilter = true;
                    $scope.skipTextFilter = true;
                
                    systemSearches = [{
                        system: true,
                        "filters": [{
                            "type": "custom",
                            "isSystemAlert":"true",
                            "name": "Certificates (IRCC) published indicating that prior informed consent (PIC) has been granted to a user within my jurisdiction",
                            "id": "entitiesToWhomPICGrantedCountry",
                            "query": 'entitiesToWhomPICGrantedCountry_ss:'
                        }],
                        "queryTitle": "Search certificate(s) (IRCC) that are constituted indicating that prior informed consent (PIC) has been granted to a user within my jurisdiction",
                        "meta": {
                            "createdOn": moment.utc().format()
                        }
                    }];
                    

                    if ($scope.user.government) {
                        if (roleService.isPublishingAuthority() ||
                            roleService.isNationalAuthorizedUser() ||
                            roleService.isNationalFocalPoint()) {

                            $scope.showSystemAlerts = true;
                            var query = {
                                realm: realm.value,
                                isSystemAlert: true
                            };
    
                            IGenericService.query('v2016', 'me/subscriptions', query)
                                .then(function (data) {
                                    $scope.systemAlertsSubscription = data;
                            });
                        }
                    }
<commit_msg>fix alert issue<commit_after>define(['app',
    "text!views/register/user-preferences/user-alerts.html",
    'underscore',
    'moment',
    'ngDialog',
    'views/search/search-directive',
    'js/common',
    'views/register/directives/register-top-menu',
    'ngDialog',
    'views/register/user-preferences/user-alerts',
    'services/local-storage-service',
    'components/scbd-angularjs-services/services/generic-service',
    'services/role-service'
], function (app, template, _, moment) {

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

        return {
            restrict: "EA",
            template: template,
            replace: true,
            scope: {
                runQuery: '&',
                collection: '@',
                runQueryInPage: '@',
                collectionFilter: '@?'
            },
            link: function ($scope, element, attrs) {},
            controller: ['$rootScope', '$scope', '$http', 'IGenericService', 'realm', '$timeout', '$location', 'roleService', '$route', '$element', 'localStorageService',
                function ($rootScope, $scope, $http, IGenericService, realm, $timeout, $location, roleService, $route, $element, localStorageService) {

                    var systemSearches = [];
                    $scope.user = $rootScope.user;
                    $scope.skipKeywordsFilter = false;
                    $scope.skipTextFilter = false;
                    $scope.systemAlertsSubscription = [];

                    $scope.skipKeywordsFilter = true;
                    $scope.skipTextFilter = true;
                
                    systemSearches = [{
                        system: true,
                        "filters": [{
                            "type": "custom",
                            "isSystemAlert":"true",
                            "name": "Certificates (IRCC) published indicating that prior informed consent (PIC) has been granted to a user within my jurisdiction",
                            "id": "entitiesToWhomPICGrantedCountry",
                            "query": 'entitiesToWhomPICGrantedCountry_ss:' + $scope.user.government
                        }],
                        "queryTitle": "Search certificate(s) (IRCC) that are constituted indicating that prior informed consent (PIC) has been granted to a user within my jurisdiction",
                        "meta": {
                            "createdOn": moment.utc().format()
                        }
                    }];
                    

                    if ($scope.user.government) {
                        if (roleService.isPublishingAuthority() ||
                            roleService.isNationalAuthorizedUser() ||
                            roleService.isNationalFocalPoint()) {

                            $scope.showSystemAlerts = true;
                            var query = {
                                realm: realm.value,
                                isSystemAlert: true
                            };
    
                            IGenericService.query('v2016', 'me/subscriptions', query)
                                .then(function (data) {
                                    $scope.systemAlertsSubscription = data;
                            });
                        }
                    }

{'fraction_non_alphanumeric': 0.11145973405050053, 'fraction_numerical': 0.0011952786493351262, 'mean_word_length': 1.338106880894167, 'pattern_counts': {'":': 18, '<': 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': '1364352', 'n_tokens_mistral': 1615, 'n_tokens_neox': 1543, 'n_words': 309}