Skip to content

feat: initialize user timezone and language from browser#36170

Merged
lyzno1 merged 9 commits into
mainfrom
codex/initialize-user-timezone
May 15, 2026
Merged

feat: initialize user timezone and language from browser#36170
lyzno1 merged 9 commits into
mainfrom
codex/initialize-user-timezone

Conversation

@lyzno1
Copy link
Copy Markdown
Member

@lyzno1 lyzno1 commented May 14, 2026

Summary

  • initialize new user timezone from browser timezone for email-code signup, email-password signup, OAuth signup, and invite activation defaults
  • initialize signup, OAuth, and invite settings language from the frontend-resolved locale instead of falling back to backend/default English when available
  • carry timezone and language through OAuth state while preserving invite-token compatibility
  • keep existing language-derived timezone and default-language fallbacks when frontend preferences are unavailable

Tests

  • uv run --project api ruff check api/libs/oauth.py api/controllers/console/auth/oauth.py api/controllers/console/auth/login.py api/controllers/console/auth/email_register.py api/services/account_service.py api/tests/unit_tests/libs/test_oauth_base.py api/tests/unit_tests/libs/test_oauth_clients.py api/tests/unit_tests/controllers/console/auth/test_oauth_timezone.py api/tests/unit_tests/controllers/console/auth/test_email_register_language.py api/tests/unit_tests/controllers/console/auth/test_email_verification.py api/tests/unit_tests/services/test_account_service.py api/tests/test_containers_integration_tests/controllers/console/auth/test_oauth.py api/tests/test_containers_integration_tests/controllers/console/auth/test_email_register.py
  • uv run --project api pytest api/tests/unit_tests/libs/test_oauth_base.py api/tests/unit_tests/libs/test_oauth_clients.py api/tests/unit_tests/controllers/console/auth/test_oauth_timezone.py api/tests/unit_tests/controllers/console/auth/test_email_register_language.py
  • pnpm -C web test app/signin/components/tests/social-auth.spec.tsx app/signup/set-password/tests/page.spec.tsx app/signin/invite-settings/tests/page.spec.tsx
  • pnpm -C web type-check
  • git diff --check

@dosubot dosubot Bot added the size:L This PR changes 100-499 lines, ignoring generated files. label May 14, 2026
@github-actions github-actions Bot added the web This relates to changes on the web. label May 14, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 14, 2026

Pyrefly Type Coverage

Metric Base PR Delta
Type coverage 0.00% 43.67% +43.67%
Strict coverage 0.00% 43.19% +43.19%
Typed symbols 0 22,104 +22,104
Untyped symbols 0 28,829 +28,829
Modules 0 2556 +2,556

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 14, 2026

Pyrefly Diff

base → PR
--- /tmp/pyrefly_base.txt	2026-05-15 02:58:21.561305169 +0000
+++ /tmp/pyrefly_pr.txt	2026-05-15 02:58:14.573228316 +0000
@@ -3,7 +3,7 @@
 ERROR Object of class `App` has no attribute `access_mode` [missing-attribute]
    --> controllers/console/app/app.py:583:13
 ERROR Argument `str | None` is not assignable to parameter `language` with type `str` in function `services.account_service.AccountService.send_email_register_email` [bad-argument-type]
-  --> controllers/console/auth/email_register.py:73:108
+  --> controllers/console/auth/email_register.py:83:108
 ERROR Object of class `MissingRouter` has no attribute `get` [missing-attribute]
   --> controllers/console/init_validate.py:31:2
 ERROR Object of class `MissingRouter` has no attribute `post` [missing-attribute]
@@ -535,7 +535,7 @@
 ERROR No matching overload found for function `redis.client.Redis.__init__` called with arguments: (host=int | str | Unknown, port=int | str | Unknown, password=int | str | Unknown | None, db=int, ssl=bool, ssl_ca_certs=str | None, ssl_cert_reqs=Any | None, ssl_certfile=Any | None, ssl_keyfile=Any | None, socket_timeout=Literal[5], socket_connect_timeout=Literal[5], health_check_interval=Literal[30]) [no-matching-overload]
   --> schedule/queue_monitor_task.py:14:21
 ERROR Object of class `Tenant` has no attribute `role` [missing-attribute]
-    --> services/account_service.py:1169:13
+    --> services/account_service.py:1179:13
 ERROR No matching overload found for function `flask.helpers.stream_with_context` called with arguments: (Generator[bytes]) [no-matching-overload]
    --> services/audio_service.py:144:56
 ERROR No matching overload found for function `flask.helpers.stream_with_context` called with arguments: (Generator[bytes]) [no-matching-overload]
@@ -611,9 +611,9 @@
 ERROR Argument value `Literal[0]` violates Pydantic `ge` constraint `Literal[1]` for field `page` [bad-argument-type]
    --> tests/test_containers_integration_tests/controllers/console/app/test_app_apis.py:700:51
 ERROR Object of class `RequestError` has no attribute `response` [missing-attribute]
-   --> tests/test_containers_integration_tests/controllers/console/auth/test_oauth.py:197:9
+   --> tests/test_containers_integration_tests/controllers/console/auth/test_oauth.py:245:9
 ERROR Object of class `RequestError` has no attribute `response` [missing-attribute]
-   --> tests/test_containers_integration_tests/controllers/console/auth/test_oauth.py:198:9
+   --> tests/test_containers_integration_tests/controllers/console/auth/test_oauth.py:246:9
 ERROR `SimpleNamespace` is not assignable to attribute `mcp_ns` with type `Namespace` [bad-assignment]
   --> tests/test_containers_integration_tests/controllers/mcp/test_mcp.py:27:21
 ERROR Attribute `payload` of class `Namespace` is a read-only property and cannot be set [read-only]

@codecov
Copy link
Copy Markdown

codecov Bot commented May 14, 2026

Codecov Report

❌ Patch coverage is 90.24390% with 12 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.93%. Comparing base (7654f14) to head (446d52f).
⚠️ Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
api/controllers/console/auth/oauth.py 87.09% 3 Missing and 1 partial ⚠️
web/utils/timezone.ts 25.00% 3 Missing ⚠️
api/controllers/console/auth/email_register.py 87.50% 1 Missing and 1 partial ⚠️
api/controllers/console/auth/login.py 77.77% 1 Missing and 1 partial ⚠️
web/service/use-common.ts 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #36170      +/-   ##
==========================================
- Coverage   85.94%   85.93%   -0.02%     
==========================================
  Files        4454     4458       +4     
  Lines      210919   211150     +231     
  Branches    39428    39476      +48     
==========================================
+ Hits       181280   181450     +170     
- Misses      26436    26499      +63     
+ Partials     3203     3201       -2     
Flag Coverage Δ
api 85.44% <92.00%> (+0.01%) ⬆️
dify-ui 94.40% <ø> (ø)
web 86.56% <82.60%> (-0.06%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@lyzno1 lyzno1 changed the title feat: initialize user timezone from browser feat: initialize user timezone and language from browser May 14, 2026
Copy link
Copy Markdown
Contributor

@hjlarry hjlarry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label May 15, 2026
@lyzno1 lyzno1 added this pull request to the merge queue May 15, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to no response for status checks May 15, 2026
@lyzno1 lyzno1 added this pull request to the merge queue May 15, 2026
Merged via the queue into main with commit a252fbd May 15, 2026
37 checks passed
@lyzno1 lyzno1 deleted the codex/initialize-user-timezone branch May 15, 2026 08:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm This PR has been approved by a maintainer size:L This PR changes 100-499 lines, ignoring generated files. web This relates to changes on the web.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants