imports/vx/both/code/util.js
/**
     * Determine whether the specified preference is set in the user profile.
     *
     * @param {string} preferenceDefinition Name of preference (see codes.preferenceDefinition).
     * @param {string} userId Optional user ID.
     * @return {boolean} True if preference is present and set to true.
     */
Determine whether the specified preference is set in the user profile.
@param {string} preferenceDefinition Name of preference .
@param {string} userId Optional user ID.
@return {boolean} True if preference is present and set to true.
Determine whether the specified preference is set in the user profile . @param { string } preferenceDefinition Name of preference . @param { string } userId Optional user ID . @return { boolean } True if preference is present and set to true .
isPreference(preferenceDefinition, userId) {
        userId = userId || Meteor.userId()
        const user = Meteor.users.findOne(userId, { fields: { "profile.standardPreferences": 1 }})
        if (!user || !user.profile || !user.profile.standardPreferences) {
            return false
        }
        const preferenceObject = _.findWhere(user.profile.standardPreferences, { preferenceDefinition: preferenceDefinition })
        if (!preferenceObject) {
            return false
        }
        return preferenceObject.preferenceValue
    }
isPreference ( preferenceDefinition , userId ) { userId = userId || Meteor . userId ( ) const user = Meteor . users . findOne ( userId , { fields : { "profile.standardPreferences" : 1 } } ) if ( ! user || ! user . profile || ! user . profile . standardPreferences ) { return false } const preferenceObject = _ . findWhere ( user . profile . standardPreferences , { preferenceDefinition : preferenceDefinition } ) if ( ! preferenceObject ) { return false } return preferenceObject . preferenceValue }
Determine whether the specified preference is set in the user profile.
Determine whether the specified preference is set in the user profile .