chore: migrate DDP callers to REST endpoints (used methods with REST replacement)

Merged
GG
5mo ago
+121-69

Summary

Replaces runtime DDP callers in apps/meteor/client with their REST equivalents for methods that already have a working /v1 endpoint. DDP method registrations stay on the server — they remain reachable for external SDK/mobile clients until 9.0.0 removes them.

Status

MethodCallerStatus
personalAccessTokens:generateTokenAddToken.tsx✅ migrated
personalAccessTokens:regenerateTokenAccountTokensTable.tsx✅ migrated
personalAccessTokens:removeTokenAccountTokensTable.tsx✅ migrated
autoTranslate.getSupportedLanguagesapp/autotranslate/client/lib/autotranslate.ts✅ migrated
autoTranslate.translateMessageuseTranslateAction.ts, useViewOriginalTranslationAction.ts✅ migrated
cloud:syncWorkspaceRegisteredWorkspaceModal.tsx✅ migrated
createDirectMessageuseOpenRoom.ts + slashcommand✅ migrated
createPrivateGroupGameCenterInvitePlayersModal.tsx✅ migrated
e2e.getUsersOfRoomWithoutKeyclient/lib/e2ee/rocketchat.e2e.room.ts✅ migrated
e2e.setRoomKeyIDclient/lib/e2ee/rocketchat.e2e.room.ts✅ migrated
executeSlashCommandPreviewComposerBoxPopupPreview.tsx✅ migrated
getRoomByIduseGoToRoom.ts✅ migrated (mapper handles room wrapper + Date→string)
getSingleMessageclient/lib/chats/data.ts✅ migrated
getSlashCommandPreviewsComposerPopupProvider.tsx✅ migrated
getThreadMessagesuseThreadMessagesQuery.ts✅ migrated; read-marker side effect restored via separate readThreads DDP call
listCustomUserStatususeStatusItems.tsx✅ migrated (mapCustomUserStatusFromApi)
saveRoomSettingsapp/slashcommands-topic/client/topic.ts✅ migrated
setUserStatusapp/slashcommands-status/client/status.ts✅ migrated
getReadReceipts (EE)ReadReceiptsModal.tsx⏳ deferred — REST migration triggered timing issues with optimistic message reconciliation; plan in docs/ddp-migration-sendMessage-getReadReceipts-plan.md, follow-up #40675
sendMessage8 callers⏳ deferred — same timing issue (quote-attachment e2e fails); plan documented, follow-up #40675
registerUserComposerAnonymous.tsx + SetupWizardProvider.tsx⏳ pending
requestDataDownloadPreferencesMyDataSection.tsx⏳ pending
setAvatarFromServiceuseUpdateAvatar.ts⏳ pending (REST takes multipart image or avatarUrl; no service param)
subscriptions/getclient/lib/cachedStores/CachedStore.ts⏳ pending (template-literal call ${this.name}/get; whole CachedStore abstraction needs review)

Mappers

REST responses serialize Date to ISO strings while DDP returns Date. Three mappers added under client/lib/utils/ keep call-sites typed against the domain shape:

  • mapMessageFromApi (existed)
  • mapCustomUserStatusFromApi
  • mapReadReceiptFromApi

Reverted

sendMessage + getReadReceipts were migrated in an earlier revision and reverted in this branch — both broke optimistic UI reconciliation and read-receipt timing in e2e (quote-attachment.spec.ts, omnichannel-livechat-read-receipts.spec.ts). Follow-up #40675 carries the deeper fix (server-side await + client reconcile via Messages.state.update(mapMessageFromApi(saved))).

Test plan

  • Account tokens: add, regenerate, remove
  • Auto-translate toggle + per-message translate/original
  • Workspace sync from admin
  • Create DM via /dm + room open from search
  • Game Center invite (private group create + opening welcome message)
  • E2EE room: enable encryption, exchange keys, post message
  • Slash-command preview popup (/giphy, /topic previews)
  • Go-to-room by id (links, deeplinks)
  • Thread message list + read-marker
  • Custom user statuses dropdown
  • /topic, /status slash commands

Task: ARCH-2159

Summary by CodeRabbit

  • Refactor
    • Switched many client actions to use standardized REST endpoints (translations, slash commands, direct messages, status/topic updates, thread and room retrieval, tokens, workspace sync, group creation, E2E key ops), improving backend consistency without changing user flows.
  • New Utilities
    • Added utilities to map custom user statuses and read receipts from API responses.

Review Change Stack