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 158 forks source link

Variable Wrongly Named #279

Closed manisar2 closed 3 years ago

manisar2 commented 3 years ago

Thanks for making such an awesome, well-documented and well-supported application!

There seems to be a variable wrongly named - either it should be dislikedit in models.py, or disliked in user_feedback.html.

Currently in templates\includes\django_comments_xtd\user_feedback.html, we have:

    <a href="{% url 'comments-xtd-dislike' item.comment.pk %}"
       class="{% if not item.dislikedit %}mutedlink{% endif %}">
        <span class="fas fa-thumbs-down"></span></a>

And in models.py, there is:

            if with_feedback:
                flags_dict.update({
                    'likedit_users': likedit_users, 'likedit': likedit,
                    'dislikedit_users': dislikedit_users, 'disliked': dislikedit
                })

This means that, in user_feedback.html, the variable referred to as item.dislikedit always results in False. Please have a look.

Also, I was not able to find a mention of these variables in documentation. likedit_users and dislikedit_users are explained, but these two variables returning True and False need to be added I think.

danirus commented 3 years ago

Hi @manisar2, thank you for your kind words, and for the report, it's a good catch!

danirus commented 3 years ago

It's already fixed. It will be part of v2.8.4. But I want to resolve another issue before I make the release. Thanks again @manisar2!

manisar2 commented 3 years ago

My pleasure, thanks for the fix!

manisar2 commented 3 years ago

@danirus I see no change, am I missing something? Removal:

                   'likedit_users': likedit_users, 'likedit': likedit,
                    'dislikedit_users': dislikedit_users, 'disliked': dislikedit

Addition

                    'likedit': likedit,
                    'disliked': dislikedit,
                    'likedit_users': likedit_users,
                    'dislikedit_users': dislikedit_users
danirus commented 3 years ago

You might be looking in the source code of the pip installed package. The fix is in the master branch, here in GitHub. I have not release a new version yet. I need to work on another issue before I prepare a new release.

However, you can install the version in GitHub. Just clone the repository, cd into it with your virtualenv enabled and run pip install -e .. That way you will get the latest code installed in your virtualenv.

manisar2 commented 3 years ago

I was looking at the change log. Also looked in the repo. I think you meant to change the key disliked to dislikedit. Currently, there isn't anything changed as it appears to me. image

danirus commented 3 years ago

This happens when I pretend to fix something before I have breakfast. Thank you again @manisar2.

manisar2 commented 3 years ago

NP!