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

  1. Install l10n_server 3.0.x with a group, a language and a parsed release, and add a suggestion.
  2. As a moderator, tick 'Decline' for the suggestion and save: SQL error.
  3. On the translate page choose the 'Is suggestion' status filter: SQL error. With the column name fixed, no results.
  4. 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

gábor hojtsy created an issue. See original summary.

gábor hojtsy’s picture

Issue summary: View changes
gábor hojtsy’s picture

Issue summary: View changes

Fix markup

gábor hojtsy’s picture

Title: Title: Declining suggestions and several translate page filters are broken by leftover Drupal 7 column names » Declining suggestions and several translate page filters are broken by leftover Drupal 7 column names

  • 1a0a0cc7 committed on 7.x-1.x
    fix #3621196: Add tests to the Drupal 7 codebase to ensure the decline...

  • 75c4ded7 committed on 3.0.x
    fix #3621196: Declining suggestions and several translate page filters...

  • d650ff18 committed on 3.0.x
    fix #3621196: Declining suggestions and several translate page filters...

  • 441366fb committed on 3.0.x
    fix #3621196: Declining suggestions and several translate page filters...

  • db6b9e5a committed on 3.0.x
    fix #3621196: Declining suggestions and several translate page filters...

  • 44342c75 committed on 3.0.x
    fix #3621196: Declining suggestions and several translate page filters...

  • 6edd96f5 committed on 3.0.x
    fix #3621196: Declining suggestions and several translate page filters...

  • 1f487ba3 committed on 3.0.x
    fix #3621196: Declining suggestions and several translate page filters...
gábor hojtsy’s picture

Status: Active » Fixed

Committed in small chunks so issue archeologists have an easier to to review :)

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.