[PR #2585] [CLOSED] fix: persist user locale preference in database across sessions #11845

Closed
opened 2026-05-06 16:27:33 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/fosrl/pangolin/pull/2585
Author: @Fizza-Mukhtar
Created: 3/2/2026
Status: Closed

Base: mainHead: fix/persist-user-locale-1547


📝 Commits (2)

  • fe92913 fix: persist user locale preference in database
  • 860136b fix: add locale field to myDevice response

📊 Changes

12 files changed (+132 additions, -9 deletions)

View changed files

📝 server/db/pg/schema/schema.ts (+1 -0)
📝 server/db/sqlite/schema/schema.ts (+1 -0)
📝 server/routers/external.ts (+1 -0)
📝 server/routers/user/getUser.ts (+2 -1)
📝 server/routers/user/index.ts (+1 -0)
📝 server/routers/user/myDevice.ts (+2 -1)
server/routers/user/updateUserLocale.ts (+59 -0)
📝 server/setup/migrationsPg.ts (+3 -1)
📝 server/setup/migrationsSqlite.ts (+3 -1)
server/setup/scriptsPg/1.16.1.ts (+24 -0)
server/setup/scriptsSqlite/1.16.1.ts (+25 -0)
📝 src/services/locale.ts (+10 -5)

📄 Description

Community Contribution License Agreement

By creating this pull request, I grant the project maintainers an unlimited,
perpetual license to use, modify, and redistribute these contributions under any terms they
choose, including both the AGPLv3 and the Fossorial Commercial license terms. I
represent that I have the right to grant this license for all contributed content.

Fixes #1547

Problem

Language preference was stored in a cookie which expires after ~1 day, causing the dashboard to forget the selected language.

Fix

  • Added locale field to user schema (SQLite + PostgreSQL)
  • Added DB migration 1.16.1 for both databases
  • Added POST /user/locale endpoint to save locale to DB
  • getUser endpoint now returns user's saved locale
  • Cookie expiry extended to 1 year as fallback
  • When user changes language, preference is saved to DB silently

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/fosrl/pangolin/pull/2585 **Author:** [@Fizza-Mukhtar](https://github.com/Fizza-Mukhtar) **Created:** 3/2/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/persist-user-locale-1547` --- ### 📝 Commits (2) - [`fe92913`](https://github.com/fosrl/pangolin/commit/fe92913026b1a2b10cbda9fcd185412c2b3cbdea) fix: persist user locale preference in database - [`860136b`](https://github.com/fosrl/pangolin/commit/860136b35cc7499003c798f73b81810773690f20) fix: add locale field to myDevice response ### 📊 Changes **12 files changed** (+132 additions, -9 deletions) <details> <summary>View changed files</summary> 📝 `server/db/pg/schema/schema.ts` (+1 -0) 📝 `server/db/sqlite/schema/schema.ts` (+1 -0) 📝 `server/routers/external.ts` (+1 -0) 📝 `server/routers/user/getUser.ts` (+2 -1) 📝 `server/routers/user/index.ts` (+1 -0) 📝 `server/routers/user/myDevice.ts` (+2 -1) ➕ `server/routers/user/updateUserLocale.ts` (+59 -0) 📝 `server/setup/migrationsPg.ts` (+3 -1) 📝 `server/setup/migrationsSqlite.ts` (+3 -1) ➕ `server/setup/scriptsPg/1.16.1.ts` (+24 -0) ➕ `server/setup/scriptsSqlite/1.16.1.ts` (+25 -0) 📝 `src/services/locale.ts` (+10 -5) </details> ### 📄 Description ## Community Contribution License Agreement By creating this pull request, I grant the project maintainers an unlimited, perpetual license to use, modify, and redistribute these contributions under any terms they choose, including both the AGPLv3 and the Fossorial Commercial license terms. I represent that I have the right to grant this license for all contributed content. Fixes #1547 ## Problem Language preference was stored in a cookie which expires after ~1 day, causing the dashboard to forget the selected language. ## Fix - Added `locale` field to user schema (SQLite + PostgreSQL) - Added DB migration `1.16.1` for both databases - Added `POST /user/locale` endpoint to save locale to DB - `getUser` endpoint now returns user's saved locale - Cookie expiry extended to 1 year as fallback - When user changes language, preference is saved to DB silently --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-05-06 16:27:33 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/pangolin#11845