From d21b167b721e669b03433cc87f4a9ea0ac9fd2f8 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Tue, 10 Mar 2026 13:13:17 +0000
Subject: [PATCH 1/6] Initial plan
From 3d5410e67eb519e291017661f483d1697de24617 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Tue, 10 Mar 2026 13:23:42 +0000
Subject: [PATCH 2/6] Add ORCID to author search links in TOC when authors_meta
has orcid
Co-authored-by: robertatakenaka <505143+robertatakenaka@users.noreply.github.com>
---
opac/tests/test_interface_TOC.py | 86 ++++++++++++++++++++++++++++
opac/webapp/templates/issue/toc.html | 27 ++++++---
2 files changed, 105 insertions(+), 8 deletions(-)
diff --git a/opac/tests/test_interface_TOC.py b/opac/tests/test_interface_TOC.py
index 246b6d46d..0837e02f8 100644
--- a/opac/tests/test_interface_TOC.py
+++ b/opac/tests/test_interface_TOC.py
@@ -350,3 +350,89 @@ def test_abstract_links_are_displayed(self):
for uri in uris:
with self.subTest(uri):
self.assertIn(uri, response.data.decode("utf-8"))
+
+ def test_author_search_link_includes_orcid_when_authors_meta_has_orcid(self):
+ """
+ Teste para verificar se o link de busca do autor inclui o orcid
+ quando o artigo tem authors_meta com orcid.
+ """
+ journal = utils.makeOneJournal()
+
+ with self.client as c:
+ utils.makeOneCollection()
+
+ issue = utils.makeOneIssue({"journal": journal})
+
+ _article_data = {
+ "title": "Article Y",
+ "issue": issue,
+ "journal": journal,
+ "authors": ["Author One", "Author Two"],
+ "authors_meta": [
+ {
+ "name": "Author One",
+ "affiliation": "University A",
+ "orcid": "0000-0002-3430-5422",
+ },
+ {
+ "name": "Author Two",
+ "affiliation": "University B",
+ },
+ ],
+ }
+ utils.makeOneArticle(_article_data)
+
+ response = c.get(
+ url_for(
+ "main.issue_toc",
+ url_seg=journal.url_segment,
+ url_seg_issue=issue.url_segment,
+ )
+ )
+
+ response_data = response.data.decode("utf-8")
+
+ # Author with ORCID should have orcid in the search query
+ self.assertIn(
+ "q=au:Author One orcid:0000-0002-3430-5422",
+ response_data,
+ )
+ # Author without ORCID should not have orcid in the search query
+ self.assertNotIn(
+ "orcid:",
+ response_data.split("Author Two")[1].split("")[0],
+ )
+ self.assertIn("q=au:Author Two", response_data)
+
+ def test_author_search_link_without_orcid_when_no_authors_meta(self):
+ """
+ Teste para verificar se o link de busca do autor funciona sem orcid
+ quando o artigo não tem authors_meta (fallback para authors).
+ """
+ journal = utils.makeOneJournal()
+
+ with self.client as c:
+ utils.makeOneCollection()
+
+ issue = utils.makeOneIssue({"journal": journal})
+
+ _article_data = {
+ "title": "Article Z",
+ "issue": issue,
+ "journal": journal,
+ "authors": ["Simple Author"],
+ }
+ utils.makeOneArticle(_article_data)
+
+ response = c.get(
+ url_for(
+ "main.issue_toc",
+ url_seg=journal.url_segment,
+ url_seg_issue=issue.url_segment,
+ )
+ )
+
+ response_data = response.data.decode("utf-8")
+
+ self.assertIn("q=au:Simple Author", response_data)
+ self.assertNotIn("orcid:", response_data)
diff --git a/opac/webapp/templates/issue/toc.html b/opac/webapp/templates/issue/toc.html
index dd5694d00..da57b538a 100644
--- a/opac/webapp/templates/issue/toc.html
+++ b/opac/webapp/templates/issue/toc.html
@@ -208,14 +208,25 @@
{% endif %}
- {%- for author in article.authors %}
- {% if session.lang %}
- {{- author|striptags -}}
- {% else %}
- {{- author|striptags -}}
- {% if not loop.last %};{% endif %}
- {% endif %}
- {% endfor -%}
+ {%- if article.authors_meta %}
+ {%- for author in article.authors_meta %}
+ {% if session.lang %}
+ {{- author.name|striptags -}}
+ {% else %}
+ {{- author.name|striptags -}}
+ {% if not loop.last %};{% endif %}
+ {% endif %}
+ {% endfor -%}
+ {%- else %}
+ {%- for author in article.authors %}
+ {% if session.lang %}
+ {{- author|striptags -}}
+ {% else %}
+ {{- author|striptags -}}
+ {% if not loop.last %};{% endif %}
+ {% endif %}
+ {% endfor -%}
+ {%- endif %}
From ef7fcac219b0a7c5399f31ec24d446788f8b4846 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Tue, 10 Mar 2026 14:18:30 +0000
Subject: [PATCH 3/6] Simplify author loop with `or` operator instead of
if/else block
Co-authored-by: robertatakenaka <505143+robertatakenaka@users.noreply.github.com>
---
opac/webapp/templates/issue/toc.html | 28 +++++++++-------------------
1 file changed, 9 insertions(+), 19 deletions(-)
diff --git a/opac/webapp/templates/issue/toc.html b/opac/webapp/templates/issue/toc.html
index da57b538a..26788d250 100644
--- a/opac/webapp/templates/issue/toc.html
+++ b/opac/webapp/templates/issue/toc.html
@@ -208,25 +208,15 @@
{% endif %}
- {%- if article.authors_meta %}
- {%- for author in article.authors_meta %}
- {% if session.lang %}
- {{- author.name|striptags -}}
- {% else %}
- {{- author.name|striptags -}}
- {% if not loop.last %};{% endif %}
- {% endif %}
- {% endfor -%}
- {%- else %}
- {%- for author in article.authors %}
- {% if session.lang %}
- {{- author|striptags -}}
- {% else %}
- {{- author|striptags -}}
- {% if not loop.last %};{% endif %}
- {% endif %}
- {% endfor -%}
- {%- endif %}
+ {%- for author in article.authors_meta or article.authors %}
+ {% set author_name = author.name|default(author) %}
+ {% if session.lang %}
+ {{- author_name|striptags -}}
+ {% else %}
+ {{- author_name|striptags -}}
+ {% if not loop.last %};{% endif %}
+ {% endif %}
+ {% endfor -%}
From e31063b6902f4703fd231b664007b7b4b37945b4 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Fri, 13 Mar 2026 11:59:58 +0000
Subject: [PATCH 4/6] Change search query format to: orcid:ORCID OR au:(Name)
Co-authored-by: robertatakenaka <505143+robertatakenaka@users.noreply.github.com>
---
opac/tests/test_interface_TOC.py | 11 ++++-------
opac/webapp/templates/issue/toc.html | 4 ++--
2 files changed, 6 insertions(+), 9 deletions(-)
diff --git a/opac/tests/test_interface_TOC.py b/opac/tests/test_interface_TOC.py
index 0837e02f8..b6de74cd5 100644
--- a/opac/tests/test_interface_TOC.py
+++ b/opac/tests/test_interface_TOC.py
@@ -392,17 +392,14 @@ def test_author_search_link_includes_orcid_when_authors_meta_has_orcid(self):
response_data = response.data.decode("utf-8")
- # Author with ORCID should have orcid in the search query
+ # Author with ORCID should have orcid OR au:(name) in the search query
self.assertIn(
- "q=au:Author One orcid:0000-0002-3430-5422",
+ "q=orcid:0000-0002-3430-5422 OR au:(Author One)",
response_data,
)
- # Author without ORCID should not have orcid in the search query
- self.assertNotIn(
- "orcid:",
- response_data.split("Author Two")[1].split("")[0],
- )
+ # Author without ORCID should only have au:name in the search query
self.assertIn("q=au:Author Two", response_data)
+ self.assertNotIn("orcid:Author Two", response_data)
def test_author_search_link_without_orcid_when_no_authors_meta(self):
"""
diff --git a/opac/webapp/templates/issue/toc.html b/opac/webapp/templates/issue/toc.html
index 26788d250..061a57205 100644
--- a/opac/webapp/templates/issue/toc.html
+++ b/opac/webapp/templates/issue/toc.html
@@ -211,9 +211,9 @@
{%- for author in article.authors_meta or article.authors %}
{% set author_name = author.name|default(author) %}
{% if session.lang %}
- {{- author_name|striptags -}}
+ {{- author_name|striptags -}}
{% else %}
- {{- author_name|striptags -}}
+ {{- author_name|striptags -}}
{% if not loop.last %};{% endif %}
{% endif %}
{% endfor -%}
From 45eba534d60bdbfd7893a2e7c246e8a0c9c80a7e Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Fri, 13 Mar 2026 12:01:36 +0000
Subject: [PATCH 5/6] Add assertion to verify no OR clause for authors without
ORCID
Co-authored-by: robertatakenaka <505143+robertatakenaka@users.noreply.github.com>
---
opac/tests/test_interface_TOC.py | 1 +
1 file changed, 1 insertion(+)
diff --git a/opac/tests/test_interface_TOC.py b/opac/tests/test_interface_TOC.py
index b6de74cd5..185dbcae4 100644
--- a/opac/tests/test_interface_TOC.py
+++ b/opac/tests/test_interface_TOC.py
@@ -400,6 +400,7 @@ def test_author_search_link_includes_orcid_when_authors_meta_has_orcid(self):
# Author without ORCID should only have au:name in the search query
self.assertIn("q=au:Author Two", response_data)
self.assertNotIn("orcid:Author Two", response_data)
+ self.assertNotIn("OR au:(Author Two)", response_data)
def test_author_search_link_without_orcid_when_no_authors_meta(self):
"""
From 0e3283c5cdf42a523be10333454f2ede1cbc8851 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Fri, 13 Mar 2026 12:49:41 +0000
Subject: [PATCH 6/6] Open author search links in new tab with target="_blank"
Co-authored-by: robertatakenaka <505143+robertatakenaka@users.noreply.github.com>
---
opac/tests/test_interface_TOC.py | 4 ++++
opac/webapp/templates/issue/toc.html | 4 ++--
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/opac/tests/test_interface_TOC.py b/opac/tests/test_interface_TOC.py
index 185dbcae4..79b430ae8 100644
--- a/opac/tests/test_interface_TOC.py
+++ b/opac/tests/test_interface_TOC.py
@@ -401,6 +401,8 @@ def test_author_search_link_includes_orcid_when_authors_meta_has_orcid(self):
self.assertIn("q=au:Author Two", response_data)
self.assertNotIn("orcid:Author Two", response_data)
self.assertNotIn("OR au:(Author Two)", response_data)
+ # Author search links should open in a new tab
+ self.assertIn('target="_blank"', response_data)
def test_author_search_link_without_orcid_when_no_authors_meta(self):
"""
@@ -434,3 +436,5 @@ def test_author_search_link_without_orcid_when_no_authors_meta(self):
self.assertIn("q=au:Simple Author", response_data)
self.assertNotIn("orcid:", response_data)
+ # Author search links should open in a new tab
+ self.assertIn('target="_blank"', response_data)
diff --git a/opac/webapp/templates/issue/toc.html b/opac/webapp/templates/issue/toc.html
index 061a57205..5c4439a3e 100644
--- a/opac/webapp/templates/issue/toc.html
+++ b/opac/webapp/templates/issue/toc.html
@@ -211,9 +211,9 @@