<commit_before>/*global traceService:false */
/*global PureCloud:false */
/*exported userService */
/*exported startup */
/* jshint -W097 */

'use strict';

var userService = (function(){
    var CDN_URL = '/';// (typeof CDN_URL === 'undefined') ? '/' : CDN_URL;
    var OUTLOOK_FOR_MAC_USER_AGENT = /^Mozilla\/5.0 (Macintosh; Intel Mac OS X 10_11_1) AppleWebKit\/\d\d\d.\d+.\d+ (KHTML, like Gecko)$/

    function createUser(email, name, pictureUrl, largepictureUrl, phone, department, title, status, id) {
        return {
            name: name,
            email: email,
            picture: pictureUrl,
            largePicture: largepictureUrl,
            phone: phone,
            department: department,
            title: title,
            status: status ? status.replace(/ /g,'') : "",
            id: id

        };
    }

    return {
        getUser: function (email, callback) {
            traceService.debug("get user " + JSON.stringify(email));

            if(callback !== null){
                PureCloud.users.getUsers(null,null, null, null, null, null, email.emailAddress).done(function (data) {

                    if(data.entities.length === 1){

                        var user = data.entities[0];
                        var name = user.name;
                        var image = CDN_URL + "images/unknownuser48.png";
                        var largeImage = CDN_URL + "images/unknownuser96.png";

                        if(user.userImages !== null && user.userImages.length >= 2)// && !navigator.userAgent.match(OUTLOOK_FOR_MAC_USER_AGENT )){
                            image = user.userImages[0].imageUri;
                            largeImage = user.userImages[1].imageUri;
                        }

                        var phone = user.phoneNumber;
                        var department = user.department;
                        var status= user.status.name;
                        var title = user.title;
                        var id = user.id;
                        callback(createUser( email.emailAddress, name, image, largeImage, phone, department, title, status, id));
                    }else{
                        callback(createUser(email.emailAddress, email.displayName));
                    }
                }).error(function(){<commit_msg>should have linting back on<commit_after>/*global traceService:false */
/*global PureCloud:false */
/*exported userService */
/*exported startup */
/* jshint -W097 */

'use strict';

var userService = (function(){
    var CDN_URL = '/';// (typeof CDN_URL === 'undefined') ? '/' : CDN_URL;
    var OUTLOOK_FOR_MAC_USER_AGENT = /^Mozilla\/5.0 (Macintosh; Intel Mac OS X 10_11_1) AppleWebKit\/\d\d\d.\d+.\d+ (KHTML, like Gecko)$/

    function createUser(email, name, pictureUrl, largepictureUrl, phone, department, title, status, id) {
        return {
            name: name,
            email: email,
            picture: pictureUrl,
            largePicture: largepictureUrl,
            phone: phone,
            department: department,
            title: title,
            status: status ? status.replace(/ /g,'') : "",
            id: id

        };
    }

    return {
        getUser: function (email, callback) {
            traceService.debug("get user " + JSON.stringify(email));

            if(callback !== null){
                PureCloud.users.getUsers(null,null, null, null, null, null, email.emailAddress).done(function (data) {

                    if(data.entities.length === 1){

                        var user = data.entities[0];
                        var name = user.name;
                        var image = CDN_URL + "images/unknownuser48.png";
                        var largeImage = CDN_URL + "images/unknownuser96.png";

                        if(user.userImages !== null && user.userImages.length >= 2){// && !navigator.userAgent.match(OUTLOOK_FOR_MAC_USER_AGENT )){
                            image = user.userImages[0].imageUri;
                            largeImage = user.userImages[1].imageUri;
                        }

                        var phone = user.phoneNumber;
                        var department = user.department;
                        var status= user.status.name;
                        var title = user.title;
                        var id = user.id;
                        callback(createUser( email.emailAddress, name, image, largeImage, phone, department, title, status, id));
                    }else{
                        callback(createUser(email.emailAddress, email.displayName));
                    }
                }).error(function(){
{'fraction_non_alphanumeric': 0.11923826011685783, 'fraction_numerical': 0.008223328283921229, 'mean_word_length': 1.5749303621169917, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '1661086', 'n_tokens_mistral': 1277, 'n_tokens_neox': 1204, 'n_words': 275}