Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions apps/admin-x-framework/src/api/automations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ export type AutomationSendEmailAction = {
data: {
email_subject: string;
email_lexical: string;
email_sender_name: string | null;
email_sender_email: string | null;
email_sender_reply_to: string | null;
email_design_setting_id: string;
};
}
Expand Down Expand Up @@ -115,9 +112,6 @@ const buildSendEmailAction = (): AutomationSendEmailAction => ({
data: {
email_subject: '',
email_lexical: EMPTY_EMAIL_LEXICAL,
email_sender_name: null,
email_sender_email: null,
email_sender_reply_to: null,
// TODO NY-1252: replace this placeholder when email design settings are available.
email_design_setting_id: 'placeholder'
}
Expand Down
11 changes: 2 additions & 9 deletions apps/admin-x-framework/test/unit/api/automations.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -318,9 +318,6 @@ describe('automations api helpers', () => {
data: {
email_subject: 'Hi',
email_lexical: '{}',
email_sender_name: null,
email_sender_email: null,
email_sender_reply_to: null,
email_design_setting_id: 'placeholder'
}
}
Expand Down Expand Up @@ -374,9 +371,6 @@ describe('automations api helpers', () => {
data: {
email_subject: 'Original subject',
email_lexical: '{"root":{"children":[]}}',
email_sender_name: null,
email_sender_email: null,
email_sender_reply_to: null,
email_design_setting_id: 'placeholder',
...overrides
}
Expand All @@ -399,7 +393,7 @@ describe('automations api helpers', () => {
});

it('updates subject and lexical, preserving the rest of data', () => {
const detail = baseDetail([sendEmailAction('a', {email_sender_name: 'Jane'})], []);
const detail = baseDetail([sendEmailAction('a', {email_design_setting_id: 'design-setting-id'})], []);

const next = updateSendEmailAction({
detail,
Expand All @@ -412,8 +406,7 @@ describe('automations api helpers', () => {
expectSendEmailAction(updated);
expect(updated.data.email_subject).toBe('Just the subject');
expect(updated.data.email_lexical).toBe('{"root":{"children":[{"type":"paragraph"}]}}');
expect(updated.data.email_sender_name).toBe('Jane');
expect(updated.data.email_design_setting_id).toBe('placeholder');
expect(updated.data.email_design_setting_id).toBe('design-setting-id');
});

it('does not mutate the original detail or action', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,6 @@ const automationDetail: AutomationDetail = {
data: {
email_subject: 'Welcome to The Blueprint',
email_lexical: NON_EMPTY_EMAIL_LEXICAL,
email_sender_name: null,
email_sender_email: null,
email_sender_reply_to: null,
email_design_setting_id: 'design-1'
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,6 @@ const sendEmailActionSchema = z.object({
return false;
}
}),
email_sender_name: z.string().nullable(),
email_sender_email: z.string().nullable(),
email_sender_reply_to: z.string().nullable(),
email_design_setting_id: z.string().min(1)
}).strict()
}).strict();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ export interface SendEmailAction {
data: {
email_subject: string;
email_lexical: string;
email_sender_name: string | null;
email_sender_email: string | null;
email_sender_reply_to: string | null;
email_design_setting_id: string;
};
}
Expand Down Expand Up @@ -88,9 +85,6 @@ export type AutomationStepToRun = ReadonlyDeep<AutomationStepBase & (
type: 'send_email';
email_subject: string;
email_lexical: string;
email_sender_name: string | null;
email_sender_email: string | null;
email_sender_reply_to: string | null;
email_design_setting_id: string | null;
}
)>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,6 @@ interface ActionRow {
wait_hours: number | null;
email_subject: string | null;
email_lexical: string | null;
email_sender_name: string | null;
email_sender_email: string | null;
email_sender_reply_to: string | null;
email_design_setting_id: string | null;
}

Expand All @@ -54,9 +51,6 @@ type ActionRevisionRow = {
wait_hours: number | null;
email_subject: string | null;
email_lexical: string | null;
email_sender_name: string | null;
email_sender_email: string | null;
email_sender_reply_to: string | null;
email_design_setting_id: string | null;
};

Expand Down Expand Up @@ -90,9 +84,6 @@ type StepToRunRow = {
wait_hours: number | null;
email_subject: string | null;
email_lexical: string | null;
email_sender_name: string | null;
email_sender_email: string | null;
email_sender_reply_to: string | null;
email_design_setting_id: string | null;
};

Expand Down Expand Up @@ -360,9 +351,6 @@ function fetchAndLockSteps(database: DatabaseSync, limit: number): {
revision.wait_hours AS wait_hours,
revision.email_subject AS email_subject,
revision.email_lexical AS email_lexical,
revision.email_sender_name AS email_sender_name,
revision.email_sender_email AS email_sender_email,
revision.email_sender_reply_to AS email_sender_reply_to,
revision.email_design_setting_id AS email_design_setting_id
FROM automation_run_steps step
INNER JOIN automation_runs run ON run.id = step.automation_run_id
Expand Down Expand Up @@ -421,9 +409,6 @@ function buildStepToRun(row: ReadonlyDeep<StepToRunRow>): AutomationStepToRun {
type: 'send_email',
email_subject: requireValue(row, 'email_subject'),
email_lexical: requireValue(row, 'email_lexical'),
email_sender_name: row.email_sender_name,
email_sender_email: row.email_sender_email,
email_sender_reply_to: row.email_sender_reply_to,
email_design_setting_id: row.email_design_setting_id
};
default:
Expand Down Expand Up @@ -762,9 +747,6 @@ function buildRevisionActionData(action: AutomationAction, revision: ActionRevis
return {
email_subject: revision.email_subject,
email_lexical: revision.email_lexical,
email_sender_name: revision.email_sender_name,
email_sender_email: revision.email_sender_email,
email_sender_reply_to: revision.email_sender_reply_to,
email_design_setting_id: revision.email_design_setting_id
};
default: {
Expand All @@ -784,9 +766,6 @@ function loadLatestActionRevision(database: DatabaseSync, actionId: string): Act
wait_hours,
email_subject,
email_lexical,
email_sender_name,
email_sender_email,
email_sender_reply_to,
email_design_setting_id
FROM automation_action_revisions
WHERE action_id = ?
Expand Down Expand Up @@ -825,9 +804,6 @@ function insertActionRevision(database: DatabaseSync, actionId: string, action:
wait_hours,
email_subject,
email_lexical,
email_sender_name,
email_sender_email,
email_sender_reply_to,
email_design_setting_id
) VALUES (
:id,
Expand All @@ -836,9 +812,6 @@ function insertActionRevision(database: DatabaseSync, actionId: string, action:
:wait_hours,
:email_subject,
:email_lexical,
:email_sender_name,
:email_sender_email,
:email_sender_reply_to,
:email_design_setting_id
)
`).run(revision);
Expand Down Expand Up @@ -868,9 +841,6 @@ function buildActionRevision(actionId: string, action: AutomationAction, created
wait_hours: action.data.wait_hours,
email_subject: null,
email_lexical: null,
email_sender_name: null,
email_sender_email: null,
email_sender_reply_to: null,
email_design_setting_id: null
};
}
Expand All @@ -882,9 +852,6 @@ function buildActionRevision(actionId: string, action: AutomationAction, created
wait_hours: null,
email_subject: action.data.email_subject,
email_lexical: action.data.email_lexical,
email_sender_name: action.data.email_sender_name,
email_sender_email: action.data.email_sender_email,
email_sender_reply_to: action.data.email_sender_reply_to,
email_design_setting_id: action.data.email_design_setting_id
};
}
Expand Down Expand Up @@ -954,9 +921,6 @@ function loadActionRows(database: DatabaseSync, automationId: string): ActionRow
r.wait_hours AS wait_hours,
r.email_subject AS email_subject,
r.email_lexical AS email_lexical,
r.email_sender_name AS email_sender_name,
r.email_sender_email AS email_sender_email,
r.email_sender_reply_to AS email_sender_reply_to,
r.email_design_setting_id AS email_design_setting_id
FROM automation_actions a
INNER JOIN automation_action_revisions r ON r.action_id = a.id
Expand Down Expand Up @@ -1002,9 +966,6 @@ function buildActionPayload(row: ActionRow): AutomationAction {
data: {
email_subject: requireValue(row, 'email_subject'),
email_lexical: requireValue(row, 'email_lexical'),
email_sender_name: row.email_sender_name,
email_sender_email: row.email_sender_email,
email_sender_reply_to: row.email_sender_reply_to,
email_design_setting_id: requireValue(row, 'email_design_setting_id')
}
};
Expand Down
6 changes: 0 additions & 6 deletions ghost/core/core/server/services/automations/poll.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ type MemberWelcomeEmailService = {
email: {
designSettingId: string | null;
lexical: string;
senderEmail: string | null;
senderName: string | null;
senderReplyTo: string | null;
subject: string;
};
member: {
Expand Down Expand Up @@ -160,9 +157,6 @@ const processStep = async ({
email: {
designSettingId: step.email_design_setting_id,
lexical: step.email_lexical,
senderEmail: step.email_sender_email,
senderName: step.email_sender_name,
senderReplyTo: step.email_sender_reply_to,
subject: step.email_subject
},
member: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@ export function createTemporaryFakeAutomationsDatabase(): DatabaseSync {
version: 1
}
});
const fakeEmailSenderName = 'Ghost';
const fakeEmailSenderEmail = 'hello@example.com';
const fakeEmailSenderReplyTo = 'support@example.com';
const fakeEmailDesignSettingId = id();

database.exec(`
Expand Down Expand Up @@ -72,9 +69,6 @@ CREATE TABLE automation_action_revisions (
wait_hours INTEGER,
email_subject TEXT,
email_lexical TEXT,
email_sender_name TEXT,
email_sender_email TEXT,
email_sender_reply_to TEXT,
email_design_setting_id TEXT, -- not a real foreign key here
UNIQUE (created_at, action_id)
) STRICT;
Expand Down Expand Up @@ -206,8 +200,8 @@ CREATE TABLE automation_run_steps (

const insertActionRevision = database.prepare(`
INSERT INTO automation_action_revisions
(id, created_at, action_id, wait_hours, email_subject, email_lexical, email_sender_name, email_sender_email, email_sender_reply_to, email_design_setting_id) VALUES
(:id, :created_at, :action_id, :wait_hours, :email_subject, :email_lexical, :email_sender_name, :email_sender_email, :email_sender_reply_to, :email_design_setting_id)
(id, created_at, action_id, wait_hours, email_subject, email_lexical, email_design_setting_id) VALUES
(:id, :created_at, :action_id, :wait_hours, :email_subject, :email_lexical, :email_design_setting_id)
`);
insertActionRevision.run({
id: id(),
Expand All @@ -216,9 +210,6 @@ CREATE TABLE automation_run_steps (
wait_hours: 48,
email_subject: null,
email_lexical: null,
email_sender_name: null,
email_sender_email: null,
email_sender_reply_to: null,
email_design_setting_id: null
});
insertActionRevision.run({
Expand All @@ -228,9 +219,6 @@ CREATE TABLE automation_run_steps (
wait_hours: null,
email_subject: 'Welcome!',
email_lexical: fakeLexical,
email_sender_name: fakeEmailSenderName,
email_sender_email: fakeEmailSenderEmail,
email_sender_reply_to: fakeEmailSenderReplyTo,
email_design_setting_id: fakeEmailDesignSettingId
});
insertActionRevision.run({
Expand All @@ -240,9 +228,6 @@ CREATE TABLE automation_run_steps (
wait_hours: 72,
email_subject: null,
email_lexical: null,
email_sender_name: null,
email_sender_email: null,
email_sender_reply_to: null,
email_design_setting_id: null
});
insertActionRevision.run({
Expand All @@ -252,9 +237,6 @@ CREATE TABLE automation_run_steps (
wait_hours: null,
email_subject: 'Follow up',
email_lexical: fakeLexical,
email_sender_name: fakeEmailSenderName,
email_sender_email: fakeEmailSenderEmail,
email_sender_reply_to: fakeEmailSenderReplyTo,
email_design_setting_id: fakeEmailDesignSettingId
});
insertActionRevision.run({
Expand All @@ -264,9 +246,6 @@ CREATE TABLE automation_run_steps (
wait_hours: 48,
email_subject: null,
email_lexical: null,
email_sender_name: null,
email_sender_email: null,
email_sender_reply_to: null,
email_design_setting_id: null
});
insertActionRevision.run({
Expand All @@ -276,9 +255,6 @@ CREATE TABLE automation_run_steps (
wait_hours: null,
email_subject: 'Welcome to Paid!',
email_lexical: fakeLexical,
email_sender_name: fakeEmailSenderName,
email_sender_email: fakeEmailSenderEmail,
email_sender_reply_to: fakeEmailSenderReplyTo,
email_design_setting_id: fakeEmailDesignSettingId
});
insertActionRevision.run({
Expand All @@ -288,9 +264,6 @@ CREATE TABLE automation_run_steps (
wait_hours: 72,
email_subject: null,
email_lexical: null,
email_sender_name: null,
email_sender_email: null,
email_sender_reply_to: null,
email_design_setting_id: null
});
insertActionRevision.run({
Expand All @@ -300,9 +273,6 @@ CREATE TABLE automation_run_steps (
wait_hours: null,
email_subject: 'Exclusive Insights',
email_lexical: fakeLexical,
email_sender_name: fakeEmailSenderName,
email_sender_email: fakeEmailSenderEmail,
email_sender_reply_to: fakeEmailSenderReplyTo,
email_design_setting_id: fakeEmailDesignSettingId
});

Expand Down
Loading
Loading