Closed preimpression closed 4 years ago
(Title changed because I thought I had figured out how to allow replying to self and wanted to recycle the issue, but then realized I hadn't actually fixed anything.)
You could change the guard for comments reply. See config reply-to-comment guard. Just set it to return true.
P.S. Open a new issue for permalinkinh to comments or send a PR. I'm willing to implement this feature.
We got it to work - thanks!
[and gotcha, did so!: #110 ]
I'm doing the same, but just opening the permission guard treats the reply when from the same user like a new comment, and doesn't indent as a reply. I'm struggling to find where the code indents a reply so that I can indent a user's reply to their own comment. Any suggestions?
I found a hack solution by adding list HTML into the _comment.blade.php
view as follows:
{{-- Recursion for children --}}
@if($grouped_comments->has($comment->getKey()))
<ul style="list-style: none;">
@foreach($grouped_comments[$comment->getKey()] as $child)
<li>
@include('comments::_comment', [
'comment' => $child,
'reply' => true,
'grouped_comments' => $grouped_comments
])
</li>
@endforeach
</ul>
@endif
Hope this helps someone else.
@hondaman900 hi! the solution is much simpler; in the file CommentPolicy, simply change
public function reply($user, Comment $comment) : bool
{
return $user->getKey() != $comment->commenter_id;
}
}
to
public function reply($user, Comment $comment) : bool
{
return $user->getKey();
}
}
or
public function reply($user, Comment $comment) : bool
{
return true;
}
}
Thanks Ne-wt, I reversed my changes and tried that, but no difference to the indenting. Went back to my markup hack for now.
How might I allow users to reply to themselves?
For instance, in my website I want to allow users to store information in their comments if they so desire, so that they can link to specific comments to share with other users. Just requiring them to edit the comment wouldn't be effective.
Comment: "Resources"
(On another note, permalinking individual comments should also be added)