diff --git a/app/stores/AccountRefsStore.js b/app/stores/AccountRefsStore.js index 4cf34ce96b..3d6fcc0144 100644 --- a/app/stores/AccountRefsStore.js +++ b/app/stores/AccountRefsStore.js @@ -19,7 +19,8 @@ class AccountRefsStore extends BaseStore { } _getInitialState() { - this.chainstore_account_ids_by_key = null + this.chainstore_account_ids_by_key = null; + this.chainstore_account_ids_by_account = null; return { account_refs: Immutable.Set() // loading_account_refs: false @@ -34,6 +35,7 @@ class AccountRefsStore extends BaseStore { loadDbData() { // this.setState(this._getInitialState()) this.chainstore_account_ids_by_key = null; + this.chainstore_account_ids_by_account = null; this.state = {account_refs: Immutable.Set()}; return loadNoAccountRefs() .then( no_account_refs => this.no_account_refs = no_account_refs ) @@ -41,17 +43,21 @@ class AccountRefsStore extends BaseStore { } chainStoreUpdate() { - if(this.chainstore_account_ids_by_key === ChainStore.account_ids_by_key) return - this.chainstore_account_ids_by_key = ChainStore.account_ids_by_key - this.checkPrivateKeyStore() + if( + this.chainstore_account_ids_by_key === ChainStore.account_ids_by_key && + this.chainstore_account_ids_by_account === ChainStore.account_ids_by_account + ) return; + this.chainstore_account_ids_by_key = ChainStore.account_ids_by_key; + this.chainstore_account_ids_by_account = ChainStore.account_ids_by_account; + this.checkPrivateKeyStore(); } checkPrivateKeyStore() { - var no_account_refs = this.no_account_refs - var account_refs = Immutable.Set() + let no_account_refs = this.no_account_refs + let account_refs = Immutable.Set() PrivateKeyStore.getState().keys.keySeq().forEach( pubkey => { if(no_account_refs.has(pubkey)) return - var refs = ChainStore.getAccountRefsOfKey(pubkey) + let refs = ChainStore.getAccountRefsOfKey(pubkey) if(refs === undefined) return if( ! refs.size) { // Performance optimization... @@ -61,7 +67,7 @@ class AccountRefsStore extends BaseStore { { // Do Not block brainkey generated keys.. Those are new and // account references may be pending. - var private_key_object = PrivateKeyStore.getState().keys.get(pubkey) + let private_key_object = PrivateKeyStore.getState().keys.get(pubkey) if( typeof private_key_object.brainkey_sequence === 'number' ) { return } @@ -71,7 +77,16 @@ class AccountRefsStore extends BaseStore { } account_refs = account_refs.add(refs.valueSeq()) }) - account_refs = account_refs.flatten() + account_refs = account_refs.flatten(); + + /* Discover accounts referenced by account name in permissions */ + account_refs.forEach(account => { + let refs = ChainStore.getAccountRefsOfAccount(account); + if(refs === undefined) return; + if( ! refs.size) return; + account_refs = account_refs.add(refs.valueSeq()); + }); + account_refs = account_refs.flatten(); if( ! this.state.account_refs.equals(account_refs)) { // console.log("AccountRefsStore account_refs",account_refs.size); this.setState({account_refs}) diff --git a/package.json b/package.json index 8562d7b5de..d4d60c1712 100644 --- a/package.json +++ b/package.json @@ -125,7 +125,7 @@ "alt-container": "^1.0.0", "alt-react": "0.0.1", "bignumber.js": "^4.0.0", - "bitsharesjs": "^1.2.9", + "bitsharesjs": "^1.2.10", "classnames": "^2.2.1", "cookies-js": "^1.2.1", "counterpart": "^0.17.1",