#5940 - AJAX error with rating
| Identifier | #5940 |
|---|---|
| Issue type | Minor issue (breaks specific functionality) |
| Title | AJAX error with rating |
| Status | Completed |
| Handling member | PDStig |
| Version | 11 beta4 |
| Addon | core_feedback_features |
| Description | An error has occurred. The page may no longer operate as expected. Please refresh the page and try again. If you get this error again, please report it to the site staff.
There was a problem with an AJAX request: data/snippet.php?snippet=rating&type=&id=1&content_type=videos&template=RATING_BOX&content_url=&content_title=undefined&url=https-cms%3Amusic%2Findex.php%3Fpage%3Dgalleries%26type%3Dvideo%26id%3DGH0WFDvbHbQ&title=Raven%27s+Agony+%26gt%3B+Fallen+from+Grace&utheme=default 500: . |
| Steps to reproduce | |
| Additional information | Looks like the full URL is missing as well as content title being undefined. Rating is still applied despite the error. |
| Funded? | No |
| Commits |
The system will post a comment when this issue is modified (e.g., status changes). To be notified of this, click "Enable comment notifications".


Comments
There were multiple issues here.
When rating content, a 500 Internal Error would fire. This was because the PHP feedback API was confusing feedback type with content type, which are different. I clarified in the API by renaming a lot of the $content_type variables to $feedback_type. Points was trying to find the content title on a feedback type, not a content type, because of this confusion, which threw the error.
This hotfix also fixes an issue with content title being undefined. This was because the JavaScript was looking at the wrong object for the title property, so it would always pass in undefined. This also resolves #6064 .
This has not thoroughly been tested yet as parameters were changed in the templates from CONTENT_TYPE to FEEDBACK_TYPE to be more concise. But I did test and confirm ratings work, at least in galleries.
** This hotfix will break the Karma non-bundled add-on**. If you are using it, you will need to pull the latest commits from GitLab / update Karma when 11.beta5 comes out.