mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-24 14:43:08 +03:00
✨ Added native comments (#15223)
no issue - Removes the comments lab flag (bumping it to GA). - Bumps comments-ui to v0.8
This commit is contained in:
parent
77e4be6b81
commit
27df4e536f
@ -58,7 +58,6 @@ export default class FeatureService extends Service {
|
|||||||
// labs flags
|
// labs flags
|
||||||
@feature('urlCache') urlCache;
|
@feature('urlCache') urlCache;
|
||||||
@feature('beforeAfterCard') beforeAfterCard;
|
@feature('beforeAfterCard') beforeAfterCard;
|
||||||
@feature('comments') comments;
|
|
||||||
@feature('newsletterPaywall') newsletterPaywall;
|
@feature('newsletterPaywall') newsletterPaywall;
|
||||||
@feature('freeTrial') freeTrial;
|
@feature('freeTrial') freeTrial;
|
||||||
|
|
||||||
|
@ -213,19 +213,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="gh-expandable-block">
|
|
||||||
<div class="gh-expandable-header">
|
|
||||||
<div>
|
|
||||||
<h4 class="gh-expandable-title">Comments</h4>
|
|
||||||
<p class="gh-expandable-description">
|
|
||||||
Enable comments
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<div class="for-switch">
|
|
||||||
<GhFeatureFlag @flag="comments" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="gh-expandable-block">
|
<div class="gh-expandable-block">
|
||||||
<div class="gh-expandable-header">
|
<div class="gh-expandable-header">
|
||||||
<div>
|
<div>
|
||||||
|
@ -24,9 +24,6 @@
|
|||||||
<div class="gh-setting-members-basicsform">
|
<div class="gh-setting-members-basicsform">
|
||||||
<p class="intro">Fund your work with subscription revenue. Connect your Stripe account and offer premium content to your audience. Our creators are already making over $12 million per year, while <strong>Ghost takes 0% payment fees</strong>.</p>
|
<p class="intro">Fund your work with subscription revenue. Connect your Stripe account and offer premium content to your audience. Our creators are already making over $12 million per year, while <strong>Ghost takes 0% payment fees</strong>.</p>
|
||||||
|
|
||||||
{{#if (not (feature 'comments'))}}
|
|
||||||
<hr>
|
|
||||||
{{/if}}
|
|
||||||
<div class="flex flex-column justify-between mt3">
|
<div class="flex flex-column justify-between mt3">
|
||||||
<section class="gh-expandable gh-setting-members-portalcta">
|
<section class="gh-expandable gh-setting-members-portalcta">
|
||||||
<div class="gh-expandable-block">
|
<div class="gh-expandable-block">
|
||||||
@ -47,9 +44,7 @@
|
|||||||
<div class="gh-setting-rich-dropdown">
|
<div class="gh-setting-rich-dropdown">
|
||||||
<Settings::MembersSubscriptionAccess @onChange={{this.membersSubscriptionAccessChanged}} />
|
<Settings::MembersSubscriptionAccess @onChange={{this.membersSubscriptionAccessChanged}} />
|
||||||
<Settings::MembersDefaultPostAccess />
|
<Settings::MembersDefaultPostAccess />
|
||||||
{{#if (feature 'comments')}}
|
<Settings::MembersCommentAccess />
|
||||||
<Settings::MembersCommentAccess />
|
|
||||||
{{/if}}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -297,33 +297,30 @@
|
|||||||
</p>
|
</p>
|
||||||
</GhFormGroup>
|
</GhFormGroup>
|
||||||
|
|
||||||
{{#if (feature 'comments')}}
|
<div class="user-settings-subgroup">
|
||||||
<div class="user-settings-subgroup">
|
<h4 class="user-settings-heading">Email notifications</h4>
|
||||||
<h4 class="user-settings-heading">Email notifications</h4>
|
<GhFormGroup @errors={{this.user.errors}} @hasValidated={{this.user.hasValidated}} @property="email">
|
||||||
<GhFormGroup @errors={{this.user.errors}} @hasValidated={{this.user.hasValidated}} @property="email">
|
<div class="user-setting-toggle">
|
||||||
<div class="user-setting-toggle">
|
<div>
|
||||||
<div>
|
<label for="user-email">Comments</label>
|
||||||
<label for="user-email">Comments</label>
|
<p>Receive notifications when members comment on one of your posts</p>
|
||||||
<p>Receive notifications when members comment on one of your posts</p>
|
|
||||||
</div>
|
|
||||||
<div class="for-switch">
|
|
||||||
<label class="switch" for="comment-notifications">
|
|
||||||
<input
|
|
||||||
id="comment-notifications"
|
|
||||||
type="checkbox"
|
|
||||||
checked={{this.user.commentNotifications}}
|
|
||||||
class="gh-input"
|
|
||||||
{{on "change" this.toggleCommentNotifications}}
|
|
||||||
data-test-checkbox="comment-notifications"
|
|
||||||
>
|
|
||||||
<span class="input-toggle-component"></span>
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</GhFormGroup>
|
<div class="for-switch">
|
||||||
</div>
|
<label class="switch" for="comment-notifications">
|
||||||
{{/if}}
|
<input
|
||||||
|
id="comment-notifications"
|
||||||
|
type="checkbox"
|
||||||
|
checked={{this.user.commentNotifications}}
|
||||||
|
class="gh-input"
|
||||||
|
{{on "change" this.toggleCommentNotifications}}
|
||||||
|
data-test-checkbox="comment-notifications"
|
||||||
|
>
|
||||||
|
<span class="input-toggle-component"></span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</GhFormGroup>
|
||||||
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
const {SafeString} = require('../services/handlebars');
|
const {SafeString} = require('../services/handlebars');
|
||||||
const {labs} = require('../services/proxy');
|
|
||||||
const {html} = require('common-tags');
|
const {html} = require('common-tags');
|
||||||
|
|
||||||
function commentCount(options) {
|
module.exports = function commentCount(options) {
|
||||||
const empty = options.hash.empty === undefined ? '' : options.hash.empty;
|
const empty = options.hash.empty === undefined ? '' : options.hash.empty;
|
||||||
const singular = options.hash.singular === undefined ? 'comment' : options.hash.singular;
|
const singular = options.hash.singular === undefined ? 'comment' : options.hash.singular;
|
||||||
const plural = options.hash.plural === undefined ? 'comments' : options.hash.plural;
|
const plural = options.hash.plural === undefined ? 'comments' : options.hash.plural;
|
||||||
@ -21,17 +20,4 @@ function commentCount(options) {
|
|||||||
>
|
>
|
||||||
</script>
|
</script>
|
||||||
`);
|
`);
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = function commentsLabsWrapper() {
|
|
||||||
const self = this;
|
|
||||||
const args = arguments;
|
|
||||||
|
|
||||||
return labs.enabledHelper({
|
|
||||||
flagKey: 'comments',
|
|
||||||
flagName: 'Comments',
|
|
||||||
helperName: 'comment_count'
|
|
||||||
}, () => {
|
|
||||||
return commentCount.apply(self, args);
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
const {SafeString} = require('../services/handlebars');
|
const {SafeString} = require('../services/handlebars');
|
||||||
const {urlUtils, getFrontendKey, labs, settingsCache} = require('../services/proxy');
|
const {urlUtils, getFrontendKey, settingsCache} = require('../services/proxy');
|
||||||
const {getFrontendAppConfig, getDataAttributes} = require('../utils/frontend-apps');
|
const {getFrontendAppConfig, getDataAttributes} = require('../utils/frontend-apps');
|
||||||
|
|
||||||
async function comments(options) {
|
module.exports = 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)
|
// 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;
|
||||||
@ -75,19 +75,6 @@ async function comments(options) {
|
|||||||
return new SafeString(`
|
return new SafeString(`
|
||||||
<script defer src="${scriptUrl}" ${dataAttributes} crossorigin="anonymous"></script>
|
<script defer src="${scriptUrl}" ${dataAttributes} crossorigin="anonymous"></script>
|
||||||
`);
|
`);
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = async function commentsLabsWrapper() {
|
|
||||||
const self = this;
|
|
||||||
const args = arguments;
|
|
||||||
|
|
||||||
return labs.enabledHelper({
|
|
||||||
flagKey: 'comments',
|
|
||||||
flagName: 'Comments',
|
|
||||||
helperName: 'comments'
|
|
||||||
}, () => {
|
|
||||||
return comments.apply(self, args);
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports.async = true;
|
module.exports.async = true;
|
||||||
|
@ -229,7 +229,7 @@ module.exports = async function ghost_head(options) { // eslint-disable-line cam
|
|||||||
head.push(`<link rel="stylesheet" type="text/css" href="${getAssetUrl('public/cards.min.css')}">`);
|
head.push(`<link rel="stylesheet" type="text/css" href="${getAssetUrl('public/cards.min.css')}">`);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (labs.isSet('comments') && settingsCache.get('enable_comments') !== 'off') {
|
if (settingsCache.get('enable_comments') !== 'off') {
|
||||||
head.push(`<script defer src="${getAssetUrl('public/comment-counts.min.js')}" data-ghost-comments-counts-api="${urlUtils.getSiteUrl(true)}members/api/comments/counts/"></script>`);
|
head.push(`<script defer src="${getAssetUrl('public/comment-counts.min.js')}" data-ghost-comments-counts-api="${urlUtils.getSiteUrl(true)}members/api/comments/counts/"></script>`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -147,7 +147,7 @@
|
|||||||
"comments": {
|
"comments": {
|
||||||
"url": "https://cdn.jsdelivr.net/npm/@tryghost/comments-ui@~{version}/umd/comments-ui.min.js",
|
"url": "https://cdn.jsdelivr.net/npm/@tryghost/comments-ui@~{version}/umd/comments-ui.min.js",
|
||||||
"styles": "https://cdn.jsdelivr.net/npm/@tryghost/comments-ui@~{version}/umd/main.css",
|
"styles": "https://cdn.jsdelivr.net/npm/@tryghost/comments-ui@~{version}/umd/main.css",
|
||||||
"version": "0.7"
|
"version": "0.8"
|
||||||
},
|
},
|
||||||
"editor": {
|
"editor": {
|
||||||
"url": "https://unpkg.com/@tryghost/koenig-react/dist/umd/koenig-react.min.js"
|
"url": "https://unpkg.com/@tryghost/koenig-react/dist/umd/koenig-react.min.js"
|
||||||
|
@ -27,7 +27,6 @@ const BETA_FEATURES = [
|
|||||||
const ALPHA_FEATURES = [
|
const ALPHA_FEATURES = [
|
||||||
'urlCache',
|
'urlCache',
|
||||||
'beforeAfterCard',
|
'beforeAfterCard',
|
||||||
'comments',
|
|
||||||
'freeTrial'
|
'freeTrial'
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -230,7 +230,7 @@ Object {
|
|||||||
},
|
},
|
||||||
Object {
|
Object {
|
||||||
"key": "labs",
|
"key": "labs",
|
||||||
"value": "{\\"activitypub\\":true,\\"urlCache\\":true,\\"beforeAfterCard\\":true,\\"comments\\":true,\\"freeTrial\\":true,\\"newsletterPaywall\\":true,\\"members\\":true}",
|
"value": "{\\"activitypub\\":true,\\"urlCache\\":true,\\"beforeAfterCard\\":true,\\"freeTrial\\":true,\\"newsletterPaywall\\":true,\\"members\\":true}",
|
||||||
},
|
},
|
||||||
Object {
|
Object {
|
||||||
"key": "slack_url",
|
"key": "slack_url",
|
||||||
@ -280,7 +280,7 @@ exports[`Settings API Browse Can request all settings 2: [headers] 1`] = `
|
|||||||
Object {
|
Object {
|
||||||
"access-control-allow-origin": "http://127.0.0.1:2369",
|
"access-control-allow-origin": "http://127.0.0.1:2369",
|
||||||
"cache-control": "no-cache, private, no-store, must-revalidate, max-stale=0, post-check=0, pre-check=0",
|
"cache-control": "no-cache, private, no-store, must-revalidate, max-stale=0, post-check=0, pre-check=0",
|
||||||
"content-length": "3425",
|
"content-length": "3407",
|
||||||
"content-type": "application/json; charset=utf-8",
|
"content-type": "application/json; charset=utf-8",
|
||||||
"etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/,
|
"etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/,
|
||||||
"vary": "Origin, Accept-Encoding",
|
"vary": "Origin, Accept-Encoding",
|
||||||
|
@ -31,7 +31,6 @@ describe('{{comment_count}} helper', function () {
|
|||||||
|
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
mockManager.mockMail();
|
mockManager.mockMail();
|
||||||
mockManager.mockLabsEnabled('comments');
|
|
||||||
sinon.stub(settingsCache, 'get');
|
sinon.stub(settingsCache, 'get');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -20,7 +20,6 @@ describe('{{comments}} helper', function () {
|
|||||||
|
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
mockManager.mockMail();
|
mockManager.mockMail();
|
||||||
mockManager.mockLabsEnabled('comments');
|
|
||||||
sinon.stub(settingsCache, 'get');
|
sinon.stub(settingsCache, 'get');
|
||||||
configUtils.set('comments:version', 'test.version');
|
configUtils.set('comments:version', 'test.version');
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user