diff --git a/src/Controller/ArticleController.php b/src/Controller/ArticleController.php index d1060da..a5dde3e 100644 --- a/src/Controller/ArticleController.php +++ b/src/Controller/ArticleController.php @@ -137,7 +137,7 @@ class ArticleController extends AbstractController ): array { $coordparts = explode(':', $coordinate, 3); $articleKind = isset($coordparts[0]) && ctype_digit($coordparts[0]) ? (int) $coordparts[0] : 30023; - $articleAuthorPubkey = $coordparts[1] ?? ''; + $articleAuthorPubkey = strtolower(trim((string) ($coordparts[1] ?? ''))); $articleReplyTags = null; if ($articleAuthorPubkey !== '' && 64 === \strlen($articleAuthorPubkey) && ctype_xdigit($articleAuthorPubkey)) { @@ -162,6 +162,9 @@ class ArticleController extends AbstractController 'authorPubkey' => $articleAuthorPubkey, 'expectedTags' => $articleReplyTags, ]; + } + + if ($userMayReply) { /** @var array $list */ $list = $data['list'] ?? []; foreach ($list as $row) { @@ -172,8 +175,8 @@ class ArticleController extends AbstractController if ($k !== KindsEnum::COMMENTS->value) { continue; } - $cid = (string) ($row->id ?? ''); - $cpk = (string) ($row->pubkey ?? ''); + $cid = strtolower(trim((string) ($row->id ?? ''))); + $cpk = strtolower(trim((string) ($row->pubkey ?? ''))); if ($cid === '' || 64 !== \strlen($cid) || !ctype_xdigit($cid)) { continue; } diff --git a/templates/components/Organisms/Comments.html.twig b/templates/components/Organisms/Comments.html.twig index 98aa00d..00f0341 100644 --- a/templates/components/Organisms/Comments.html.twig +++ b/templates/components/Organisms/Comments.html.twig @@ -1,5 +1,6 @@ {% set ctx = comment_reply_context|default(null) %} -{% if ctx and ctx.can_publish|default(false) and ctx.rows|default([])|length > 0 %} +{# `rows` can be non-empty for nested replies when the article-level NIP-22 row is missing; do not require length > 0. #} +{% if ctx and ctx.can_publish|default(false) %} {% for row in ctx.rows %} {% if row.mode|default('') == 'article' %}
{% for item in list %} - {% set cid = item.id|default('') %} + {% set cid = item.id|default('')|lower %} {% set cpk = item.pubkey|default('') %} {% set cts = item.created_at|default(null) %} {% set cdepth = item.unfold_depth|default(0) %}