Skip to content

Commit 9e01720

Browse files
committed
fix: correct misleading DDP deprecation replacements
Initial pass shipped 18 deprecation-message replacements that pointed developers at REST endpoints with materially different semantics or at paths that did not exist. Independent review classified them as WRONG, MISSING, or PARTIAL with silent-break risk: WRONG (drop replacement, keep deprecation) - 2fa:enable (TOTP enable vs email-2fa enable) - 2fa:disable (TOTP disable vs send email code) - deleteFileMessage (single-msg vs rooms.cleanHistory range purge) - getMessages (batched IDs vs single chat.getMessage) - loadNextMessages, loadSurroundingMessages (forward/window fetch vs chat.syncMessages delta) - readThreads (one thread vs whole-room read) - getSetupWizardParameters (wizard subset vs settings.public) - banner/dismiss (per-user set vs Banner.dismiss broadcast) MISSING - saveSettings (/v1/settings does not exist; only /v1/settings/:_id) PARTIAL (room-type or shape mismatch — silent break for callers) - loadHistory, joinRoom, leaveRoom, addUsersToRoom, getRoomByTypeAndName (channels.* fails on p/d/l rooms) - loadMissedMessages (chat.syncMessages has incompatible response) - spotlight, slashCommand (REST drops required params) For all 18, the replacement argument is now an empty array so the deprecation logger still reports the removal version without pointing to a wrong endpoint. Also fills four mappings that the previous heuristic missed because of case/separator differences or an unscanned EE api directory: - autoTranslate.getSupportedLanguages -> /v1/autotranslate.getSupportedLanguages - autoTranslate.translateMessage -> /v1/autotranslate.translateMessage - subscriptions/get -> /v1/subscriptions.get - getReadReceipts (EE) -> /v1/chat.getMessageReadReceipts scripts/audit-ddp-methods.mjs gains: - REST_DENYLIST that hard-blocks the 18 misleading mappings from being re-derived if the heuristic runs again, - lower-case and `/`-vs-`.` separator candidate paths so similarly misspelled mappings get matched, - apps/meteor/ee/server/api/ added to REST_DIRS so EE endpoints are visible to the audit. docs/ddp-replacement-review.md captures the per-method review notes.
1 parent 75519d9 commit 9e01720

26 files changed

Lines changed: 925 additions & 485 deletions

