From 9aea5ddc9710a150eefb943f159c5e78cab3b8e2 Mon Sep 17 00:00:00 2001 From: izzy lyseggen Date: Wed, 7 Sep 2022 10:08:29 +0100 Subject: [PATCH] fix(metrics): remove suuid as it is no longer used (#60) --- speckle_connector/accounts.rb | 8 -------- speckle_connector/dialog.rb | 2 +- ui/src/App.vue | 14 ++++++-------- ui/src/graphql/user.gql | 1 - ui/src/graphql/userById.gql | 1 - 5 files changed, 7 insertions(+), 19 deletions(-) diff --git a/speckle_connector/accounts.rb b/speckle_connector/accounts.rb index 5a78615c..e9348449 100644 --- a/speckle_connector/accounts.rb +++ b/speckle_connector/accounts.rb @@ -28,14 +28,6 @@ def self.default_account accts.select { |acc| acc["isDefault"] }[0] || accts[0] end - def self.get_suuid - dir = _get_speckle_dir - suuid_path = File.join(dir, "suuid") - return unless File.exist?(suuid_path) - - File.read(suuid_path) - end - def self._get_speckle_dir speckle_dir = case Sketchup.platform diff --git a/speckle_connector/dialog.rb b/speckle_connector/dialog.rb index 0a0d9e96..a677c3c5 100644 --- a/speckle_connector/dialog.rb +++ b/speckle_connector/dialog.rb @@ -147,7 +147,7 @@ def self.load_saved_streams def self.init_local_accounts puts("Initialisation of Speckle accounts requested by plugin") - @dialog.execute_script("loadAccounts(#{Accounts.load_accounts.to_json}, #{Accounts.get_suuid.to_json})") + @dialog.execute_script("loadAccounts(#{Accounts.load_accounts.to_json})") end def self.reload_accounts diff --git a/ui/src/App.vue b/ui/src/App.vue index 2b12f681..27e73e67 100644 --- a/ui/src/App.vue +++ b/ui/src/App.vue @@ -96,16 +96,14 @@ import { bus } from './main' import userQuery from './graphql/user.gql' import { onLogin } from './vue-apollo' -global.loadAccounts = function (accounts, suuid) { - console.log('>>> SpeckleSketchup: Loading accounts', accounts, `suuid: ${suuid}`) +global.loadAccounts = function (accounts) { + console.log('>>> SpeckleSketchup: Loading accounts', accounts) localStorage.setItem('localAccounts', JSON.stringify(accounts)) - if (suuid) { - localStorage.setItem('suuid', suuid) - global.setSelectedAccount(accounts.find((acct) => acct['isDefault'])) + let uuid = localStorage.getItem('uuid') + if (uuid) { + global.setSelectedAccount(accounts.find((acct) => acct['userInfo']['id'] == uuid)) } else { - global.setSelectedAccount( - accounts.find((acct) => acct['userInfo']['id'] == localStorage.getItem('uuid')) - ) + global.setSelectedAccount(accounts.find((acct) => acct['isDefault'])) } } diff --git a/ui/src/graphql/user.gql b/ui/src/graphql/user.gql index 63749364..91b07d73 100644 --- a/ui/src/graphql/user.gql +++ b/ui/src/graphql/user.gql @@ -9,7 +9,6 @@ query { verified profiles role - suuid streams { totalCount } diff --git a/ui/src/graphql/userById.gql b/ui/src/graphql/userById.gql index a1efe7a9..44e717ff 100644 --- a/ui/src/graphql/userById.gql +++ b/ui/src/graphql/userById.gql @@ -9,6 +9,5 @@ query User($id: String!) { verified profiles role - suuid } }