diff --git a/flake.lock b/flake.lock index 51aef4d..59bd2cb 100644 --- a/flake.lock +++ b/flake.lock @@ -418,11 +418,11 @@ }, "locked": { "dir": "versions/0_1", - "lastModified": 1682007936, - "narHash": "sha256-Qx5lzqOqAYRQBJa7DQlQ/kLpTztQ3YpBmu6OVzLw77U=", + "lastModified": 1682039948, + "narHash": "sha256-hUkYGCPrdWimL/+t2gk3zhcoGzOmVEQ6w6URuZW/Yxo=", "owner": "holochain", "repo": "holochain", - "rev": "fb0b56acdf755b1d4d731aad36e85bf785096a7b", + "rev": "aab01418ce14a962d20eb0af91839b5a1d1ae714", "type": "github" }, "original": { diff --git a/zomes/trust_atom/src/test_helpers.rs b/zomes/trust_atom/src/test_helpers.rs index 19e531f..825c4c6 100644 --- a/zomes/trust_atom/src/test_helpers.rs +++ b/zomes/trust_atom/src/test_helpers.rs @@ -8,7 +8,9 @@ pub struct StringLinkTag(pub String); holochain_serial!(StringLinkTag); pub fn list_links_for_base(base: AnyLinkableHash) -> ExternResult> { - let links = get_links(base, LinkTypes::TrustAtom, None)?; + let mut links = get_links(base.clone(), LinkTypes::Forward, None)?; + let mut reverse_links = get_links(base, LinkTypes::Reverse, None)?; + links.append(&mut reverse_links); Ok(links) } @@ -19,7 +21,9 @@ pub fn list_links(base: AnyLinkableHash, link_tag_text: Option) -> Exter None => None, }; - let links = hdk::link::get_links(base, LinkTypes::TrustAtom, link_tag)?; + let mut links = hdk::link::get_links(base.clone(), LinkTypes::Forward, link_tag.clone())?; + let mut reverse_links = hdk::link::get_links(base, LinkTypes::Reverse, link_tag)?; + links.append(&mut reverse_links); Ok(links) } diff --git a/zomes/trust_atom/src/trust_atom.rs b/zomes/trust_atom/src/trust_atom.rs index a82a82d..dd3dfe1 100644 --- a/zomes/trust_atom/src/trust_atom.rs +++ b/zomes/trust_atom/src/trust_atom.rs @@ -44,13 +44,13 @@ pub fn create( create_link( agent_address.clone(), target.clone(), - LinkTypes::TrustAtom, + LinkTypes::Forward, forward_link_tag, )?; create_link( target.clone(), agent_address.clone(), - LinkTypes::TrustAtom, + LinkTypes::Reverse, reverse_link_tag, )?; @@ -241,7 +241,13 @@ pub fn query( (None, None, Some(value_starts_with)) => Some(create_link_tag(&link_direction, &[Some(value_starts_with)])), (None, None, None) => None, }; - let links = get_links(link_base.clone(), LinkTypes::TrustAtom, link_tag)?; + + let link_type = match &link_direction { + LinkDirection::Forward => LinkTypes::Forward, + LinkDirection::Reverse => LinkTypes::Reverse, + }; + + let links = get_links(link_base.clone(), link_type, link_tag)?; let trust_atoms = convert_links_to_trust_atoms(links, &link_direction, link_base)?; diff --git a/zomes/trust_atom_integrity/src/entries.rs b/zomes/trust_atom_integrity/src/entries.rs index 9f1d637..6a9f144 100644 --- a/zomes/trust_atom_integrity/src/entries.rs +++ b/zomes/trust_atom_integrity/src/entries.rs @@ -30,5 +30,6 @@ pub enum EntryTypes { #[hdk_link_types] pub enum LinkTypes { - TrustAtom, + Forward, + Reverse, }