From 3cd0c54438d632c1862bb75701ecfcff4b6b0734 Mon Sep 17 00:00:00 2001 From: Suraj Shetty Date: Tue, 21 Aug 2018 16:29:06 +0530 Subject: [PATCH 01/10] Fix pyhton 3 compatibility --- erpnext/hub_node/api.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/erpnext/hub_node/api.py b/erpnext/hub_node/api.py index 6e11a86b86..85693c72af 100644 --- a/erpnext/hub_node/api.py +++ b/erpnext/hub_node/api.py @@ -3,12 +3,13 @@ import frappe, requests, json from frappe.utils import now from frappe.frappeclient import FrappeClient from frappe.desk.form.load import get_attachments +from six import string_types @frappe.whitelist() def call_hub_method(method, params=None): connection = get_hub_connection() - if type(params) == unicode: + if isinstance(params, string_types): params = json.loads(params) params.update({ From f9e4cca33478dcd93d0f8cd3ee50295c83c4cbc0 Mon Sep 17 00:00:00 2001 From: Suraj Shetty Date: Tue, 21 Aug 2018 16:30:33 +0530 Subject: [PATCH 02/10] Throw error if hub_url is not present in site_config --- erpnext/hub_node/doctype/hub_settings/hub_settings.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/erpnext/hub_node/doctype/hub_settings/hub_settings.py b/erpnext/hub_node/doctype/hub_settings/hub_settings.py index 96e3148c13..e445531d1e 100644 --- a/erpnext/hub_node/doctype/hub_settings/hub_settings.py +++ b/erpnext/hub_node/doctype/hub_settings/hub_settings.py @@ -21,6 +21,8 @@ class HubSettings(Document): frappe.throw(_("Please select a Price List to publish pricing")) def get_hub_url(self): + if not frappe.conf.hub_url: + frappe.throw('hub_url is not set in site_config') return frappe.conf.hub_url def register(self): From 7a040c4dd8d04646a49d5d4df2b4ee4ec0a4f6c4 Mon Sep 17 00:00:00 2001 From: Suraj Shetty Date: Tue, 21 Aug 2018 16:32:31 +0530 Subject: [PATCH 03/10] Show favorite button only for registered user --- .../public/js/hub/components/detail_view.js | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/erpnext/public/js/hub/components/detail_view.js b/erpnext/public/js/hub/components/detail_view.js index cd734058aa..f161e459e0 100644 --- a/erpnext/public/js/hub/components/detail_view.js +++ b/erpnext/public/js/hub/components/detail_view.js @@ -25,13 +25,16 @@ function get_detail_view_html(item, allow_edit) { stats = `${views_message}${dot_spacer}${rating_html} (${rating_count})`; } - let favourite_button = !item.favourited - ? `` - : ``; + let favourite_button = '' + if (hub.settings.registered) { + favourite_button = !item.favourited + ? `` + : ``; + } const contact_seller_button = item.hub_seller !== hub.settings.company_email ? `