<commit_before>/**
Template Controllers

@module Templates
*/

/**
The chats aside template

@class [template] views_chats_aside
@constructor
*/


Template['views_chats_aside'].helpers({
    /**
    Get all my chats

    @method (chats)
    */
    'chats': function(){
        return Chats.find({}, {sort: {lastActivity: -1}});
    },
    /**
    Generate the chat name, based on all participants names

    @method (generatedName)
    */
    'generatedName': function(){
        if(_.isArray(this.users)) {
            var users = Users.find({_id: {$in: this.users}}).fetch();

            if(!_.isEmpty(users))
                return _.trim(_.pluck(users, 'name').join(', '),', ');
        }

        // return default name, if it couldn't be autogenerated
        return TAPi18n.__('whisper.chat.placeholder.unnamedChat');
    },
    /**
    Get all my chats

    @method (chats)
    */
    'unreadCount': function(){
        if(_.isArray(this.messages))<commit_msg>show id as chat name, if no user is in there<commit_after>/**
Template Controllers

@module Templates
*/

/**
The chats aside template

@class [template] views_chats_aside
@constructor
*/


Template['views_chats_aside'].helpers({
    /**
    Get all my chats

    @method (chats)
    */
    'chats': function(){
        return Chats.find({}, {sort: {lastActivity: -1}});
    },
    /**
    Generate the chat name, based on all participants names

    @method (generatedName)
    */
    'generatedName': function(){
        if(_.isArray(this.users)) {
            var users = Users.find({_id: {$in: this.users}}).fetch();

            if(!_.isEmpty(users))
                return _.trim(_.pluck(users, 'name').join(', '),', ');
        }

        // return default name, if it couldn't be autogenerated
        return this._id;
    },
    /**
    Get all my chats

    @method (chats)
    */
    'unreadCount': function(){
        if(_.isArray(this.messages))
{'fraction_non_alphanumeric': 0.15775817332641412, 'fraction_numerical': 0.0020757654385054488, 'mean_word_length': 2.382456140350877, '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': '6527011', 'n_tokens_mistral': 614, 'n_tokens_neox': 598, 'n_words': 147}