diff --git a/dnas/relay/zomes/coordinator/relay/src/contact.rs b/dnas/relay/zomes/coordinator/relay/src/contact.rs index a76d1551..2b789f0f 100644 --- a/dnas/relay/zomes/coordinator/relay/src/contact.rs +++ b/dnas/relay/zomes/coordinator/relay/src/contact.rs @@ -55,8 +55,6 @@ pub fn get_latest_contact( } None => original_contact_hash.clone(), }; - //get(latest_contact_hash, GetOptions::default()) - // TODO: is this best practice or should we just return the Record? match get(latest_contact_hash, GetOptions::default())? { Some(record) => { Ok(Some(ContactRecord { diff --git a/dnas/relay/zomes/coordinator/relay/src/message.rs b/dnas/relay/zomes/coordinator/relay/src/message.rs index 199d6455..275ccc62 100644 --- a/dnas/relay/zomes/coordinator/relay/src/message.rs +++ b/dnas/relay/zomes/coordinator/relay/src/message.rs @@ -2,8 +2,6 @@ use hdk::prelude::*; use relay_integrity::*; use crate::get_entry_for_action; -// use chrono::{DateTime, Utc, Datelike}; -// use crate::utils::*; #[derive(Serialize, Deserialize, Debug)] #[serde(rename_all = "camelCase")] @@ -22,18 +20,7 @@ pub fn create_message(input: SendMessageInput) -> ExternResult { .to_string()) ), )?; - // let now: DateTime = Utc::now(); - // let year = now.year(); - // let month = now.month(); - // let week = now.iso_week().week(); - // let formatted_date = format!("{}/{}/{}", year, month, week); - // let path = Path::from(formatted_date); - // create_link_relaxed( - // path.path_entry_hash()?, - // AnyLinkableHash::try_from(record.action_address().clone())?, - // LinkTypes::MessageBlock, - // (), - // )?; + let path = messages_path(input.message.bucket); debug!("create_message path {:?}", path); let link = create_link( @@ -43,7 +30,6 @@ pub fn create_message(input: SendMessageInput) -> ExternResult { (), )?; - // TODO: handle errors. look for ack, try again on fail let _ = send_remote_signal( MessageRecord { message: Some(input.message), @@ -57,44 +43,6 @@ pub fn create_message(input: SendMessageInput) -> ExternResult { Ok(record) } -// pub struct MessageBlock { -// week: String, -// count: u32, -// hashes: SignedActionHashed, -// } - -// pub struct GetMessageHashesForWeekInput { -// pub week: String, -// pub message_count_already_loaded: u8, -// } -// #[hdk_extern] -// pub fn get_messages_hashes_for_week( -// input: GetMessageHashesForWeekInput, -// ) -> ExternResult { -// let weekString = input.week; -// if (weekString.is_empty()) { -// let now: DateTime = Utc::now(); -// let year = now.year(); -// let month = now.month(); -// let week = now.iso_week().week(); -// weekString = format!("{}/{}/{}", year, month, week); -// } -// let path = Path::from(weekString); -// //let links = get_links(path.path_entry_hash()?, LinkTypes::MessageBlock, None)?; -// let links = get_links( -// GetLinksInputBuilder::try_new(path.path_entry_hash()?, LinkTypes::MessageBlock)? -// .build(), -// ); -// let mut results = Vec::new(); -// for l in links { -// let hash = ActionHash::try_from(l.target).map_err(|e| wasm_error!(e))?; -// if let Some(r) = get_latest_message(hash)? { -// results.push(r); -// } -// } -// Ok(results) -// } - #[derive(Serialize, Deserialize, Debug)] pub struct BucketInput { pub bucket: u32, @@ -149,7 +97,6 @@ pub fn get_message_entries(hashes: Vec) -> ExternResult) -> ExternResult> { let links = get_message_links_for_buckets(buckets)?; @@ -157,27 +104,7 @@ pub fn get_messages_for_buckets(buckets: Vec) -> ExternResult = response.decode().map_err(|_e| wasm_error!(WasmErrorInner::Guest(String::from("could not decode agent profile"))))?; - // // let me = agent_info()?.agent_latest_pubkey; - // //let agents = agents.into_iter().filter(|a| a != &me).collect(); - // debug!("agent {:?}", agent); - // r.message.unwrap().author_name = agent; - // } - - results.push (r); + results.push(r); } } diff --git a/ui/src/lib/LightboxImage.svelte b/ui/src/lib/LightboxImage.svelte index 5551a480..5703ae3f 100644 --- a/ui/src/lib/LightboxImage.svelte +++ b/ui/src/lib/LightboxImage.svelte @@ -16,8 +16,7 @@ items: [ { // Because we don't know the original image dimensions, - // we scale by 10x and let bigger-picture handle constaining within window - // TODO: use the original image dimensions either by publishing to DHT or determining after downloading image + // we scale by 10x and let bigger-picture handle constraining within window width: targetImg.width * 10, height: targetImg.height * 10, img: src, diff --git a/ui/src/routes/conversations/[id]/+page.svelte b/ui/src/routes/conversations/[id]/+page.svelte index 12ede774..0fc8d5f1 100644 --- a/ui/src/routes/conversations/[id]/+page.svelte +++ b/ui/src/routes/conversations/[id]/+page.svelte @@ -80,6 +80,12 @@ }) } + const checkForData = () => { + checkForAgents() + checkForConfig() + checkForMessages() + } + function handleResize() { if (scrollAtBottom) { scrollToBottom(); @@ -96,10 +102,7 @@ // messages = c.messages; numMembers = Object.values(agentProfiles).length; }); - // TODO: do this check in one call of checkForStuff - checkForAgents() - checkForConfig() - checkForMessages() + checkForData(); conversationContainer.addEventListener('scroll', handleScroll); window.addEventListener('resize', debouncedHandleResize); newMessageInput.focus(); @@ -130,7 +133,6 @@ messages.forEach(message => { // Don't display message if we don't have a profile from the author yet. - // TODO: could wait until all profiles have been synced first? if (!agentProfiles[message.authorKey]) { return; } diff --git a/ui/src/routes/conversations/[id]/invite/+page.svelte b/ui/src/routes/conversations/[id]/invite/+page.svelte index aad658fb..67fd78b4 100644 --- a/ui/src/routes/conversations/[id]/invite/+page.svelte +++ b/ui/src/routes/conversations/[id]/invite/+page.svelte @@ -47,8 +47,6 @@ } async function addContactsToConversation() { - // TODO: update config.title? - if (conversation) { conversation.addContacts($selectedContacts) goto(`/conversations/${conversation.id}/details`) diff --git a/ui/src/store/ConversationStore.ts b/ui/src/store/ConversationStore.ts index 44a8638c..90b59bd0 100644 --- a/ui/src/store/ConversationStore.ts +++ b/ui/src/store/ConversationStore.ts @@ -137,7 +137,7 @@ export class ConversationStore { } const invitation: Invitation = { - created: this.created, // TODO: put in data + created: this.created, progenitor: this.data.progenitor, privacy: this.data.privacy, proof, @@ -357,7 +357,6 @@ export class ConversationStore { const id = uuidv4() const oldMessage: Message = { authorKey, content, hash: id, status: 'pending', timestamp: now, bucket, images} this.addMessage(oldMessage) - // TODO: upload these images asynchonously and then add to the message when done const imageStructs = await Promise.all(images.filter(i => !!i.file).map(async (image) => { const hash = await this.fileStorageClient.uploadFile(image.file!) return { diff --git a/ui/src/store/RelayStore.ts b/ui/src/store/RelayStore.ts index 6bbf95ff..cf2b35a7 100644 --- a/ui/src/store/RelayStore.ts +++ b/ui/src/store/RelayStore.ts @@ -187,7 +187,6 @@ export class RelayStore { async createContact(contact: Contact) { if (!this.client) return false - // TODO: if adding contact fails we should remove it from the store const contactResult = await this.client.createContact(contact) if (contactResult) { // Immediately add a conversation with the new contact, unless you already have one with them