fix: don't show duplicate icons (#36545)

This commit is contained in:
Soham Kulkarni 2026-02-01 02:48:21 +05:30 committed by GitHub
commit e703fe9598
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -165,11 +165,22 @@ def get_desktop_icons(user=None, bootinfo=None):
"icon_image",
]
standard_icons = frappe.get_all("Desktop Icon", fields=fields, filters={"standard": 1})
user_icons = frappe.get_all(
"Desktop Icon", fields=fields, filters=[["standard", "=", 0], "or", ["owner", "=", user]]
)
user_icons = user_icons + standard_icons
from frappe.query_builder import DocType
DesktopIcon = DocType("Desktop Icon")
user_icons = (
frappe.qb.from_(DesktopIcon)
.select(*fields)
.where(
(DesktopIcon.standard == 1)
| (
(DesktopIcon.standard == 0)
& (DesktopIcon.owner.isin(["Administrator", frappe.session.user]))
)
)
.distinct()
).run(as_dict=True)
# sort by idx
user_icons.sort(key=lambda a: a.idx)