Lucas_Werkmeister_WMDE added a comment.
Greta and I tried yesterday to implement this in the `SetLabel` and `SetDescription` APIs. Their parent class `ModifyEntity` has a convenient `validateEntitySpecificParameters` method, where you can validate the `array $preparedParameters` against the `EntityDocument $entity` and raise an error if the new label/description in the `$preparedParameters` matches the description/label in the `$entity`. However, we found that it didn’t work correctly in the case where you set both label and description to the same new value in the UI. That’s because in that case, the second API request (to set the description) specifies `baserevid` as the revision ID of the original loaded page, not the new revision ID returned by the first API request (to set the label); and `ModifyEntity` loads the entity at the base revision and runs `validateEntitySpecificParameters` against that, so it would check if the new description doesn’t match the //old// label, rather than the new one in the latest revision. Also, this approach requires separate implementations in `Special:SetLabel`, `Special:SetDescription`, `Special:SetLabelDescriptionAliases`, `wbeditentity`, and possibly more places that we forgot. An alternative place to implement this check would be deep in the bowels of the entity saving code (at the point where we actually have the parent revision), e. g. in `MediawikiEditEntity::attemptSave()`, which ends up calling the `EditFilterMergedContent` hook. But this might also affect undo/restore/rollback… TASK DETAIL https://phabricator.wikimedia.org/T212869 EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/ To: Greta_Doci_WMDE, Lucas_Werkmeister_WMDE Cc: Lucas_Werkmeister_WMDE, alaa_wmde, abian, Aklapper, joker88john, CucyNoiD, Nandana, NebulousIris, Gaboe420, Versusxo, Majesticalreaper22, Giuliamocci, Adrian1985, Cpaulf30, Lahi, Gq86, Baloch007, Darkminds3113, Bsandipan, Lordiis, GoranSMilovanovic, Adik2382, Th3d3v1ls, Ramalepe, Liugev6, QZanden, LawExplorer, WSH1906, Lewizho99, Maathavan, _jensen, rosalieper, Jonas, Wikidata-bugs, aude, Lydia_Pintscher, Mbch331
_______________________________________________ Wikidata-bugs mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/wikidata-bugs
