Tatoeba / tatoeba2

Tatoeba is a platform whose purpose is to create a collaborative and open dataset of sentences and their translations.
https://tatoeba.org
GNU Affero General Public License v3.0
714 stars 132 forks source link

Bug with sentence pages in the admin interface #3107

Closed profesyonal closed 7 months ago

profesyonal commented 8 months ago

Logged in as an admin, when I try to go to the page of an individual sentence, it dumps out an un-stylized page with the title, "Error: Call to undefined function __nx()"

image

Steps to reproduce

  1. Create a new sentence. (I did this as "Contributor")
  2. Log in as admin
  3. Go to the sentence page for your new sentence.

Things I've tried

  1. Reloading Vagrant with vagrant reload
  2. Destroying the Vagrant machine with vagrant destroy and rebuilding it with vagrant up
profesyonal commented 8 months ago

I can confirm now that this also happens when you create a sentence as admin and view it with admin.

Yorwba commented 8 months ago

This might be a caching issue, try deleting it with rm -r tmp/cache (this will also delete some empty directory markers tracked in git, you can get them back with git restore tmp/cache.

trang commented 8 months ago

Actually this was because the function __nx() is indeed an undefined function. It should be __xn().

The bug happens more specifically when trying to load a sentence's page that has the "Audio" element in the sidebar. It happens that admins always have this Audio element, but the error happens also to non-admins who are viewing the page of sentence that has audio.

I pushed a fix for it (6fcebf6a67e7ea64c8ed42cc704c8b397d9293f7) and will be deploying it on prod now.

profesyonal commented 8 months ago

Thanks!