Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add ability to reload comments after changing state #336

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

PetrDlouhy
Copy link
Contributor

Few changes that allowed me to reload comments for different object after page load (for usage in modal dialog).
I don't know anything about React, so the code is rather hacky, and with the version 3.0 on the way I think we don't need to put much effort into polishing this.
I am putting it here just to show how I solved #335.

I am reloading the comments with:

     $.getJSON(
         "/asset-comment/" + asset_id + "/",
         function(comments_props, textStatus, jqxhr) {
            comments_props_override = {
               allow_comments: true,
               allow_feedback: true,
               show_feedback: true,
               allow_flagging: true,
               polling_interval: 5000
            };
            window.commentBox.setState({props: Object.assign(comments_props, comments_props_override)});
            window.commentBox.reload_all();
        }
      );

Where on the /asset-comment/xxxx/ url is view that just returns JSON with the comments_props.

@PetrDlouhy PetrDlouhy changed the title [WIP] add ability to reload comments after changing state add ability to reload comments after changing state Oct 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant