Cleaned up "Recommendations" GA feature flag (#20580)

no issue

- "Recommendations" feature was released in Ghost
[v5.71.0](https://github.com/TryGhost/Ghost/releases/tag/v5.71.0)
(commit: 1b82efe5d2)
- [Project
details](https://www.notion.so/ghost/Recommentions-5be89ec0d02a4c9b9310a964f9b22901?pvs=4)
This commit is contained in:
Sag 2024-07-10 14:24:27 +02:00 committed by GitHub
parent 8feb37cf59
commit f8966e26c8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 12 additions and 26 deletions

View File

@ -111,7 +111,6 @@ const Sidebar: React.FC = () => {
};
const hasTipsAndDonations = useFeatureFlag('tipsAndDonations');
const hasRecommendations = useFeatureFlag('recommendations');
const updateSearch = (e: React.ChangeEvent<HTMLInputElement>) => {
setFilter(e.target.value);
@ -184,7 +183,7 @@ const Sidebar: React.FC = () => {
</SettingNavSection>
<SettingNavSection isVisible={checkVisible(Object.values(growthSearchKeywords).flat())} title="Growth">
{hasRecommendations && <NavItem icon='heart' keywords={growthSearchKeywords.recommendations} navid='recommendations' title="Recommendations" onClick={handleSectionClick} />}
<NavItem icon='heart' keywords={growthSearchKeywords.recommendations} navid='recommendations' title="Recommendations" onClick={handleSectionClick} />
<NavItem icon='emailfield' keywords={growthSearchKeywords.embedSignupForm} navid='embed-signup-form' title="Embeddable signup form" onClick={handleSectionClick} />
{hasStripeEnabled && <NavItem icon='discount' keywords={growthSearchKeywords.offers} navid='offers' title="Offers" onClick={handleSectionClick} />}
{hasTipsAndDonations && <NavItem icon='piggybank' keywords={growthSearchKeywords.tips} navid='tips-or-donations' title="Tips or donations" onClick={handleSectionClick} />}

View File

@ -5,7 +5,6 @@ import {User, hasAdminAccess} from '@tryghost/admin-x-framework/api/users';
const EmailNotificationsInputs: React.FC<{ user: User; setUserData: (user: User) => void; }> = ({user, setUserData}) => {
const hasWebmentions = useFeatureFlag('webmentions');
const hasRecommendations = useFeatureFlag('recommendations');
return (
<SettingGroupContent>
@ -28,7 +27,7 @@ const EmailNotificationsInputs: React.FC<{ user: User; setUserData: (user: User)
setUserData?.({...user, mention_notifications: e.target.checked});
}}
/>}
{hasRecommendations && <Toggle
<Toggle
checked={user.recommendation_notifications}
direction='rtl'
hint='Every time another publisher recommends you to their audience'
@ -36,7 +35,7 @@ const EmailNotificationsInputs: React.FC<{ user: User; setUserData: (user: User)
onChange={(e) => {
setUserData?.({...user, recommendation_notifications: e.target.checked});
}}
/>}
/>
<Toggle
checked={user.free_member_signup_notification}
direction='rtl'

View File

@ -17,13 +17,12 @@ export const searchKeywords = {
const GrowthSettings: React.FC = () => {
const hasTipsAndDonations = useFeatureFlag('tipsAndDonations');
const hasRecommendations = useFeatureFlag('recommendations');
const {config, settings} = useGlobalData();
const hasStripeEnabled = checkStripeEnabled(settings || [], config || {});
return (
<SearchableSection keywords={Object.values(searchKeywords).flat()} title='Growth'>
{hasRecommendations && <Recommendations keywords={searchKeywords.recommendations} />}
<Recommendations keywords={searchKeywords.recommendations} />
<EmbedSignupForm keywords={searchKeywords.embedSignupForm} />
{hasStripeEnabled && <Offers keywords={searchKeywords.offers} />}
{hasTipsAndDonations && <TipsOrDonations keywords={searchKeywords.tips} />}

View File

@ -1,12 +1,8 @@
import {expect, test} from '@playwright/test';
import {globalDataRequests} from '../../utils/acceptance';
import {mockApi, responseFixtures, toggleLabsFlag} from '@tryghost/admin-x-framework/test/acceptance';
import {mockApi, responseFixtures} from '@tryghost/admin-x-framework/test/acceptance';
test.describe('Recommendations', async () => {
test.beforeEach(async () => {
toggleLabsFlag('recommendations', true);
});
test('can view recommendations', async ({page}) => {
await mockApi({page, requests: {
...globalDataRequests,

View File

@ -73,7 +73,6 @@ export default class FeatureService extends Service {
@feature('collectionsCard') collectionsCard;
@feature('importMemberTier') importMemberTier;
@feature('tipsAndDonations') tipsAndDonations;
@feature('recommendations') recommendations;
@feature('lexicalIndicators') lexicalIndicators;
@feature('adminXDemo') adminXDemo;
@feature('ActivityPub') ActivityPub;

View File

@ -43,7 +43,6 @@ class RecommendationServiceWrapper {
return;
}
const labs = require('../../../shared/labs');
const config = require('../../../shared/config');
const urlUtils = require('../../../shared/url-utils');
const models = require('../../models');
@ -146,10 +145,8 @@ class RecommendationServiceWrapper {
service: this.incomingRecommendationService
});
if (labs.isSet('recommendations')) {
this.service.init().catch(logging.error);
this.incomingRecommendationService.init().catch(logging.error);
}
this.service.init().catch(logging.error);
this.incomingRecommendationService.init().catch(logging.error);
const PATH_SUFFIX = '/.well-known/recommendations.json';
@ -169,12 +166,10 @@ class RecommendationServiceWrapper {
// Listen for incoming webmentions
DomainEvents.subscribe(MentionCreatedEvent, async (event) => {
if (labs.isSet('recommendations')) {
// Check if this is a recommendation
if (event.data.mention.verified && isRecommendationUrl(event.data.mention.source)) {
logging.info('[INCOMING RECOMMENDATION] Received recommendation from ' + event.data.mention.source);
await this.incomingRecommendationService.sendRecommendationEmail(event.data.mention);
}
// Check if this is a recommendation
if (event.data.mention.verified && isRecommendationUrl(event.data.mention.source)) {
logging.info('[INCOMING RECOMMENDATION] Received recommendation from ' + event.data.mention.source);
await this.incomingRecommendationService.sendRecommendationEmail(event.data.mention);
}
});
}

View File

@ -19,7 +19,6 @@ const GA_FEATURES = [
'themeErrorsNotification',
'outboundLinkTagging',
'announcementBar',
'recommendations',
'newEmailAddresses',
'internalLinking'
];

View File

@ -1155,7 +1155,7 @@ exports[`Settings API Edit Can edit a setting 2: [headers] 1`] = `
Object {
"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",
"content-length": "4479",
"content-length": "4454",
"content-type": "application/json; charset=utf-8",
"content-version": StringMatching /v\\\\d\\+\\\\\\.\\\\d\\+/,
"etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/,