Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions server/account/src/operations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ import {
sendEmailConfirmation,
sendOtp,
setPassword,
setTimezoneIfNotDefined,
setTimezone,
signUpByEmail,
updateWorkspaceRole,
verifyAllowedRole,
Expand Down Expand Up @@ -281,7 +281,7 @@ export async function signUp (
await confirmHulyIds(ctx, db, account)
}

void setTimezoneIfNotDefined(ctx, db, account, null, meta)
void setTimezone(ctx, db, account, null, meta)
return {
account,
name: getPersonName(person),
Expand Down Expand Up @@ -1151,7 +1151,7 @@ export async function signUpJoin (
})

const { account } = await signUpByEmail(ctx, db, branding, email, password, first, last ?? '', true)
void setTimezoneIfNotDefined(ctx, db, account, null, meta)
void setTimezone(ctx, db, account, null, meta)

return await doJoinByInvite(
ctx,
Expand Down Expand Up @@ -1749,7 +1749,7 @@ export async function getLoginInfoByToken (
}

if (!isSystem) {
void setTimezoneIfNotDefined(ctx, db, accountUuid, null, meta)
void setTimezone(ctx, db, accountUuid, null, meta)
}

if (workspaceUuid != null && workspaceUuid !== '') {
Expand Down
6 changes: 3 additions & 3 deletions server/account/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -709,7 +709,7 @@ export async function selectWorkspace (
}

if (accountUuid !== systemAccountUuid && meta !== undefined) {
void setTimezoneIfNotDefined(ctx, db, accountUuid, account, meta)
void setTimezone(ctx, db, accountUuid, account, meta)
}

if (role === AccountRole.ReadOnlyGuest) {
Expand Down Expand Up @@ -1780,7 +1780,7 @@ export function generatePassword (len: number = 24): string {
return randomBytes(len).toString('base64').slice(0, len)
}

export async function setTimezoneIfNotDefined (
export async function setTimezone (
ctx: MeasureContext,
db: AccountDB,
accountId: AccountUuid,
Expand All @@ -1794,7 +1794,7 @@ export async function setTimezoneIfNotDefined (
ctx.warn('Failed to find account')
return
}
if (existingAccount.timezone != null) return
if (existingAccount.timezone === meta?.timezone) return
await db.account.update({ uuid: accountId }, { timezone: meta.timezone })
} catch (err: any) {
ctx.error('Failed to set account timezone', err)
Expand Down
Loading