in public/src/js/models/collections/article.js [264:300]
Article.prototype.addCapiData = function(opts) {
var missingProps;
populateObservables(this.props, opts);
populateObservables(this.fields, opts.fields);
this.setRelativeTimes();
missingProps = [
'webUrl',
'fields',
'fields.headline'
].filter(function(prop) {return !deepGet(opts, prop); });
if (missingProps.length) {
mediator.emit('capi:error', 'ContentApi is returning invalid data. Fronts may not update.');
logger.error('ContentApi missing: "' + missingProps.join('", "') + '" for ' + this.id());
} else {
this.state.isLoaded(true);
this.state.sectionName(this.props.sectionName());
this.state.primaryTag(getPrimaryTag(opts));
this.state.imageCutoutSrcFromCapi(getContributorImage(opts));
this.state.hasMainVideo(getMainMediaType(opts) === 'video');
this.state.tone(opts.frontsMeta && opts.frontsMeta.tone);
this.state.ophanUrl(vars.CONST.ophanBase + '?path=/' + urlAbsPath(opts.webUrl));
this.state.premium(isPremium(opts));
if (deepGet(opts, '.fields.liveBloggingNow') === 'true') {
this.state.isLiveBlog(true);
}
this.metaDefaults = _.extend(deepGet(opts, '.frontsMeta.defaults') || {}, this.collectionMetaDefaults);
populateObservables(this.meta, this.metaDefaults);
this.updateEditorsDisplay();
}
};