From d095e3046768ba908775b4d09c9b957fd89ccd42 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 1 Mar 2026 07:51:07 +0000 Subject: [PATCH] fix: address code review feedback on tests and placeholder messages Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com> --- frontend/templates/file_detail.html | 8 ++++---- frontend/templates/file_view.html | 14 +++++++++++++- tests/test_document_preview.py | 6 +++--- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/frontend/templates/file_detail.html b/frontend/templates/file_detail.html index 4681086f..48029c20 100644 --- a/frontend/templates/file_detail.html +++ b/frontend/templates/file_detail.html @@ -1546,8 +1546,8 @@
- -

See PDF viewer above

+ +

This PDF is displayed in the Document Previews section at the top of the page.

{% endif %} @@ -1570,8 +1570,8 @@
- -

See PDF viewer above

+ +

This PDF is displayed in the Document Previews section at the top of the page.

diff --git a/frontend/templates/file_view.html b/frontend/templates/file_view.html index ac0548e1..873ab6e7 100644 --- a/frontend/templates/file_view.html +++ b/frontend/templates/file_view.html @@ -655,7 +655,19 @@ navigator.clipboard.writeText(text.join('\n')).then(function() { btn.innerHTML = ' Copied!'; setTimeout(function() { btn.innerHTML = orig; }, 2000); - }).catch(function() {}); + }).catch(function() { + try { + var ta = document.createElement('textarea'); + ta.value = text.join('\n'); + ta.style.cssText = 'position:fixed;opacity:0;'; + document.body.appendChild(ta); + ta.select(); + document.execCommand('copy'); + document.body.removeChild(ta); + btn.innerHTML = ' Copied!'; + setTimeout(function() { btn.innerHTML = orig; }, 2000); + } catch(e) {} + }); } // ── Initialise on load ── diff --git a/tests/test_document_preview.py b/tests/test_document_preview.py index c996c0d5..45e46c3c 100644 --- a/tests/test_document_preview.py +++ b/tests/test_document_preview.py @@ -71,8 +71,8 @@ class TestFileViewPdfJs: assert 'id="pdf-page-info"' in html assert "pdfInit(" in html - # Should NOT have an iframe for this type - assert "")[-1] or True + # Should NOT have an iframe in the preview section + assert 'id="pdf-viewer"' in html def test_pdf_file_no_iframe(self, client: TestClient, db_session, tmp_path): """PDF should not use native iframe-based preview.""" @@ -302,7 +302,7 @@ class TestFilesPreviewModal: _create_file_record(db_session, file_path=str(pdf)) html = client.get("/files").text - assert "Full view" in html or "Full view" in html + assert "Full view" in html assert "Download" in html