fix(users): use updateAsync for Meteor 3 server-side user writes
All checks were successful
build-image / build (push) Successful in 12m38s

Meteor.users.update() is sync-only and no longer exists server-side
under Meteor 3, so it threw on every call, surfacing as a generic
500 to the client. users.setLang runs on every page load for logged-in
users, which is what broke /zones; the same bug in edit-profile.js
was silently breaking /profile too.
This commit is contained in:
vjrj 2026-07-30 10:13:21 +02:00
parent 570cb49764
commit 775461f7b2
2 changed files with 6 additions and 6 deletions

View file

@ -4,9 +4,9 @@ import { Meteor } from 'meteor/meteor';
let action;
const updateUser = (userId, { emailAddress, profile }) => {
const updateUser = async (userId, { emailAddress, profile }) => {
try {
Meteor.users.update(userId, {
await Meteor.users.updateAsync(userId, {
$set: {
'emails.0.address': emailAddress,
profile,
@ -17,10 +17,10 @@ const updateUser = (userId, { emailAddress, profile }) => {
}
};
const editProfile = ({ userId, profile }, promise) => {
const editProfile = async ({ userId, profile }, promise) => {
try {
action = promise;
updateUser(userId, profile);
await updateUser(userId, profile);
action.resolve();
} catch (exception) {
action.reject(`[editProfile.handler] ${exception}`);

View file

@ -33,9 +33,9 @@ Meteor.methods({
throw new Meteor.Error('500', exception);
});
},
'users.setLang': function userLang(lang) {
'users.setLang': async function userLang(lang) {
check(lang, validLangCode);
Meteor.users.update({ _id: this.userId }, { $set: { lang } });
await Meteor.users.updateAsync({ _id: this.userId }, { $set: { lang } });
},
'auth.getHash': async function getHash() {
const token = Accounts._generateStampedLoginToken();