Skip to content

Commit 1ddd74f

Browse files
committed
icons/rest-api: load user theme
Change-Id: I23e302a56a13f19f8540e08ff30137db7cf4f676 JIRA-Ref: CMK-28547
1 parent e219a17 commit 1ddd74f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

cmk/gui/openapi/api_endpoints/icon/list_icons.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323
DomainObjectModel,
2424
)
2525
from cmk.gui.openapi.restful_objects.constructors import collection_href
26-
from cmk.gui.theme.current_theme import theme
26+
from cmk.gui.theme import make_theme
27+
from cmk.gui.userdb import load_custom_attr
2728
from cmk.gui.watolib.icons import all_available_icon_data
2829

2930

@@ -52,6 +53,10 @@ class IconCollectionModel(DomainObjectCollectionModel):
5253

5354
def list_icons_v1(api_context: ApiContext) -> IconCollectionModel:
5455
"""Show all icons."""
56+
theme = make_theme(validate_choices=False)
57+
theme.from_config(api_context.config.ui_theme)
58+
if user_id := api_context.user_id:
59+
theme.set(load_custom_attr(user_id=user_id, key="ui_theme", parser=str))
5560
return IconCollectionModel(
5661
domainType="icon",
5762
id="all",

0 commit comments

Comments
 (0)