Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
canifa_note
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Vũ Hoàng Anh
canifa_note
Commits
fbcdf0fb
Unverified
Commit
fbcdf0fb
authored
Aug 18, 2025
by
varsnotwars
Committed by
GitHub
Aug 18, 2025
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix update theme not saving (#5012)
parent
01d3f2f8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
19 deletions
+18
-19
user_service.go
server/router/api/v1/user_service.go
+14
-17
theme.ts
web/src/utils/theme.ts
+4
-2
No files found.
server/router/api/v1/user_service.go
View file @
fbcdf0fb
...
...
@@ -372,30 +372,27 @@ func (s *APIV1Service) UpdateUserSetting(ctx context.Context, request *v1pb.Upda
return
nil
,
status
.
Errorf
(
codes
.
InvalidArgument
,
"invalid setting key: %v"
,
err
)
}
// get existing user setting
existingUserSetting
,
err
:=
s
.
Store
.
GetUserSetting
(
ctx
,
&
store
.
FindUserSetting
{
UserID
:
&
userID
,
Key
:
storeKey
,
})
if
err
!=
nil
{
return
nil
,
err
}
if
existingUserSetting
==
nil
{
return
nil
,
status
.
Errorf
(
codes
.
NotFound
,
"%s not found"
,
storeKey
.
String
())
}
// Only GENERAL settings are supported via UpdateUserSetting
// Other setting types have dedicated service methods
if
storeKey
!=
storepb
.
UserSetting_GENERAL
{
return
nil
,
status
.
Errorf
(
codes
.
InvalidArgument
,
"setting type %s should not be updated via UpdateUserSetting"
,
storeKey
.
String
())
}
// Start with existing general setting values
existingGeneral
:=
existingUserSetting
.
GetGeneral
()
existingUserSetting
,
_
:=
s
.
Store
.
GetUserSetting
(
ctx
,
&
store
.
FindUserSetting
{
UserID
:
&
userID
,
Key
:
storeKey
,
})
generalSetting
:=
&
storepb
.
GeneralUserSetting
{}
if
existingUserSetting
!=
nil
{
// Start with existing general setting values
generalSetting
=
existingUserSetting
.
GetGeneral
()
}
updatedGeneral
:=
&
v1pb
.
UserSetting_GeneralSetting
{
MemoVisibility
:
existingGeneral
.
GetMemoVisibility
(),
Locale
:
existingGeneral
.
GetLocale
(),
Theme
:
existingGeneral
.
GetTheme
(),
MemoVisibility
:
generalSetting
.
GetMemoVisibility
(),
Locale
:
generalSetting
.
GetLocale
(),
Theme
:
generalSetting
.
GetTheme
(),
}
// Apply updates for fields specified in the update mask
...
...
web/src/utils/theme.ts
View file @
fbcdf0fb
import
defaultDarkThemeContent
from
"../themes/default-dark.css?raw"
;
import
paperThemeContent
from
"../themes/paper.css?raw"
;
import
whitewallThemeContent
from
"../themes/whitewall.css?raw"
;
const
VALID_THEMES
=
[
"default"
,
"default-dark"
,
"paper"
,
"whitewall"
]
as
const
;
type
ValidTheme
=
(
typeof
VALID_THEMES
)[
number
];
...
...
@@ -6,8 +8,8 @@ type ValidTheme = (typeof VALID_THEMES)[number];
const
THEME_CONTENT
:
Record
<
ValidTheme
,
string
|
null
>
=
{
default
:
null
,
"default-dark"
:
defaultDarkThemeContent
,
paper
:
null
,
whitewall
:
null
,
paper
:
paperThemeContent
,
whitewall
:
whitewallThemeContent
,
};
const
validateTheme
=
(
theme
:
string
):
ValidTheme
=>
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment