feat: show media attachment notice for unsupported post types (photos/videos)
Some checks failed
lint / lint (push) Has been cancelled
test / unit (push) Has been cancelled
test / integration (push) Has been cancelled
lint / lint (pull_request) Failing after 9m20s
test / unit (pull_request) Successful in 16m15s
test / integration (pull_request) Failing after 17m1s
Some checks failed
lint / lint (push) Has been cancelled
test / unit (push) Has been cancelled
test / integration (push) Has been cancelled
lint / lint (pull_request) Failing after 9m20s
test / unit (pull_request) Successful in 16m15s
test / integration (pull_request) Failing after 17m1s
This commit is contained in:
@@ -1587,9 +1587,27 @@ impl domain::ports::FederationActionPort for ActivityPubService {
|
|||||||
.ok()?
|
.ok()?
|
||||||
.with_timezone(&chrono::Utc);
|
.with_timezone(&chrono::Utc);
|
||||||
|
|
||||||
|
let text = note["content"].as_str().unwrap_or("").to_string();
|
||||||
|
let has_attachments = note["attachment"]
|
||||||
|
.as_array()
|
||||||
|
.map(|a| !a.is_empty())
|
||||||
|
.unwrap_or(false);
|
||||||
|
|
||||||
|
let content = if has_attachments {
|
||||||
|
let notice =
|
||||||
|
"<p class=\"media-notice\">📎 Media attachment — not supported</p>";
|
||||||
|
if text.is_empty() {
|
||||||
|
notice.to_string()
|
||||||
|
} else {
|
||||||
|
format!("{text}{notice}")
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
text
|
||||||
|
};
|
||||||
|
|
||||||
Some(domain::models::remote_note::RemoteNote {
|
Some(domain::models::remote_note::RemoteNote {
|
||||||
ap_id: note["id"].as_str()?.to_string(),
|
ap_id: note["id"].as_str()?.to_string(),
|
||||||
content: note["content"].as_str().unwrap_or("").to_string(),
|
content,
|
||||||
published,
|
published,
|
||||||
sensitive: note["sensitive"].as_bool().unwrap_or(false),
|
sensitive: note["sensitive"].as_bool().unwrap_or(false),
|
||||||
content_warning: note["summary"].as_str().map(|s| s.to_string()),
|
content_warning: note["summary"].as_str().map(|s| s.to_string()),
|
||||||
|
|||||||
@@ -158,8 +158,12 @@ export function ThoughtCard({
|
|||||||
</p>
|
</p>
|
||||||
) : (
|
) : (
|
||||||
<div
|
<div
|
||||||
className="text-sm break-words [&_a]:underline [&_a]:text-primary [&_p]:mb-2"
|
className="text-sm break-words [&_a]:underline [&_a]:text-primary [&_p]:mb-2 [&_.media-notice]:text-muted-foreground [&_.media-notice]:italic"
|
||||||
dangerouslySetInnerHTML={{ __html: thought.content }}
|
dangerouslySetInnerHTML={{
|
||||||
|
__html:
|
||||||
|
thought.content.trim() ||
|
||||||
|
'<p class="media-notice">📎 Media attachment — not supported</p>',
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</CardContent>
|
</CardContent>
|
||||||
|
|||||||
Reference in New Issue
Block a user