Skip to content

Commit

Permalink
chore!: removed mailer.sendMail mailer:unsubscribe methods (#33358)
Browse files Browse the repository at this point in the history
  • Loading branch information
abhinavkrin authored and ggazzo committed Oct 17, 2024
1 parent 26604d4 commit e40b358
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 74 deletions.
5 changes: 5 additions & 0 deletions .changeset/slow-rules-bow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@rocket.chat/meteor': patch
---

This adjustment removes the deprecated `Mailer.sendMail` and `Mailer:unsubscribe` methods. Moving forward, use the `mailer` and `mailer.unsubscribe` endpoints.
7 changes: 5 additions & 2 deletions apps/meteor/app/api/server/v1/mailer.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { isMailerProps, isMailerUnsubscribeProps } from '@rocket.chat/rest-typings';

import { sendMail } from '../../../mail-messages/server/functions/sendMail';
import { Mailer } from '../../../mail-messages/server/lib/Mailer';
import { API } from '../api';

API.v1.addRoute(
Expand All @@ -13,7 +15,7 @@ API.v1.addRoute(
async post() {
const { from, subject, body, dryrun, query } = this.bodyParams;

const result = await Meteor.callAsync('Mailer.sendMail', from, subject, body, Boolean(dryrun), query);
const result = await sendMail({ from, subject, body, dryrun: Boolean(dryrun), query });

return API.v1.success(result);
},
Expand All @@ -25,12 +27,13 @@ API.v1.addRoute(
{
authRequired: true,
validateParams: isMailerUnsubscribeProps,
rateLimiterOptions: { intervalTimeInMS: 60000, numRequestsAllowed: 1 },
},
{
async post() {
const { _id, createdAt } = this.bodyParams;

await Meteor.callAsync('Mailer:unsubscribe', _id, createdAt);
await Mailer.unsubscribe(_id, createdAt);

return API.v1.success();
},
Expand Down
2 changes: 0 additions & 2 deletions apps/meteor/app/mail-messages/server/index.ts

This file was deleted.

36 changes: 0 additions & 36 deletions apps/meteor/app/mail-messages/server/methods/sendMail.ts

This file was deleted.

33 changes: 0 additions & 33 deletions apps/meteor/app/mail-messages/server/methods/unsubscribe.ts

This file was deleted.

1 change: 0 additions & 1 deletion apps/meteor/server/importPackages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ import '../app/e2e/server';
import '../app/version-check/server';
import '../app/search/server';
import '../app/discussion/server';
import '../app/mail-messages/server';
import '../app/user-status/server';
import '../app/metrics/server';
import '../app/notifications/server';
Expand Down

0 comments on commit e40b358

Please sign in to comment.