changeUserName static method
Updates a users name, returns null if unsuccessful.
Implementation
static Future<UserInfo?> changeUserName(
Session session,
int userId,
String newUserName,
) async {
var userInfo = await findUserByUserId(session, userId, useCache: false);
if (userInfo == null) return null;
userInfo.userName = newUserName;
await UserInfo.db.updateRow(session, userInfo);
if (AuthConfig.current.onUserUpdated != null) {
await AuthConfig.current.onUserUpdated!(session, userInfo);
}
await invalidateCacheForUser(session, userId);
return userInfo;
}