From f45ea8122405afb6ada2508851de57906b0c3913 Mon Sep 17 00:00:00 2001
From: 18alantom <2.alan.tom@gmail.com>
Date: Thu, 25 Nov 2021 16:48:26 +0530
Subject: [PATCH] refactor: shift autoupdate to systemsettings

---
 .../AccountingSettings/AccountingSettings.js    |  6 ------
 src/components/Sidebar.vue                      |  7 ++++++-
 src/main.js                                     |  2 +-
 src/pages/Settings/TabSystem.vue                | 17 -----------------
 4 files changed, 7 insertions(+), 25 deletions(-)

diff --git a/models/doctype/AccountingSettings/AccountingSettings.js b/models/doctype/AccountingSettings/AccountingSettings.js
index 11e61557..e0c9b7f7 100644
--- a/models/doctype/AccountingSettings/AccountingSettings.js
+++ b/models/doctype/AccountingSettings/AccountingSettings.js
@@ -107,12 +107,6 @@ export default {
       default: 0
     },
 
-    {
-      fieldname: 'autoUpdate',
-      label: 'Auto Update',
-      fieldtype: 'Check',
-      default: 1
-    }
   ],
   quickEditFields: [
     'fullname',
diff --git a/src/components/Sidebar.vue b/src/components/Sidebar.vue
index 3f91c5ad..d7b70a65 100644
--- a/src/components/Sidebar.vue
+++ b/src/components/Sidebar.vue
@@ -111,7 +111,12 @@ export default {
   },
   async mounted() {
     this.companyName = await sidebarConfig.getTitle();
-    this.groups = sidebarConfig.groups;
+    this.groups = sidebarConfig.groups.filter(group=>{
+      if(group.route === '/get-started' && frappe.SystemSettings.hideGetStarted) {
+        return false
+      }
+      return true;
+    });
 
     let currentPath = this.$router.currentRoute.fullPath;
     this.activeGroup = this.groups.find((g) => {
diff --git a/src/main.js b/src/main.js
index e7191dce..1c1452d5 100644
--- a/src/main.js
+++ b/src/main.js
@@ -30,7 +30,7 @@ import { IPC_MESSAGES } from './messages';
   });
 
   frappe.events.on('check-for-updates', () => {
-    let { autoUpdate } = frappe.AccountingSettings;
+    let { autoUpdate } = frappe.SystemSettings;
     if (autoUpdate == null || autoUpdate === 1) {
       ipcRenderer.send(IPC_MESSAGES.CHECK_FOR_UPDATES);
     }
diff --git a/src/pages/Settings/TabSystem.vue b/src/pages/Settings/TabSystem.vue
index fa6239c6..3be05cca 100644
--- a/src/pages/Settings/TabSystem.vue
+++ b/src/pages/Settings/TabSystem.vue
@@ -1,31 +1,17 @@
 <template>
   <div>
     <TwoColumnForm v-if="doc" :doc="doc" :fields="fields" :autosave="true" />
-    <div class="mt-6">
-      <FormControl
-        :show-label="true"
-        :df="AccountingSettings.meta.getField('autoUpdate')"
-        @change="(value) => AccountingSettings.update('autoUpdate', value)"
-        :value="AccountingSettings.autoUpdate"
-      />
-      <p class="pl-6 mt-1 text-sm text-gray-600">
-        <!-- prettier-ignore -->
-        {{ _('Automatically check for updates and download them if available. The update will be applied after you restart the app.') }}
-      </p>
-    </div>
   </div>
 </template>
 
 <script>
 import frappe from 'frappejs';
 import TwoColumnForm from '@/components/TwoColumnForm';
-import FormControl from '@/components/Controls/FormControl';
 
 export default {
   name: 'TabSystem',
   components: {
     TwoColumnForm,
-    FormControl,
   },
   data() {
     return {
@@ -41,9 +27,6 @@ export default {
       let meta = frappe.getMeta('SystemSettings');
       return meta.getQuickEditFields();
     },
-    AccountingSettings() {
-      return frappe.AccountingSettings;
-    },
   },
 };
 </script>