<commit_before>module.exports = function(req, res, next){
    "use strict";
    var Strings = require('../../../strings'),
        Response = require('../../helpers/response'),
        content = require('../../../entities/content'),
        strings = new Strings('en'),
        response = new Response()

    function onGetContent(err, doc){
        if(err){
            response.write(response.STATUS_CODES.NOT_FOUND, JSON.stringify(err), res);
        }
        else {
            if(doc.node && doc.node._id){
                req.parent = doc.node._id.toString();
            }

            next();
        }
    }

    content.getById(req.params.id, onGetContent);
};<commit_msg>Updated the content parent algorithm to handle the post scenario.<commit_after>module.exports = function(req, res, next){
    "use strict";
    var Strings = require('../../../strings'),
        Response = require('../../helpers/response'),
        content = require('../../../entities/content'),
        strings = new Strings('en'),
        response = new Response()

    function onGetContent(err, doc){
        if(err){
            if(req.body.node && req.body.node._id){
                req.parent = req.body.node._id;
            }
        }
        else {
            if(doc.node && doc.node._id){
                req.parent = doc.node._id.toString();
            }
        }

        next();
    }

    content.getById(req.params.id, onGetContent);
};
{'fraction_non_alphanumeric': 0.16724496877168632, 'fraction_numerical': 0.0, 'mean_word_length': 1.7624521072796935, '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': '1364492', 'n_tokens_mistral': 404, 'n_tokens_neox': 399, 'n_words': 78}