fix: ensure needed community tokens are available in the db

Fixes #13171
This commit is contained in:
Dario Gabriel Lipicar 2024-01-10 02:04:49 -03:00 committed by dlipicar
parent 5cb1972261
commit 781a2c7c8e
2 changed files with 12 additions and 0 deletions

View File

@ -3667,6 +3667,10 @@ func (m *Messenger) RemoveCommunityToken(chainID int, contractAddress string) er
return m.communitiesManager.RemoveCommunityToken(chainID, contractAddress) return m.communitiesManager.RemoveCommunityToken(chainID, contractAddress)
} }
func (m *Messenger) FetchMissingCommunityTokens(community *communities.Community) error {
return m.communitiesManager.HandleCommunityTokensMetadata(community)
}
func (m *Messenger) CheckPermissionsToJoinCommunity(request *requests.CheckPermissionToJoinCommunity) (*communities.CheckPermissionToJoinResponse, error) { func (m *Messenger) CheckPermissionsToJoinCommunity(request *requests.CheckPermissionToJoinCommunity) (*communities.CheckPermissionToJoinResponse, error) {
if err := request.Validate(); err != nil { if err := request.Validate(); err != nil {
return nil, err return nil, err

View File

@ -674,6 +674,14 @@ func (s *Service) fetchCommunity(communityID string, fetchLatest bool) (*communi
return nil, err return nil, err
} }
if community != nil {
// Call this to ensure CommunityTokens are stored to DB
err = s.messenger.FetchMissingCommunityTokens(community)
if err != nil {
return nil, err
}
}
return community, nil return community, nil
} }