<commit_before>lbUserSelectList.$inject = ['api'];

export default function lbUserSelectList(api) {
    return {
        scope: {
            members: '=',
            user: '=',
            onchoose: '&',
        },
        templateUrl: 'scripts/apps/desks/views/user-select.html',
        link: function(scope, elem, attrs) {
            const ARROW_UP = 38;
            const ARROW_DOWN = 40;
            const ENTER = 13;

            scope.selected = null;
            scope.search = null;
            scope.users = {};

            scope.done = false;
            scope.searching = false;

            const _refresh = function() {
                scope.users = {};
                scope.searching = true;
                scope.done = false;

                return api('users').query({where: JSON.stringify({
                    $or: [
                        {username: {$regex: scope.search, $options: '-i'}},
                        {first_name: {$regex: scope.search, $options: '-i'}},
                        {last_name: {$regex: scope.search, $options: '-i'}},
                        {email: {$regex: scope.search, $options: '-i'}},
                    ],
                })})
                    .then((result) => {
                        scope.searching = false;

                        // let's exclude current user
                        for (var i = 0; i < result._items.length; i++) {
                            var obj = result._items[i];

                            if (scope.user && obj._id === scope.user._id || obj._id === scope.$root.identity._id) {
                                result._items.splice(i, 1);
                            }
                        }
                        scope.users = result;
                        scope.users._items = _.filter(scope.users._items, (item) => {<commit_msg>LBSD-2433 Only showing active users by default<commit_after>lbUserSelectList.$inject = ['api'];

export default function lbUserSelectList(api) {
    return {
        scope: {
            members: '=',
            user: '=',
            onchoose: '&',
            showinactive: '=',
        },
        templateUrl: 'scripts/apps/desks/views/user-select.html',
        link: function(scope, elem, attrs) {
            const ARROW_UP = 38;
            const ARROW_DOWN = 40;
            const ENTER = 13;

            scope.selected = null;
            scope.search = null;
            scope.users = {};

            scope.done = false;
            scope.searching = false;

            const _refresh = function() {
                scope.users = {};
                scope.searching = true;
                scope.done = false;

                const filters = {
                    $or: [
                        {username: {$regex: scope.search, $options: '-i'}},
                        {first_name: {$regex: scope.search, $options: '-i'}},
                        {last_name: {$regex: scope.search, $options: '-i'}},
                        {email: {$regex: scope.search, $options: '-i'}},
                    ],
                };

                if (scope.showinactive !== true) {
                    filters.is_active = true;
                    filters.needs_activation = false;
                }

                return api('users')
                    .query({where: JSON.stringify(filters)})
                    .then((result) => {
                        scope.searching = false;

                        // let's exclude current user
                        for (var i = 0; i < result._items.length; i++) {
                            var obj = result._items[i];

                            if (scope.user && obj._id === scope.user._id || obj._id === scope.$root.identity._id) {
                                result._items.splice(i, 1);
                            }
                        }
                        scope.users = result;
                        scope.users._items = _.filter(scope.users._items, (item) => {
{'fraction_non_alphanumeric': 0.12773447322102088, 'fraction_numerical': 0.005028916268544128, 'mean_word_length': 1.095890410958904, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '6647803', 'n_tokens_mistral': 1048, 'n_tokens_neox': 965, 'n_words': 211}