Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show attachment names or types #231

Merged
merged 1 commit into from
Jul 11, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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