Problem/Motivation
Parts of the 3.0.x port still use Drupal 7 column names on the l10n_server_translation table (is_active, is_suggestion, time_changed, time_approved), which the entity definition renamed to status, suggestion, changed. As a result:
- Declining a suggestion fails with an SQL error (
Unknown column 'is_active') in L10nPo::declineString(). The history row is also written with a raw insert that lacks the required uuid, so it would fail even with the right column names. Declining never worked in 3.0.x.
- Re-suggesting a previously declined translation fails the same way in
L10nPo::addSuggestion() (time_changed).
- The 'Is translation' and 'Is suggestion' status filters on the translate page fail (
t.is_suggestion in L10nTranslator::getStrings()).
- The translate page query joins only approved translations, so even with the right column name 'Is suggestion', 'Submitted by' and searching inside suggestions can never match. The Drupal 7 version joins all active translations for those filters.
- The 'Submitted by' filter crashes: the controller passes a user id,
L10nTranslator::getStrings() and TranslateForm::translateTranslation() call ->id() on it.
- Both exporters read
time_approved, so PO-Revision-Date is always the placeholder. (Drupal 7 has the same latent bug.)
- The devel generate plugin for translations uses the old field names.
- The 'No context' filter compares against '' while strings without context are stored with NULL context.
Steps to reproduce
- Install l10n_server 3.0.x with a group, a language and a parsed release, and add a suggestion.
- As a moderator, tick 'Decline' for the suggestion and save: SQL error.
- On the translate page choose the 'Is suggestion' status filter: SQL error. With the column name fixed, no results.
- Filter by 'Submitted by' fatal error.
Proposed resolution
- Use the current column names in
L10nPo and L10nTranslator, and create the decline history row through entity storage like approveString() does.
- Add a second, conditional join on all active translations for the author, search and 'is translation / is suggestion' filters, matching Drupal 7.
- Accept a user id or an account in the author filter.
- Use
changed for the export revision date.
- Match NULL as well as '' for the 'No context' filter.
Verified against a Drupal 7 site with the same seed data: after the changes the same suggestion, approval, decline, re-suggest and import sequence produces identical translation and history tables on both versions.
Remaining tasks
- Review and commit.
- Add a Drupal 7 SimpleTest
testModerationHistory() (filters, decline, re-suggest, demote, import medium, details page). Then port the Drupal 7 test to a 3.0.x test so this stays covered.
Data model changes
None.
LLM disclosure
LLM was used to find this issue, create the report and fix the bugs. With human review.
Comments
Comment #2
gábor hojtsyComment #3
gábor hojtsyFix markup
Comment #4
gábor hojtsyComment #13
gábor hojtsyCommitted in small chunks so issue archeologists have an easier to to review :)