chore: migrate low-friction DDP callers to REST endpoints

Merged
GG
5mo ago
+111-43

Summary

Replaces 6 client-side DDP callers with their REST equivalents. Each one was a 1:1 swap — same parameters, same response shape (or trivially destructured). The DDP methods stay registered on the server for external SDK/mobile clients until the 9.0.0 sweep removes them.

Methods migrated

MethodRESTCaller(s)
license:isEnterpriseGET /v1/licenses.info (license.hasValidLicense)useRestrictedRoles.ts
license:getModulesGET /v1/licenses.info (license.activeModules)fetchFeatures.ts
banner/dismissPOST /v1/banners.dismissuseDismissUserBannerMutation.ts
setReactionPOST /v1/chat.reactprocessSetReaction.ts
slashCommandPOST /v1/commands.runprocessSlashCommand.ts
e2e.resetOwnE2EKeyPOST /v1/users.resetE2EKeyuseResetE2EPasswordMutation.ts

Methods skipped (need design work, separate PRs)

These looked easy but the REST endpoint diverges in shape, accepts a different param, or restricts room types — listed in docs/ddp-migration-checklist.md:

  • userSetUtcOffset — /v1/users.setPreferences doesn't expose utcOffset.
  • requestDataDownload — REST strips pendingOperationsBeforeMyRequest + url fields the caller uses.
  • deleteFileMessage — DDP takes fileID, REST chat.delete takes msgId + roomId.
  • joinRoom — REST channels.join only finds t === 'c' | 'l' rooms; DDP is generic.
  • leaveRoom — needs per-room-type dispatch (channels.leave / groups.leave / im.leave).
  • addUsersToRoom — same dispatch issue (channels.invite / groups.invite).
  • spotlight — REST drops the usernames filter and type config.
  • loadMissedMessages — REST chat.syncMessages returns serialized timestamps + different cursor shape.
  • readThreads — REST subscriptions.read operates on subscriptions; DDP marks the thread tmid.
  • registerUser — REST users.create requires admin permissions; DDP is anonymous-sign-up entry.

Test plan

  • Login as a workspace where license.hasValidLicense is true — guest role still gets view-d-room/view-joined-room/etc.
  • fetchFeatures populates the modules list (check feature flags pages).
  • Dismiss a workspace banner — toast on error, banner gone on success.
  • Send +:emoji: as a single line — reaction applies to the previous message.
  • Run a slash command (/help, /leave, etc.) — output appears, errors show toast.
  • Reset own E2E password — toast success, logged out.

Summary by CodeRabbit

  • Refactor
    • Multiple client flows now call REST endpoints (reactions, slash commands, license checks, banner dismissal, E2E reset, role checks, leave room, add users/invite flows).
    • Group/user payload shape extended to accept multiple user-identification forms.
  • Bug Fix
    • Reaction failures show an error toast to users.
  • Deprecation
    • Several legacy server methods now emit deprecation warnings; one commands parameter made optional.

Review Change Stack

Task: ARCH-2162