Page MenuHomePhabricator

Moved page can wrongly get Translate ready tag
Closed, ResolvedPublic4 Estimated Story PointsBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

  • Create a page with some translate markup.
  • Remove the translate markup.
  • Move the page.

Sample of issuing pages: real case, sandbox reproduction.

What happens?:
“Mark this page for translation” displays at top of the page.
The page is listed in Special:PageTranslation.

What should have happened instead?:
We should not be able to mark the page for translation.

Purging the page does not solve this issue.
If this is only a rare case due to job lag, we only need a way to remove the “ready” tag, maybe via a “Remove from translation” link (do=unlink action) from Special:PageTranslation.

Event Timeline

Pols12 updated the task description. (Show Details)

If this is only a rare case due to job lag, we only need a way to remove the “ready” tag, maybe via a “Remove from translation” link (do=unlink action) from Special:PageTranslation.

Making any edit to the page (i.e. https://meta.wikimedia.org/w/index.php?title=Africa_Environment%2FMicrofunding%2FClimate_and_Weather_trainings_and_Edit-a-thons_in_Ruhengeri&diff=prev&oldid=24776875&diffmode=source ) seems to clear the stale tag

Nikerabbit set the point value for this task to 4.Apr 4 2023, 12:17 PM
Wangombe changed the task status from Open to In Progress.Apr 11 2023, 7:09 AM
Wangombe claimed this task.

Screen Shot 2023-04-11 at 07.58.17 AM.png (167×364 px, 12 KB)

I was able to reproduce this. I will look into it further for fixing.

As defined in Hooks::addTranstagAfterSave(), this method is called on every page save as defined in HookHandler.php#236, The method in turn checks whether the page contains the <translate></translate> tags and marks the page with tp:tag if it does, which is the indication that the page is ready to be marked for translation.

However,

  • 3rd step in reproducing [something similar to] this bug should have actually been to mark the page for translation.
  • 4th step is to remove the markup
  • 5th is to move the page.

This is the only way that I have managed to reproduce something close to this bug.

Some points to note:

  • Removing the <translate></translate> tags before marking the page for translation leaves row with tp:tag attribute against a revision of the page inside the revtag table in the DB.
  • Moving the page as in the 5th step above also doesn't produce this bug as defined in the ticket description.
  • The logic that shows the 'Mark this page for translation' link depends on Hooks::sourcePageHeader()#1272.
  • From what I could gather on this line, $hasChanges = $ready === $latest && $marked !== $latest;, the latest revision number will change once the tags are removed and page saved. This produces a different revisionID (an increment of the last revisionID) from the revision that received the tp:tag. Thus, $hasChanges is false. So the link will not show. The comment I made above is misleading.
abi_ added subscribers: Wangombe, abi_.

Assigning this to myself in order to review and reproduce

In order to reproduce this again, I preloaded Special:MovePage in a second tab before removing translate tags; so I can quickly submit the move forms just after having removed the tags.

I'm able to reproduce this.

  1. Create a page with <translate> markup.
  2. Removed the <translate> markup.
  3. Moved the page. Note that this used the default Special:MovePage in MediaWiki

After the move noticed the Mark this page for translation.

image.png (342×553 px, 14 KB)

Values in the revtag table:

When tagging the page initially with <translate> tags:

rt_typert_pagert_revisionrt_value
tp:tag1389917983?

After removing the <translate> tag:

rt_typert_pagert_revisionrt_value
tp:tag1389917983?

After moving the page again rt_revision :

rt_typert_pagert_revisionrt_value
tp:tag1389917985?

After moving the page, the rt_revision gets updated. I believe this happens in MediaWiki\Extension\Translate\PageTranslation\Hooks::updateTranstagOnNullRevisions.

Change 922103 had a related patch set uploaded (by Abijeet Patro; author: Abijeet Patro):

[mediawiki/extensions/Translate@master] Check if page has translate markup before updating tp:tag revision

https://gerrit.wikimedia.org/r/922103

Change 922103 merged by jenkins-bot:

[mediawiki/extensions/Translate@master] Check if page has translate markup before updating tp:tag revision

https://gerrit.wikimedia.org/r/922103

abi_ moved this task from In Review to Done on the Language-Team (Language-2023-April-June) board.

I tested this on translatewiki.net and I can no longer reproduce this issue. Marking this as fixed.