Skip to content

Commit

Permalink
Show attachment names or types (#231)
Browse files Browse the repository at this point in the history
  • Loading branch information
maximbaz authored Jul 11, 2023
1 parent 1df2baa commit fc5c215
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/signal/impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,18 @@ impl SignalManager for PresageManager {
..Default::default()
};

if has_attachments && message.is_empty() {
// TODO: Temporary solution until we start rendering attachments
message = format!(
"<attached: {}>",
attachments
.iter()
.map(|(a, _)| a.file_name.clone().unwrap_or(a.content_type.clone()))
.collect::<Vec<_>>()
.join(", ")
);
}

let (response_tx, response) = oneshot::channel();
match channel.id {
ChannelId::User(uuid) => {
Expand Down Expand Up @@ -216,11 +228,6 @@ impl SignalManager for PresageManager {
}
}

if has_attachments && message.is_empty() {
// TODO: Temporary solution until we start rendering attachments
message = "<attachment>".to_string();
}

let message = Message {
from_id: self.user_id(),
message: Some(message),
Expand Down

0 comments on commit fc5c215

Please sign in to comment.