USGS-WiM/whispersservices

Comment timeline in whispersprod.cr

Closed this issue · 8 comments

New comments are not displaying in the comment timeline (see pic below for https://whispersprod.cr.usgs.gov/event/170919). Likely due to the different content_type_id in saved in the comment table? See below for summary of content type (table django_content_type) comments.

id app_label model comment_count first_comment last_comment
134 whispersapi event 4 10/15/2020 10/16/2020
21 whispersservices event 13,550 1/1/1970 9/24/2020
135 whispersapi eventgroup 1 10/15/2020 10/15/2020
100 whispersservices eventgroup 6 4/25/2019 12/16/2019
132 whispersapi eventlocation 3 10/13/2020 10/15/2020
27 whispersservices eventlocation 742 10/30/2018 10/6/2020
133 whispersapi servicerequest 5 10/13/2020 10/15/2020
50 whispersservices servicerequest 213 11/2/2018 8/27/2020
121 whispersservices userchangerequest 25 2/28/2020 8/20/2020

image

Determined this is caused by an unintended change in the eventdetails response. The combined_comments field is used to populate the comment timeline, and it seem to not be getting populated correctly. It should have the event level comments and the event location level comments.

Capture

Original issue discussing and implementing the field:#278

After investigating, there's absolutely nothing wrong with the code. The cause of the problem is the app name change; django created new content types with the new app name (whispersapi vs the old whispersservices), which is now interfering with the comment queries. Should be an easy fix.

OK, I think this is fixed. @nbaertlein would you give it another test?

@aaronstephenson I can view all comments now, but I can't seem to create new ones. Getting the following token error.
"Error. Comment not saved. Error message: SyntaxError: Unexpected token I in JSON at position 0"
I'm also not logged into the API.

After some testing, I can create comments just fine using the API directly (via Insomnia) and in the browsable API. I only get an error when using the client.

@aaronstephenson can you share what you are sending to create a comment?

POST https://whisperstest.cr.usgs.gov/api/comments/

{
  "comment": "This is a test comment.",
  "comment_type": 10,
  "object_id": 170919,
  "new_content_type": "event"
}

Resolved with latest update to services on test. Small confusion with an improper reference to the now outdated prod environment api.