From b296be041e3c02f0ba6570f6b8adec0ab7fcd724 Mon Sep 17 00:00:00 2001 From: Faris Ansari Date: Mon, 3 Sep 2018 16:53:56 +0530 Subject: [PATCH 1/3] fix: email in profile dialog --- .../js/hub/components/profile_dialog.js | 25 +++++-------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/erpnext/public/js/hub/components/profile_dialog.js b/erpnext/public/js/hub/components/profile_dialog.js index 636bf1436a..8e3abc37eb 100644 --- a/erpnext/public/js/hub/components/profile_dialog.js +++ b/erpnext/public/js/hub/components/profile_dialog.js @@ -1,28 +1,15 @@ const ProfileDialog = (title = __('Edit Profile'), action={}) => { const fields = [ - { - fieldname: 'company_email', - label: __('Email'), - fieldtype: 'Read Only' - }, { fieldtype: 'Link', fieldname: 'company', label: __('Company'), - options: 'Company', - onchange: () => { - const value = dialog.get_value('company'); - if (value) { - frappe.db.get_doc('Company', value) - .then(company => { - console.log(company.company_logo); - dialog.set_values({ - company_logo: company.company_logo, - company_description: company.company_description - }); - }); - } - } + options: 'Company' + }, + { + fieldtype: 'Read Only', + fieldname: 'email', + label: __('Email') }, { label: __('About your company'), From d4bba297c28fa1e80a199df965d0c18c348d297b Mon Sep 17 00:00:00 2001 From: Faris Ansari Date: Mon, 3 Sep 2018 17:12:22 +0530 Subject: [PATCH 2/3] fix: Container title --- erpnext/public/js/hub/pages/PublishedItems.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/public/js/hub/pages/PublishedItems.vue b/erpnext/public/js/hub/pages/PublishedItems.vue index 6559f7910a..cbb22164e6 100644 --- a/erpnext/public/js/hub/pages/PublishedItems.vue +++ b/erpnext/public/js/hub/pages/PublishedItems.vue @@ -22,7 +22,7 @@ Date: Mon, 3 Sep 2018 17:24:17 +0530 Subject: [PATCH 3/3] fix: Move image saving code to hub server --- erpnext/hub_node/api.py | 27 ++++++--------------------- 1 file changed, 6 insertions(+), 21 deletions(-) diff --git a/erpnext/hub_node/api.py b/erpnext/hub_node/api.py index df3e7efb8f..0492dde527 100644 --- a/erpnext/hub_node/api.py +++ b/erpnext/hub_node/api.py @@ -142,7 +142,7 @@ def publish_selected_items(items_to_publish): try: item_sync_preprocess(len(items)) - load_base64_image_from_items(items) + convert_relative_image_urls_to_absolute(items) # TODO: Publish Progress connection = get_hub_connection() @@ -183,29 +183,14 @@ def item_sync_postprocess(): frappe.db.set_value('Marketplace Settings', 'Marketplace Settings', 'sync_in_progress', 0) -def load_base64_image_from_items(items): +def convert_relative_image_urls_to_absolute(items): + from urlparse import urljoin + for item in items: file_path = item['image'] - file_name = os.path.basename(file_path) - base64content = None - if file_path.startswith('http'): - # fetch content and then base64 it - url = file_path - response = requests.get(url) - base64content = base64.b64encode(response.content) - else: - # read file then base64 it - file_path = os.path.abspath(get_file_path(file_path)) - with io.open(file_path, 'rb') as f: - base64content = base64.b64encode(f.read()) - - image_data = json.dumps({ - 'file_name': file_name, - 'base64': base64content - }) - - item['image'] = image_data + if file_path.startswith('/files/'): + item['image'] = urljoin(frappe.utils.get_url(), file_path) def get_hub_connection():