<commit_before>var config = require('config');
var Newsfeed = require('./models/newsfeed.model.js');
var mongoose = require('mongoose');
var debug = require('debug')('cm:db');
var appRoot = require('app-root-path');
var helper = require(appRoot + '/libs/core/generalLibs.js');
//var Plugin = require(appRoot + '/modules/apps-gallery/backgroundPlugins.js');

function newsfeedSystem(){

}

newsfeedSystem.prototype.getNewsfeed = function (error,courseId, success) {
    Newsfeed.find({courseId: courseId})
            .populate('userId username displayName')
            .exec(function(err, docs) {
                if (err){
                    error(err);
                } else {
                    success(docs);
                }
            });
};

module.exports = newsfeedSystem;<commit_msg>Newsfeed fix exposing user data in newsfeed api<commit_after>var config = require('config');
var Newsfeed = require('./models/newsfeed.model.js');
var mongoose = require('mongoose');
var debug = require('debug')('cm:db');
var appRoot = require('app-root-path');
var helper = require(appRoot + '/libs/core/generalLibs.js');
//var Plugin = require(appRoot + '/modules/apps-gallery/backgroundPlugins.js');

function newsfeedSystem(){

}

newsfeedSystem.prototype.getNewsfeed = function (error,courseId, success) {
    Newsfeed.find({courseId: courseId})
            .populate('userId', '_id image displayName')
            .exec(function(err, docs) {
                if (err){
                    error(err);
                } else {
                    success(docs);
                }
            });
};

module.exports = newsfeedSystem;
{'fraction_non_alphanumeric': 0.14749082007343942, 'fraction_numerical': 0.0, 'mean_word_length': 2.690744920993228, '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': '130995', 'n_tokens_mistral': 470, 'n_tokens_neox': 455, 'n_words': 93}