fix: only load whatsapp api's if whatsapp is installed

This commit is contained in:
Shariq Ansari 2024-04-25 13:32:53 +05:30
parent 60386e97e6
commit b889734cd1
3 changed files with 6 additions and 1 deletions

View File

@ -50,10 +50,14 @@ def parse_mobile_no(mobile_no: str):
@frappe.whitelist()
def is_whatsapp_enabled():
if not frappe.db.exists('DocType', 'WhatsApp Settings'):
return False
return frappe.get_cached_value('WhatsApp Settings', 'WhatsApp Settings', 'enabled')
@frappe.whitelist()
def get_whatsapp_messages(reference_doctype, reference_name):
if not frappe.db.exists('DocType', 'WhatsApp Message'):
return []
messages = frappe.get_all(
"WhatsApp Message",
filters={

View File

@ -768,6 +768,7 @@
:doc="doc.data?.name"
/>
<WhatsappTemplateSelectorModal
v-if="whatsappEnabled"
v-model="showWhatsappTemplates"
@send="(t) => sendTemplate(t)"
/>