From 9321a2e86a193243724a9f28e740985e1741a12d Mon Sep 17 00:00:00 2001 From: Ankush Menat Date: Mon, 27 Feb 2023 14:03:34 +0530 Subject: [PATCH] fix(UX): Better message for read only mode - The default message keeps confusing user because it doesn't contain the word "site update" which is usually the reason for putting site in read only mode. - Also fixes annoying popup while opening notifications in read only mode. [skip ci] --- frappe/database/database.py | 2 +- .../doctype/notification_settings/notification_settings.py | 3 +++ frappe/public/js/frappe/ui/toolbar/navbar.html | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/frappe/database/database.py b/frappe/database/database.py index a9d1ddc3bb..5958bdb927 100644 --- a/frappe/database/database.py +++ b/frappe/database/database.py @@ -233,7 +233,7 @@ class Database: elif self.is_read_only_mode_error(e): frappe.throw( _( - "Site is running in read only mode, this action can not be performed right now. Please try again later." + "Site is running in read only mode for maintenance or site update, this action can not be performed right now. Please try again later." ), title=_("In Read Only Mode"), exc=frappe.InReadOnlyMode, diff --git a/frappe/desk/doctype/notification_settings/notification_settings.py b/frappe/desk/doctype/notification_settings/notification_settings.py index 801d512fe7..cd85c7d06d 100644 --- a/frappe/desk/doctype/notification_settings/notification_settings.py +++ b/frappe/desk/doctype/notification_settings/notification_settings.py @@ -92,4 +92,7 @@ def get_permission_query_conditions(user): @frappe.whitelist() def set_seen_value(value, user): + if frappe.flags.read_only: + return + frappe.db.set_value("Notification Settings", user, "seen", value, update_modified=False) diff --git a/frappe/public/js/frappe/ui/toolbar/navbar.html b/frappe/public/js/frappe/ui/toolbar/navbar.html index ee070d4378..451a4e7099 100644 --- a/frappe/public/js/frappe/ui/toolbar/navbar.html +++ b/frappe/public/js/frappe/ui/toolbar/navbar.html @@ -7,7 +7,7 @@