Page MenuHomePhabricator

Flush utterances after edit from consumer wiki
Closed, ResolvedPublic2 Estimated Story Points

Description

When a change is made to the lexicon by a user from a consumer wiki the old utterances for the relevant page should be flushed. This would require including page and maybe consumer wiki URL in the edit link.

Event Timeline

Isn't this already done in SpecialEditLexicon::submit -> purgeOriginPageUtterances()?

Change #1153980 had a related patch set uploaded (by Viktoria Hillerud WMSE; author: Viktoria Hillerud WMSE):

[mediawiki/extensions/Wikispeech@master] Flush utterances after edit from consumer wiki

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

Isn't this already done in SpecialEditLexicon::submit -> purgeOriginPageUtterances()?

I think it is, but not when the utterance belongs to a consumer wiki.

In this patch there's nothing in the frontend to add the new parameter to the edit link. Do you plan to put that in a separate patch? I think it would make sense to include in the same one.

In this patch there's nothing in the frontend to add the new parameter to the edit link. Do you plan to put that in a separate patch? I think it would make sense to include in the same one.

I will make it in the same patch!

Viktoria_Hillerud_WMSE changed the point value for this task from 8 to 6.Aug 7 2025, 12:10 PM
Viktoria_Hillerud_WMSE changed the point value for this task from 6 to 4.Sep 9 2025, 8:18 AM
Viktoria_Hillerud_WMSE changed the point value for this task from 4 to 2.Sep 23 2025, 11:44 AM

I can't get this working. I tried using SVWP as consumer wiki and can see that the URL to the editor looks good: http://localhost:8080/w/index.php?title=Special%3AEditLexicon&language=sv&page=8684180. When I eventually save the entry (which works fine) I don't get the new pronunciation when I refresh the page. In the log it says

2025-10-03 12:37:53 0a5232c69e8a my_database: MediaWiki\Wikispeech\Utterance\UtteranceStore::flushUtterancesByPage: Flushing utterances for page 8684180

It looks like it forgot the consumer wiki at some point.

I also noticed that the URL parameters disappear on the second page in the editor. This is fine since it's a POST request (it probably shouldn't be, but that's by the by). However the request data is:

{
	"title": "Special:EditLexicon",
	"language": "sv",
	"word": "V/S",
	"wpFormIdentifier": "lookup",
	"wpEditToken": "7e546f38f232bd0a6d4f798322c11dec68dfc57c+\\",
	"page": "8684180",
	"consumerUrl": ""
}

I think It works now, the issue was that I thought I could get the producerUrl from the config locally by setting $wgWikispeechProducerUrl in LocalSettings.php, when what I really should have done was to set it in my User-script/global.js as the repo explained in docs/gadget-template.js.

The fix was finally, after adding the user script to add consumerUrl parameter to ext.wikispeech.ui.js::addEditButton()

I did a quick test and it looks like it works 👍

I did a quick test and it looks like it works 👍

Wonderful!

Change #1153980 merged by jenkins-bot:

[mediawiki/extensions/Wikispeech@master] Flush utterances after edit from consumer wiki

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