<commit_before>// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved.
// See License.txt for license information.


var utils = require('../utils/utils.jsx');
var client = require('../utils/client.jsx');
var AsyncClient = require('../utils/async_client.jsx');
var UserStore = require('../stores/user_store.jsx');
var ChannelStore = require('../stores/channel_store.jsx');
var TeamStore = require('../stores/team_store.jsx');

var UserProfile = require('./user_profile.jsx');
var MessageWrapper = require('./message_wrapper.jsx');

var Constants = require('../utils/constants.jsx');
var ActionTypes = Constants.ActionTypes;
var AppDispatcher = require('../dispatcher/app_dispatcher.jsx');

function getCountsStateFromStores() {
    var count = 0;
    var channels = ChannelStore.getAll();
    var members = ChannelStore.getAllMembers();

    channels.forEach(function(channel) {
        var channelMember = members[channel.id];
        if (channel.type === 'D') {
            count += channel.total_msg_count - channelMember.msg_count;
        } else {
            if (channelMember.mention_count > 0) {
                count += channelMember.mention_count;
            } else if (channel.total_msg_count - channelMember.msg_count > 0) {
                count += 1;
            }
        }
    });

    return { count: count };
}

var NotifyCounts =  React.createClass({
    componentDidMount: function() {
        ChannelStore.addChangeListener(this._onChange);
    },<commit_msg>While in mobile mode notifications are no longer counted for channels set to 'quiet mode' that are not direct mentions.<commit_after>// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved.
// See License.txt for license information.


var utils = require('../utils/utils.jsx');
var client = require('../utils/client.jsx');
var AsyncClient = require('../utils/async_client.jsx');
var UserStore = require('../stores/user_store.jsx');
var ChannelStore = require('../stores/channel_store.jsx');
var TeamStore = require('../stores/team_store.jsx');

var UserProfile = require('./user_profile.jsx');
var MessageWrapper = require('./message_wrapper.jsx');

var Constants = require('../utils/constants.jsx');
var ActionTypes = Constants.ActionTypes;
var AppDispatcher = require('../dispatcher/app_dispatcher.jsx');

function getCountsStateFromStores() {
    var count = 0;
    var channels = ChannelStore.getAll();
    var members = ChannelStore.getAllMembers();

    channels.forEach(function(channel) {
        var channelMember = members[channel.id];
        if (channel.type === 'D') {
            count += channel.total_msg_count - channelMember.msg_count;
        } else {
            if (channelMember.mention_count > 0) {
                count += channelMember.mention_count;
            } else if (channelMember.notify_level !== "quiet" && channel.total_msg_count - channelMember.msg_count > 0) {
                count += 1;
            }
        }
    });

    return { count: count };
}

var NotifyCounts =  React.createClass({
    componentDidMount: function() {
        ChannelStore.addChangeListener(this._onChange);
    },
{'fraction_non_alphanumeric': 0.1383183568677792, 'fraction_numerical': 0.005134788189987163, 'mean_word_length': 3.156, 'pattern_counts': {'":': 0, '<': 3, '<?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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3199730', 'n_tokens_mistral': 921, 'n_tokens_neox': 890, 'n_words': 201}