Added color scheme helper parameter

refs https://github.com/TryGhost/Team/issues/1664
This commit is contained in:
Peter Zimon 2022-07-07 11:10:01 +02:00 committed by Simon Backx
parent 14020f46d2
commit be69d83141

View File

@ -1,13 +1,19 @@
const {SafeString} = require('../services/handlebars');
const {config, urlUtils, getFrontendKey, labs} = require('../services/proxy');
async function comments() {
async function comments(options) {
// todo: For now check on the comment id to exclude normal pages (we probably have a better way to do this)
const commentId = this.comment_id;
const commentId = this.comment_id;
if (!commentId) {
return;
}
let colorScheme = 'auto';
if (options.hash.color_scheme === 'dark' || options.hash.color_scheme === 'light') {
colorScheme = options.hash.color_scheme;
}
const frontendKey = await getFrontendKey();
@ -17,7 +23,8 @@ async function comments() {
admin: urlUtils.urlFor('admin', true),
key: frontendKey,
'post-id': this.id,
'sentry-dsn': '' /* todo: insert sentry dsn key here */
'sentry-dsn': '', /* todo: insert sentry dsn key here */
'color-scheme': colorScheme
};
let dataAttributes = '';