Removed usage of GhostMailer in MilestonesService

no issue

- With the switch of using a `MilestoneCreatedEvent` we'll be decoupling the mailing functionality and not need `GhostMailer` as dependency in the package anymore
This commit is contained in:
Aileen Nowak 2023-02-15 12:10:29 +02:00 committed by Aileen Booker
parent 513b7d1df4
commit b55a95b944
3 changed files with 0 additions and 65 deletions

View File

@ -34,14 +34,11 @@ module.exports = {
} = require('@tryghost/milestones');
const config = require('../../../shared/config');
const milestonesConfig = config.get('milestones');
const {GhostMailer} = require('../mail');
const mailer = new GhostMailer();
const repository = new InMemoryMilestoneRepository({DomainEvents});
const queries = new MilestoneQueries({db});
this.api = new MilestonesService({
mailer,
repository,
milestonesConfig, // avoid using getters and pass as JSON
queries

View File

@ -17,11 +17,6 @@ const Milestone = require('./Milestone');
* @prop {() => Promise<string>} getDefaultCurrency
*/
/**
* @typedef {object} ghostMailer
* @property {Function} send
*/
/**
* @typedef {object} milestonesConfig
* @prop {Array<object>} milestonesConfig.arr
@ -34,10 +29,6 @@ module.exports = class MilestonesService {
/** @type {IMilestoneRepository} */
#repository;
/**
* @type {ghostMailer} */
#mailer;
/**
* @type {milestonesConfig} */
#milestonesConfig;
@ -47,13 +38,11 @@ module.exports = class MilestonesService {
/**
* @param {object} deps
* @param {ghostMailer} deps.mailer
* @param {IMilestoneRepository} deps.repository
* @param {milestonesConfig} deps.milestonesConfig
* @param {IQueries} deps.queries
*/
constructor(deps) {
this.#mailer = deps.mailer;
this.#milestonesConfig = deps.milestonesConfig;
this.#queries = deps.queries;
this.#repository = deps.repository;
@ -147,13 +136,6 @@ module.exports = class MilestonesService {
const shouldSendEmail = await this.#shouldSendEmail();
if (shouldSendEmail) {
// TODO: hook up Ghostmailer or use StaffService and trigger event to send email
// await this.#mailer.send({
// subject: 'Test',
// html: '<div>Milestone achieved</div>',
// to: 'test@example.com'
// });
milestone.emailSentAt = new Date();
}

View File

@ -48,10 +48,6 @@ describe('MilestonesService', function () {
const milestoneEmailService = new MilestonesService({
repository,
mailer: {
// TODO: make this a stub
send: async () => {}
},
milestonesConfig,
queries: {
async getARR() {
@ -108,10 +104,6 @@ describe('MilestonesService', function () {
const milestoneEmailService = new MilestonesService({
repository,
mailer: {
// TODO: make this a stub
send: async () => {}
},
milestonesConfig,
queries: {
async getARR() {
@ -141,10 +133,6 @@ describe('MilestonesService', function () {
const milestoneEmailService = new MilestonesService({
repository,
// TODO: make this a stub
mailer: {
send: async () => {}
},
milestonesConfig,
queries: {
async getARR() {
@ -179,10 +167,6 @@ describe('MilestonesService', function () {
const milestoneEmailService = new MilestonesService({
repository,
mailer: {
// TODO: make this a stub
send: async () => {}
},
milestonesConfig,
queries: {
async getARR() {
@ -207,10 +191,6 @@ describe('MilestonesService', function () {
const milestoneEmailService = new MilestonesService({
repository,
mailer: {
// TODO: make this a stub
send: async () => {}
},
milestonesConfig,
queries: {
async getARR() {
@ -251,10 +231,6 @@ describe('MilestonesService', function () {
const milestoneEmailService = new MilestonesService({
repository,
mailer: {
// TODO: make this a stub
send: async () => {}
},
milestonesConfig,
queries: {
async getARR() {
@ -284,10 +260,6 @@ describe('MilestonesService', function () {
const milestoneEmailService = new MilestonesService({
repository,
mailer: {
// TODO: make this a stub
send: async () => {}
},
milestonesConfig,
queries: {
async getMembersCount() {
@ -341,10 +313,6 @@ describe('MilestonesService', function () {
const milestoneEmailService = new MilestonesService({
repository,
mailer: {
// TODO: make this a stub
send: async () => {}
},
milestonesConfig,
queries: {
async getMembersCount() {
@ -382,10 +350,6 @@ describe('MilestonesService', function () {
const milestoneEmailService = new MilestonesService({
repository,
mailer: {
// TODO: make this a stub
send: async () => {}
},
milestonesConfig,
queries: {
async getMembersCount() {
@ -419,10 +383,6 @@ describe('MilestonesService', function () {
const milestoneEmailService = new MilestonesService({
repository,
mailer: {
// TODO: make this a stub
send: async () => {}
},
milestonesConfig,
queries: {
async getMembersCount() {
@ -462,10 +422,6 @@ describe('MilestonesService', function () {
const milestoneEmailService = new MilestonesService({
repository,
mailer: {
// TODO: make this a stub
send: async () => {}
},
milestonesConfig,
queries: {
async getMembersCount() {