const crypto = require('crypto'); const { Component, Fragment } = require('inferno'); const { cacheComponent } = require('../util/cache'); class Gitment extends Component { render() { const { id, repo, owner, clientId, clientSecret, perPage = 20, maxCommentHeight = 250 } = this.props; if (!id || !repo || !owner || !clientId || !clientSecret) { return
You forgot to set the owner, repo, clientId, or clientSecret for Gitment. Please set it in _config.yml.
; } const js = `var gitment = new Gitment({ id: '${id}', repo: '${repo}', owner: '${owner}', oauth: { client_id: '${clientId}', client_secret: '${clientSecret}', }, perPage: ${perPage}, maxCommentHeight: ${maxCommentHeight} }) gitment.render('comment-container')`; return
; } } module.exports = cacheComponent(Gitment, 'comment.gitment', props => { const { comment } = props; const id = crypto.createHash('md5').update(props.page.path).digest('hex'); return { id, repo: comment.repo, owner: comment.owner, clientId: comment.client_id, clientSecret: comment.client_secret, perPage: comment.per_page, maxCommentHeight: comment.max_comment_height }; });