Skip to content

Commit

Permalink
reverseDomains => reverseRecords
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhongFuze committed Nov 22, 2023
1 parent a40c8fe commit 451c483
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/controller/tigergraphql/identity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ impl IdentityRecord {
}

/// Return primary domain names where they would typically only show addresses.
async fn reverse_domains(&self, _ctx: &Context<'_>) -> Result<Vec<ResolveReverse>> {
async fn reverse_records(&self, _ctx: &Context<'_>) -> Result<Vec<ResolveReverse>> {
let client = make_http_client();
self.resolve_reverse_domains(&client).await
}
Expand Down
7 changes: 6 additions & 1 deletion src/upstream/ens_reverse/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ impl Fetcher for ENSReverseLookup {
// If reverse lookup record is reset to empty by user,
// our cache should also be cleared.
// Reach this by setting `display_name` into `Some("")`.
let reverse_ens = record.reverse_record.unwrap_or("".into());
let reverse_ens = record.reverse_record.clone().unwrap_or("".into());

info!("ENS Reverse record: {} => {}", wallet, reverse_ens);

Expand All @@ -50,6 +50,11 @@ impl Fetcher for ENSReverseLookup {
let cli = make_http_client();
identity.create_or_update(&cli).await?;

// If reverse lookup record reverse_record is None
// Do not save the reverse_resolve_record
if record.reverse_record.is_none() {
return Ok(vec![]);
}
let contract = Contract {
uuid: Uuid::new_v4(),
category: ContractCategory::ENS,
Expand Down
4 changes: 2 additions & 2 deletions src/upstream/lens/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ async fn save_profile(client: &Client<HttpConnector>, profile: &Profile) -> Resu
updated_at: naive_now(),
};
create_identity_to_identity_hold_record(client, &from, &to, &hold).await?;
create_identity_domain_resolve_record(client, &from, &to, &resolve).await?;
create_identity_domain_resolve_record(client, &to, &from, &resolve).await?;

if profile.is_default {
let resolve: Resolve = Resolve {
Expand All @@ -249,7 +249,7 @@ async fn save_profile(client: &Client<HttpConnector>, profile: &Profile) -> Resu
fetcher: DataFetcher::RelationService,
updated_at: naive_now(),
};
create_identity_domain_reverse_resolve_record(client, &to, &from, &resolve).await?;
create_identity_domain_reverse_resolve_record(client, &from, &to, &resolve).await?;
}
Ok(())
}

1 comment on commit 451c483

@ZhongFuze
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix issue #110

Please sign in to comment.