Hide email subscription by param from frontend

This commit is contained in:
Pavel Mineev
2020-08-20 18:15:50 -05:00
committed by Umputun
parent c9800a3799
commit 5c23206d00
4 changed files with 10 additions and 1 deletions
+4
View File
@@ -455,6 +455,10 @@ Add this snippet to the bottom of web page:
theme: 'dark', // optional param; if it isn't defined default value ('light') will be used
page_title: 'Moving to Remark42', // optional param; if it isn't defined `document.title` will be used
locale: 'en' // set up locale and language, if it isn't defined default value ('en') will be used
show_email_subscription: false // optional param; by default it is `true` and you can see email subscription feature
// in interface when enable it from backend side
// if you set this param in `false` you will get notifications email notifications as admin
// but your users won't have interface for subscription
};
(function(c) {
+1
View File
@@ -17,6 +17,7 @@ export interface CommentsConfig {
page_title?: string;
node?: string | HTMLElement;
locale?: string;
show_email_subscription?: boolean;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
__colors__?: any;
}
+4
View File
@@ -10,6 +10,7 @@ export interface QuerySettingsType {
theme: Theme;
/* used in delete users data page */
token?: string;
show_email_subscription?: boolean;
}
export const querySettings: Partial<QuerySettingsType> = parseQuery();
@@ -25,6 +26,9 @@ if (!querySettings.theme || THEMES.indexOf(querySettings.theme) === -1) {
querySettings.theme = THEMES[0];
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
querySettings.show_email_subscription = (querySettings.show_email_subscription as any) !== 'false';
export const siteId = querySettings.site_id;
export const pageTitle = querySettings.page_title;
export const url = querySettings.url;
@@ -535,7 +535,7 @@ export class CommentForm extends Component<Props, State> {
{this.renderMarkdownTip()}
<FormattedMessage id="commentForm.subscribe-by" defaultMessage="Subscribe by" />{' '}
<SubscribeByRSS userId={props.user !== null ? props.user.id : null} />
{StaticStore.config.email_notifications && (
{StaticStore.config.email_notifications && StaticStore.query.show_email_subscription && (
<Fragment>
{' '}
<FormattedMessage id="commentForm.subscribe-or" defaultMessage="or" /> <SubscribeByEmail />