danirus / django-comments-xtd

A pluggable Django comments application with thread support, follow-up notifications, mail confirmation, like/dislike flags, moderation, a ReactJS plugin and Bootstrap 5.3.
https://django-comments-xtd.readthedocs.io
BSD 2-Clause "Simplified" License
594 stars 157 forks source link

Setting for disabling Gravatar? #320

Open sabyasachi opened 3 years ago

sabyasachi commented 3 years ago

Thanks for the great project! 🙂

I'm trying to find a way to disable the Gravatar image. Is there a way to do it? I could not find any setting option. It will be nice to have.

danirus commented 3 years ago

Hi @sabyasachi, there is a setting called COMMENTS_XTD_API_GET_USER_AVATAR that allows you to customize how to obtain the avatar. But there is no setting to disable the avatar. In v3 the app works as you want it by default, no avatar. But v3 is still under development. Slow development...

If you want to disable the avatar in v2, in the JavaScript plugin, go to line 412 of the file comment.jsx, in static/django_comments_xtd/js/src and follow the instructions here to rebuild the plugin. Let me know if you find any problem.

sabyasachi commented 3 years ago

Thank you @danirus for your reply!

I tried removing line 412 from static/django_comments_xtd/js/src/comment.jsx. It removes the Gravatar, but it also loses the indentation of inner comments.

After removing line#412:

after-removing-gravatar

Before removing line#412:

before-removing-gravatar
sabyasachi commented 3 years ago

Here is what I did:

To fix the indentation, add one ml-5 class in this line. But, this class should be added only for replies (should not be added for the first level comments.).

<div class="media {% if nested_reply %}ml-5{% endif %}">

Then I made the following change in the recursion call.

{% with nested_reply=True %}
    {% render_xtdcomment_tree with comments=item.children %}
{% endwith %}