apps/meteor/app/2fa/server/methods/disable.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ declare module '@rocket.chat/ddp-client' {
1515

1616
Meteor.methods<ServerMethods>({
1717
async '2fa:disable'(code) {
18-
methodDeprecationLogger.method('2fa:disable', '9.0.0', '/v1/users.2fa.sendEmailCode');
18+
methodDeprecationLogger.method('2fa:disable', '9.0.0', []);
1919
const userId = Meteor.userId();
2020
if (!userId) {
2121
throw new Meteor.Error('not-authorized');

apps/meteor/app/2fa/server/methods/enable.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ declare module '@rocket.chat/ddp-client' {
1414

1515
Meteor.methods<ServerMethods>({
1616
async '2fa:enable'() {
17-
methodDeprecationLogger.method('2fa:enable', '9.0.0', '/v1/users.2fa.enableEmail');
17+
methodDeprecationLogger.method('2fa:enable', '9.0.0', []);
1818
const userId = Meteor.userId();
1919
if (!userId) {
2020
throw new Meteor.Error('not-authorized');

apps/meteor/app/autotranslate/server/methods/getSupportedLanguages.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import type { ServerMethods } from '@rocket.chat/ddp-client';
33
import { DDPRateLimiter } from 'meteor/ddp-rate-limiter';
44
import { Meteor } from 'meteor/meteor';
55

6+
import { methodDeprecationLogger } from '../../../lib/server/lib/deprecationWarningLogger';
67
import { getSupportedLanguages } from '../functions/getSupportedLanguages';
78

89
declare module '@rocket.chat/ddp-client' {
@@ -14,6 +15,7 @@ declare module '@rocket.chat/ddp-client' {
1415

1516
Meteor.methods<ServerMethods>({
1617
async 'autoTranslate.getSupportedLanguages'(targetLanguage) {
18+
methodDeprecationLogger.method('autoTranslate.getSupportedLanguages', '9.0.0', '/v1/autotranslate.getSupportedLanguages');
1719
const userId = Meteor.userId();
1820

1921
if (!userId) {

apps/meteor/app/autotranslate/server/methods/translateMessage.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { check } from 'meteor/check';
55
import { Meteor } from 'meteor/meteor';
66

77
import { canAccessRoomAsync } from '../../../authorization/server';
8+
import { methodDeprecationLogger } from '../../../lib/server/lib/deprecationWarningLogger';
89
import { translateMessage } from '../functions/translateMessage';
910

1011
declare module '@rocket.chat/ddp-client' {
@@ -16,6 +17,7 @@ declare module '@rocket.chat/ddp-client' {
1617

1718
Meteor.methods<ServerMethods>({
1819
async 'autoTranslate.translateMessage'(message, targetLanguage) {
20+
methodDeprecationLogger.method('autoTranslate.translateMessage', '9.0.0', '/v1/autotranslate.translateMessage');
1921
const userId = Meteor.userId();
2022
if (!userId) {
2123
throw new Meteor.Error('error-invalid-user', 'Invalid user', {

apps/meteor/app/lib/server/methods/addUsersToRoom.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ export const addUsersToRoomMethod = async (userId: string, data: { rid: string;
123123

124124
Meteor.methods<ServerMethods>({
125125
async addUsersToRoom(data) {
126-
methodDeprecationLogger.method('addUsersToRoom', '9.0.0', '/v1/channels.invite');
126+
methodDeprecationLogger.method('addUsersToRoom', '9.0.0', []);
127127
const uid = Meteor.userId();
128128
// Validate user and room
129129
if (!uid) {

apps/meteor/app/lib/server/methods/getMessages.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ declare module '@rocket.chat/ddp-client' {
1616

1717
Meteor.methods<ServerMethods>({
1818
async getMessages(messages) {
19-
methodDeprecationLogger.method('getMessages', '9.0.0', '/v1/chat.getMessage');
19+
methodDeprecationLogger.method('getMessages', '9.0.0', []);
2020
check(messages, [String]);
2121
const uid = Meteor.userId();
2222

apps/meteor/app/lib/server/methods/joinRoom.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ declare module '@rocket.chat/ddp-client' {
1616

1717
Meteor.methods<ServerMethods>({
1818
async joinRoom(rid, code) {
19-
methodDeprecationLogger.method('joinRoom', '9.0.0', '/v1/channels.join');
19+
methodDeprecationLogger.method('joinRoom', '9.0.0', []);
2020
check(rid, String);
2121

2222
const user = await Meteor.userAsync();

apps/meteor/app/lib/server/methods/leaveRoom.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export const leaveRoomMethod = async (user: IUser, rid: string): Promise<void> =
5959

6060
Meteor.methods<ServerMethods>({
6161
async leaveRoom(rid) {
62-
methodDeprecationLogger.method('leaveRoom', '9.0.0', '/v1/channels.leave');
62+
methodDeprecationLogger.method('leaveRoom', '9.0.0', []);
6363
check(rid, String);
6464

6565
if (!Meteor.userId()) {

apps/meteor/app/lib/server/methods/saveSettings.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ Meteor.methods<ServerMethods>({
5151
value: ISetting['value'];
5252
}[] = [],
5353
) {
54-
methodDeprecationLogger.method('saveSettings', '9.0.0', '/v1/settings');
54+
methodDeprecationLogger.method('saveSettings', '9.0.0', []);
5555
const uid = Meteor.userId();
5656
const settingsNotAllowed: ISetting['_id'][] = [];
5757
if (uid === null) {

apps/meteor/app/utils/server/slashCommand.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ declare module '@rocket.chat/ddp-client' {
141141

142142
Meteor.methods<ServerMethods>({
143143
async slashCommand(command) {
144-
methodDeprecationLogger.method('slashCommand', '9.0.0', '/v1/commands.run');
144+
methodDeprecationLogger.method('slashCommand', '9.0.0', []);
145145
const userId = Meteor.userId();
146146
if (!userId) {
147147
throw new Meteor.Error('error-invalid-user', 'Invalid user', {

0 commit comments

Comments
 (0)