fix(@desktop/permissions): Fix multiple tokens on tokens list
Fix #13993
This commit is contained in:
parent
ce4996075c
commit
958274259f
|
@ -591,10 +591,13 @@ proc buildTokensAndCollectiblesFromCommunities(self: Module, communities: seq[Co
|
|||
infiniteSupply,
|
||||
)
|
||||
|
||||
if tokenMetadata.tokenType == TokenType.ERC20:
|
||||
if tokenMetadata.tokenType == TokenType.ERC20 and
|
||||
not self.view.tokenListModel().hasItem(tokenMetadata.symbol, community.id):
|
||||
# Community ERC20 tokens
|
||||
tokenListItems.add(communityTokenItem)
|
||||
else:
|
||||
|
||||
if tokenMetadata.tokenType == TokenType.ERC721 and
|
||||
not self.view.collectiblesListModel().hasItem(tokenMetadata.symbol, community.id):
|
||||
# Community collectibles (ERC721 and others)
|
||||
collectiblesListItems.add(communityTokenItem)
|
||||
|
||||
|
@ -651,12 +654,12 @@ method onCommunityTokenMetadataAdded*(self: Module, communityId: string, tokenMe
|
|||
)
|
||||
|
||||
if tokenMetadata.tokenType == TokenType.ERC721 and
|
||||
not self.view.collectiblesListModel().hasItem(tokenMetadata.symbol):
|
||||
not self.view.collectiblesListModel().hasItem(tokenMetadata.symbol, communityId):
|
||||
self.view.collectiblesListModel.addItems(@[tokenListItem])
|
||||
return
|
||||
|
||||
if tokenMetadata.tokenType == TokenType.ERC20 and
|
||||
not self.view.tokenListModel().hasItem(tokenMetadata.symbol):
|
||||
not self.view.tokenListModel().hasItem(tokenMetadata.symbol, communityId):
|
||||
self.view.tokenListModel.addItems(@[tokenListItem])
|
||||
|
||||
method shareCommunityUrlWithChatKey*(self: Module, communityId: string): string =
|
||||
|
|
|
@ -56,9 +56,9 @@ QtObject:
|
|||
self.endResetModel()
|
||||
self.countChanged()
|
||||
|
||||
proc hasItem*(self: TokenListModel, symbol: string): bool =
|
||||
proc hasItem*(self: TokenListModel, symbol: string, communityId: string): bool =
|
||||
for item in self.items:
|
||||
if item.getSymbol() == symbol:
|
||||
if item.getSymbol() == symbol and item.getCommunityId() == communityId:
|
||||
return true
|
||||
return false
|
||||
|
||||
|
|
Loading…
Reference in New Issue