Microblog: Fix reply button in inline comments below post

This commit is contained in:
Maxim Leshchenko 2021-12-17 21:30:39 +02:00
parent afa1d7e71c
commit 497e55b1a7
No known key found for this signature in database
GPG key ID: BB9C44A8733FBEEE
2 changed files with 3 additions and 3 deletions

View file

@ -1,8 +1,9 @@
{var author = $comment->getOwner()}
{var $Club = openvk\Web\Models\Entities\Club::class}
{var postId = $comment->getTarget() instanceof \openvk\Web\Models\Entities\Post ? $comment->getTarget()->getId() : NULL}
<a name="cid={$comment->getId()}"></a>
<table 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="{$comment->getOwner() instanceof $Club}">
<table 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="{$comment->getOwner() instanceof $Club}" n:attr="data-post-id => $postId">
<tbody>
<tr>
<td width="30" valign="top">

View file

@ -1,11 +1,10 @@
u(".comment-reply").on("click", function(e) {
let inputbox = u("#write textarea");
let comment = u(e.target).closest(".post");
let authorId = comment.data("owner-id");
let authorNm = u(".post-author > a > b", comment.first()).text().trim();
let fromGroup = Boolean(comment.data("from-group"));
let postId = comment.data("post-id");
console.log(postId)
let inputbox = postId == null ? u("#write textarea") : u("#wall-post-input" + (postId || ""));
inputbox.text("[" + (fromGroup ? "club" : "id") + authorId + "|" + authorNm + "], ");
inputbox.trigger("focusin");