fix(messages): hide fallback attachment text when media is already displayed visually
This commit is contained in:
@@ -158,6 +158,12 @@ function MessageRow({
|
|||||||
);
|
);
|
||||||
const hasImages = imageAttachments.length > 0;
|
const hasImages = imageAttachments.length > 0;
|
||||||
|
|
||||||
|
/** Hide the fallback text ("[Attachment: ...]", "[Sticker: ...]", "[Embed]") when the actual media IS already shown visually. */
|
||||||
|
const isFallbackText =
|
||||||
|
/^\[(Attachment|Sticker):/i.test(displayContent) ||
|
||||||
|
/^\[Embed\]/i.test(displayContent);
|
||||||
|
const shouldShowContent = displayContent && !isFallbackText;
|
||||||
|
|
||||||
const handleReanalyze = async () => {
|
const handleReanalyze = async () => {
|
||||||
setIsReanalyzing(true);
|
setIsReanalyzing(true);
|
||||||
try {
|
try {
|
||||||
@@ -215,8 +221,8 @@ function MessageRow({
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Content */}
|
{/* Content — hidden when it's just an "[Attachment: ...]" fallback and the image is shown below */}
|
||||||
{displayContent ? (
|
{shouldShowContent ? (
|
||||||
<p
|
<p
|
||||||
className={`whitespace-pre-wrap break-words text-sm leading-6 ${
|
className={`whitespace-pre-wrap break-words text-sm leading-6 ${
|
||||||
message.deleted_at ? "text-muted-foreground/60" : "text-foreground/90"
|
message.deleted_at ? "text-muted-foreground/60" : "text-foreground/90"
|
||||||
|
|||||||
Reference in New Issue
Block a user