diff --git a/src/actors/slack_writer.rs b/src/actors/slack_writer.rs index d8405bf..9426889 100644 --- a/src/actors/slack_writer.rs +++ b/src/actors/slack_writer.rs @@ -1,3 +1,5 @@ +/// This module contains the SlackWriter actor, which is responsible for knowing +/// how to write to slack and can fetch info from Nostr to create its messages use super::messages::SupervisorMessage; use crate::actors::messages::SlackWriterMessage; use crate::domain_objects::{ReportRequest, ReportTarget}; @@ -48,6 +50,7 @@ where state: &mut Self::State, ) -> Result<(), ActorProcessingErr> { match message { + // TODO: We should break this dependency on ReportRequest Self::Msg::Write(report_request) => { if let ReportTarget::Event(_) = report_request.target() { info!("Ignoring event report request for slack writer"); diff --git a/src/adapters/http_server/slack_interactions_route.rs b/src/adapters/http_server/slack_interactions_route.rs index 6eb8009..d3f7d5e 100644 --- a/src/adapters/http_server/slack_interactions_route.rs +++ b/src/adapters/http_server/slack_interactions_route.rs @@ -263,7 +263,10 @@ async fn try_njump( Ok(maybe_reporter_nip05 .as_ref() .map(|nip05| format!("https://njump.me/{}", nip05)) - .unwrap_or(format!("`{}`", pubkey))) + .unwrap_or(format!( + "`{}`", + pubkey.to_bech32().unwrap_or(pubkey.to_string()) + ))) } fn parse_slack_action( diff --git a/src/adapters/slack_client_adapter.rs b/src/adapters/slack_client_adapter.rs index 7aad82d..9d792d8 100644 --- a/src/adapters/slack_client_adapter.rs +++ b/src/adapters/slack_client_adapter.rs @@ -5,6 +5,7 @@ use anyhow::Result; use hyper_rustls::HttpsConnector; use hyper_util::client::legacy::connect::HttpConnector; use nostr_sdk::prelude::PublicKey; +use nostr_sdk::ToBech32; use ractor::{call_t, ActorRef}; use slack_morphism::prelude::*; use std::env; @@ -41,6 +42,8 @@ impl SlackClientAdapter { Ok(()) } + // This fn is currently duplicated and lives too in the http client adapter. + // It should be moved to a shared place at some point async fn try_njump(&self, pubkey: PublicKey) -> Result { let maybe_reporter_nip05 = call_t!(self.nostr_actor, SupervisorMessage::GetNip05, 100, pubkey)?; @@ -48,7 +51,10 @@ impl SlackClientAdapter { Ok(maybe_reporter_nip05 .as_ref() .map(|nip05| format!("https://njump.me/{}", nip05)) - .unwrap_or(format!("`{}`", pubkey))) + .unwrap_or(format!( + "`{}`", + pubkey.to_bech32().unwrap_or(pubkey.to_string()) + ))) } }