Page MenuHomePhabricator

Context item "add details" action should replace footnote marker with a subref
Closed, ResolvedPublic

Description

When saving a new subreference using the context item workflow, we will be replacing the selected footnote marker with a subreference. Current behavior would be to edit all reuses by name, but we want to only edit the one selected marker.

This gets interesting in both the reused and not-reused cases: if the reference is not reused, then we're turning it into a main+details footnote. If the reference is reused, then we're leaving other instances of the ref alone, but replacing the selected marker with a different ref. If the main ref content did not appear elsewhere, then note that we'll have to create a main+details.

Outcome

Peek 2025-06-12 13-05.gif (646×1 px, 337 KB)

Event Timeline

Just adding a random thought here:

  • At the moment we just allow adding details when there's already a reuse. {1][1]
  • The current code also just adds a single sub-ref behind the main ref where the user opened the context menu. So we'll have [1][1][1.1]
  • Wouldn't it be sufficient to then delete the main ref where we started with to get to [1][1.1]? The deletion mechanism then takes care of where the main content needs to go, so that we're good on save?
  • Wouldn't it be sufficient to then delete the main ref where we started with to get to [1][1.1]? The deletion mechanism then takes care of where the main content needs to go, so that we're good on save?

Yes, agreed! As long as the new subref is correctly flagged as a main+details, there should be no loss of information. The task description gets a bit complex because I mentioned the logic for finding a home for main ref content, but that's mostly irrelevant here other than to make sure we trigger that logic. The point of this task is just the simple replacement of [1] by [1.1], which is at the level of document surface selection and commit.

awight renamed this task from Context item "add details" action replaces footnote marker with a subref to Context item "add details" action should replace footnote marker with a subref.May 28 2025, 7:52 AM
awight removed awight as the assignee of this task.
awight moved this task from Doing to Watching / Stalled on the WMDE-TechWish-Sprint-2025-05-14 board.

Change #1152639 had a related patch set uploaded (by Awight; author: Awight):

[mediawiki/extensions/Cite@master] [POC] Delete original selection when adding a subref

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

What currently is not working is adding details to two references (the body gets lost):

image.png (201×1 px, 33 KB)

But there is already a ticket with this issue: T389100: VE: Deleting main ref should not orphan existing sub-refs.

Change #1152657 had a related patch set uploaded (by Thiemo Kreuz (WMDE); author: Thiemo Kreuz (WMDE)):

[mediawiki/extensions/Cite@master] [POC] Preserve main content when replacing main with sub-ref

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

Change #1152639 merged by jenkins-bot:

[mediawiki/extensions/Cite@master] Delete original selection when adding a subref

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

Change #1155243 had a related patch set uploaded (by Svantje Lilienthal; author: Svantje Lilienthal):

[mediawiki/extensions/Cite@master] Fix sub ref creation

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

During demo time we noticed a bug that did not save edit changes to main ref or subrefs after a sub ref has been created. The above patch fixes this by resetting the flag we introduced.

Change #1155243 merged by jenkins-bot:

[mediawiki/extensions/Cite@master] Fix sub ref creation

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

Tobi_WMDE_SW claimed this task.
Tobi_WMDE_SW subscribed.

demonstrated in Sprint Review.

Change #1236257 had a related patch set uploaded (by WMDE-Fisch; author: WMDE-Fisch):

[mediawiki/extensions/Cite@master] [VE] Don't collaps fragment on sub-ref creation

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

Change #1236257 merged by jenkins-bot:

[mediawiki/extensions/Cite@master] [VE] Don't collaps fragment on sub-ref creation

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