mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-03-04 02:01:58 -05:00
Added FirstPromoter Integration (#12540)
no refs Adds new FirstPromoter settings similar to amp, which allows sites to take advantage of FirstPromoter to launch their own member referral program natively. - Adds new firstpromoter settings group - Adds `firstpromoter` setting to group - Adds `firstpromoter_id` setting to group for FirstPromoter referral tracking id - Updated tests
This commit is contained in:
parent
112109ca45
commit
592c1bd46c
7 changed files with 45 additions and 5 deletions
|
@ -11,7 +11,8 @@ const groupTypeMapping = {
|
|||
private: 'private',
|
||||
portal: 'portal',
|
||||
email: 'bulk_email',
|
||||
newsletter: 'newsletter'
|
||||
newsletter: 'newsletter',
|
||||
firstpromoter: 'firstpromoter'
|
||||
};
|
||||
|
||||
const mapGroupToType = (group) => {
|
||||
|
|
|
@ -11,7 +11,8 @@ const groupTypeMapping = {
|
|||
private: 'private',
|
||||
portal: 'portal',
|
||||
email: 'bulk_email',
|
||||
newsletter: 'newsletter'
|
||||
newsletter: 'newsletter',
|
||||
firstpromoter: 'firstpromoter'
|
||||
};
|
||||
|
||||
const mapGroupToType = (group) => {
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
const logging = require('../../../../../shared/logging');
|
||||
const {createTransactionalMigration} = require('../../utils');
|
||||
|
||||
module.exports = createTransactionalMigration(
|
||||
|
||||
async function up(connection) {
|
||||
logging.info('Updating FirstPromoter settings - firstpromoter, firstpromoter_id');
|
||||
await connection('settings')
|
||||
.whereIn('key', ['firstpromoter', 'firstpromoter_id'])
|
||||
.update({
|
||||
group: 'firstpromoter'
|
||||
});
|
||||
},
|
||||
|
||||
async function down() { }
|
||||
);
|
|
@ -376,6 +376,24 @@
|
|||
"type": "string"
|
||||
}
|
||||
},
|
||||
"firstpromoter": {
|
||||
"firstpromoter": {
|
||||
"defaultValue": "false",
|
||||
"validations": {
|
||||
"isIn": [
|
||||
[
|
||||
"true",
|
||||
"false"
|
||||
]
|
||||
]
|
||||
},
|
||||
"type": "boolean"
|
||||
},
|
||||
"firstpromoter_id": {
|
||||
"defaultValue": null,
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"labs": {
|
||||
"labs": {
|
||||
"defaultValue": "{}",
|
||||
|
|
|
@ -72,7 +72,9 @@ const defaultSettingsKeyTypes = [
|
|||
{key: 'newsletter_show_badge', type: 'newsletter'},
|
||||
{key: 'newsletter_show_header', type: 'newsletter'},
|
||||
{key: 'newsletter_body_font_category', type: 'newsletter'},
|
||||
{key: 'newsletter_footer_content', type: 'newsletter'}
|
||||
{key: 'newsletter_footer_content', type: 'newsletter'},
|
||||
{key: 'firstpromoter', type: 'firstpromoter'},
|
||||
{key: 'firstpromoter_id', type: 'firstpromoter'}
|
||||
];
|
||||
|
||||
describe('Settings API (canary)', function () {
|
||||
|
|
|
@ -70,7 +70,9 @@ const defaultSettingsKeyTypes = [
|
|||
{key: 'newsletter_show_badge', type: 'newsletter'},
|
||||
{key: 'newsletter_show_header', type: 'newsletter'},
|
||||
{key: 'newsletter_footer_content', type: 'newsletter'},
|
||||
{key: 'newsletter_body_font_category', type: 'newsletter'}
|
||||
{key: 'newsletter_body_font_category', type: 'newsletter'},
|
||||
{key: 'firstpromoter', type: 'firstpromoter'},
|
||||
{key: 'firstpromoter_id', type: 'firstpromoter'}
|
||||
];
|
||||
|
||||
describe('Settings API (v2)', function () {
|
||||
|
|
|
@ -34,7 +34,7 @@ describe('DB version integrity', function () {
|
|||
// Only these variables should need updating
|
||||
const currentSchemaHash = 'c61ecbc8c11f62d1d350c66ee1ac3151';
|
||||
const currentFixturesHash = 'd46d696c94d03e41a5903500547fea77';
|
||||
const currentSettingsHash = 'd3821715e4b34d92d6ba6ed0d4918f5c';
|
||||
const currentSettingsHash = '162f9294cc427eb32bc0577006c385ce';
|
||||
const currentRoutesHash = '3d180d52c663d173a6be791ef411ed01';
|
||||
|
||||
// If this test is failing, then it is likely a change has been made that requires a DB version bump,
|
||||
|
|
Loading…
Add table
Reference in a new issue