django-comments-xtd icon indicating copy to clipboard operation
django-comments-xtd copied to clipboard

using plugin version 2.2.1

Open omaraltayyan opened this issue 5 years ago • 3 comments

currently when using version 2.6.1 and including the plugin files from version 2.2.1 the comments javascript plugin fails to retrieve comments because the retreived flags array is empty

this is the error


Uncaught TypeError: Cannot read property 'active' of undefined
    at new t (VM355 comments.2337b371f017.js:40)
    at Io (VM355 comments.2337b371f017.js:22)
    at si (VM355 comments.2337b371f017.js:22)
    at di (VM355 comments.2337b371f017.js:22)
    at Qi (VM355 comments.2337b371f017.js:22)
    at Ki (VM355 comments.2337b371f017.js:22)
    at Rl (VM355 comments.2337b371f017.js:22)
    at ql (VM355 comments.2337b371f017.js:22)
    at Sl (VM355 comments.2337b371f017.js:22)
    at tl (VM355 comments.2337b371f017.js:22)

in these lines

a.state={current_user:e.settings.current_user,removal:e.data.flags.removal.active,removal_count:e.data.flags.removal.count,like:e.data.flags.like.active,like_users:e.data.flags.like.users||[],dislike:e.data.flags.dislike.active,dislike_users:e.data.flags.dislike.users||[],reply_form:{component:null,show:!1}},a.action_like=a.action_like

these are the includes i am using

    <script src="{% static 'django_comments_xtd/js/vendor-2.2.1.js' %}"></script>
    <script src="{% static 'django_comments_xtd/js/plugin-2.2.1.js' %}"></script>

settings.py

COMMENTS_XTD_APP_MODEL_OPTIONS = {
    'default': {
        'allow_flagging': True,
        'allow_feedback': True,
        'show_feedback': True,
        'allow_comments': True,
    },
}

template script:

        <script>
            window.comments_props = {% get_commentbox_props for my_object %};
            window.comments_props_override = {
                allow_comments: true,
                allow_feedback: true,
                show_feedback: true,
                allow_flagging: true,
            };
        </script>

please let me know if there's a workaround for the issue

omaraltayyan avatar Jun 06 '20 09:06 omaraltayyan

Hi @omaraltayyan, they go together, the Python code and the JavaScript code are both released with the same version and have to be used together. If you got django-comments-xtd 2.6.1, then you have to change the script tags in your html code to make use of the version 2.6.1 of the plugin. They are part of the same bundle. Give it a try and let me know if you got it fixed.

danirus avatar Jun 06 '20 15:06 danirus

any ideas why including


    <script src="{% static 'django_comments_xtd/js/vendor~plugin-2.6.1.js' %}"></script>
    <script src="{% static 'django_comments_xtd/js/plugin-2.6.1.js' %}"></script>

instead of the above scripts causes a "React is not defined" error? do i need to include something else, sorry but the docs seem to mention version 2.3.1 only

omaraltayyan avatar Jun 06 '20 16:06 omaraltayyan

Maybe you read the docs for version 2.3.1 but installed version 2.6.1. It may happen when googling the documentation, as each version is documented. To be sure you use the docs of the version you use, visit the docs url and check out the version at the bottom left corner within the sidebar.

danirus avatar Jun 07 '20 05:06 danirus