client/src/models/member.js
function () {
        var user_prefixes = this.get('user_prefixes'),
            modes = this.get('modes'),
            o, max_mode;

        if (modes.length > 0) {
            o = _.indexOf(user_prefixes, _.find(user_prefixes, function (prefix) {
                return prefix.mode === 'o';
            }));

            max_mode = _.indexOf(user_prefixes, _.find(user_prefixes, function (prefix) {
                return prefix.mode === modes[0];
            }));

            if ((max_mode === -1) || (max_mode > o)) {
                this.set({"is_op": false}, {silent: true});
            } else {
                this.set({"is_op": true}, {silent: true});
            }

        } else {
            this.set({"is_op": false}, {silent: true});
        }
    }
function () {
        var user_prefixes = this.get('user_prefixes'),
            modes = this.get('modes'),
            o, max_mode;

        if (modes.length > 0) {
            o = _.indexOf(user_prefixes, _.find(user_prefixes, function (prefix) {
                return prefix.mode === 'o';
            }));

            max_mode = _.indexOf(user_prefixes, _.find(user_prefixes, function (prefix) {
                return prefix.mode === modes[0];
            }));

            if ((max_mode === -1) || (max_mode > o)) {
                this.set({"is_op": false}, {silent: true});
            } else {
                this.set({"is_op": true}, {silent: true});
            }

        } else {
            this.set({"is_op": false}, {silent: true});
        }
    }
function ( ) { var user_prefixes = this . get ( 'user_prefixes' ) , modes = this . get ( 'modes' ) , o , max_mode ; if ( modes . length > 0 ) { o = _ . indexOf ( user_prefixes , _ . find ( user_prefixes , function ( prefix ) { return prefix . mode === 'o' ; } ) ) ; max_mode = _ . indexOf ( user_prefixes , _ . find ( user_prefixes , function ( prefix ) { return prefix . mode === modes [ 0 ] ; } ) ) ; if ( ( max_mode === - 1 ) || ( max_mode > o ) ) { this . set ( { "is_op" : false } , { silent : true } ) ; } else { this . set ( { "is_op" : true } , { silent : true } ) ; } } else { this . set ( { "is_op" : false } , { silent : true } ) ; } }
With the modes set on the user, make note if we have some sort of op status
With the modes set on the user make note if we have some sort of op status