Skip to content

Commit 51a7a2c

Browse files
authored
fix: correctly determine author for reply mentions (#1534)
хз вроде починил #1515
1 parent 8fe2b75 commit 51a7a2c

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

Web/Presenters/templates/components/comment.latte

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
{var $correctLink = $correctLink ?? false}
1010

1111
<a name="cid={$comment->getId()}"></a>
12-
<table data-id="1_{$comment->getId()}" border="0" style="font-size: 11px;" class="post comment" id="_comment{$comment->getId()}" data-comment-id="{$comment->getId()}" data-owner-id="{$author->getId()}" data-from-group="{$author instanceof $Club}" n:attr="data-post-id => $postId">
12+
<table data-id="1_{$comment->getId()}" border="0" style="font-size: 11px;" class="post comment" id="_comment{$comment->getId()}" data-comment-id="{$comment->getId()}" data-owner-id="{$author->getId()}" data-from-group="{$author instanceof $Club ? 'true' : 'false'}" n:attr="data-post-id => $postId">
1313
<tbody>
1414
<tr>
1515
<td width="30" valign="top">
@@ -27,7 +27,7 @@
2727
<div class="post-content" id="{$comment->getId()}">
2828
<div class="text" id="text{$comment->getId()}">
2929
<span class="really_text">{$comment->getText()|noescape}</span>
30-
30+
3131
{var $attachmentsLayout = $comment->getChildrenWithLayout(288)}
3232
<div n:ifcontent class="attachments attachments_b" style="height: {$attachmentsLayout->height|noescape}; width: {$attachmentsLayout->width|noescape};">
3333
<div class="attachment" n:foreach="$attachmentsLayout->tiles as $attachment" style="float: {$attachment[3]|noescape}; width: {$attachment[0]|noescape}; height: {$attachment[1]|noescape};" data-localized-nsfw-text="{_nsfw_warning}">
@@ -42,7 +42,7 @@
4242
</div>
4343
</div>
4444
<div n:if="isset($thisUser) &&! ($compact ?? false)" class="post-menu">
45-
<a href="{if $correctLink}{$comment->getTargetURL()}{/if}#_comment{$comment->getId()}" class="date">{$comment->getPublicationTime()}
45+
<a href="{if $correctLink}{$comment->getTargetURL()}{/if}#_comment{$comment->getId()}" class="date">{$comment->getPublicationTime()}
4646
<span n:if="$comment->getEditTime()" class="edited editedMark">({_edited_short})</span>
4747
</a>
4848
{if !$timeOnly}
@@ -78,7 +78,7 @@
7878
href="#_comment{$comment->getId()}"
7979
class="date"
8080
>{$comment->getPublicationTime()}</a>
81-
81+
8282
</span>
8383
</div>
8484
</div>

Web/static/js/al_comments.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ u(document).on("click", ".comment-reply", function(e) {
22
let comment = u(e.target).closest(".post");
33
let authorId = comment.data("owner-id");
44
let authorNm = u(".post-author > a > b", comment.first()).text().trim();
5-
let fromGroup = Boolean(comment.data("from-group"));
5+
let fromGroup = comment.attr("data-from-group") === "true";
66
let postId = comment.data("post-id");
77
let inputbox = postId == null ? u("#write textarea") : u("#wall-post-input" + (postId || ""));
88
let mention = ("[" + (fromGroup ? "club" : "id") + authorId + "|" + authorNm + "], ");
9-
9+
1010
// Substitute pervious mention if present, prepend otherwise
1111
inputbox.nodes.forEach(node => {
1212
node.value = node.value.replace(/(^\[([A-Za-z0-9]+)\|([\p{L} 0-9@]+)\], |^)/u, mention);

0 commit comments

Comments
 (0)