Commit graph

8 commits

Author SHA1 Message Date
David Lynch d806186810 Edit check: move config defaults to the client-side
This lets us encapsulate everything about a check in its JS definition,
which makes it much simpler for other extensions or gadgets to create
checks.

Change-Id: Ica23fc26a576d55addb001e4baf78b3702927208
2024-11-22 10:57:45 -06:00
Ed Sanders 4cd67004de editcheck: Remove mw.editcheck.Diff
This object just contained a pointer to the surface and dm,
and had one utility method.

Move the method to mw.editcheck, and pass around a surface model
or document model to other methods as appropriate.

Change-Id: Ie81d76dea2823b633328f982ee20027808bfc8e3
2024-10-17 17:10:02 +01:00
Ed Sanders f91c62c0eb editcheck: Rename shouldApplyToSection to isRangeInValidSection
Also refactor the loop at the end, and reorder arguments.

Change-Id: I378e5103889dd57b29948c932389e3dfa071255f
2024-10-17 17:10:02 +01:00
Ed Sanders 0cfeb76abc editcheck: Move adjustForPunctuation to AddReferenceEditCheck
This method is highly specific to reference insertion. If we ever need
it for another check it can be moved back with a more specific name.

Change-Id: Ia629c8672281f33d45ea1fff6630af9bd331d80e
2024-10-17 17:10:02 +01:00
Ed Sanders de70933dca editcheck: Document some methods and improve some APIs
* Pass just the ve.dm.Document to shouldApplyToSection, instead
  of the whole diff.
* Do the quicker range check first in getModifiedRangesFromDiff

Change-Id: I1bda3a77c1c51f50fd7baadaa3619cf6719a073a
2024-10-17 17:10:02 +01:00
David Lynch 709e791acd Edit check: let ecenable bypass the account age requirement
Clean up accountShouldSeeEditCheck since nothing is calling it but the
new method inside BaseEditCheck

Follow-up to e947e53f98

Change-Id: Ic55187bb77f5ef003369313b76a65897fb3be392
2024-09-09 10:52:50 -05:00
David Lynch e947e53f98 Edit check: stop from appearing outside the main namespace
This was accidentally removed in d69d366469 during its refactor.

Because of the change to how checks are decided to be shown, I've made
AddReferenceEditCheck always be required -- later code in
hasAddedContentNeedingReference assumes that it's loaded anyway, so a
wiki deciding to configure it to not load at all for some account types
would have broken saving.

Bug: T373692
Change-Id: I007cd705451581ebacfa12e8ac5502bd1bc56a38
2024-09-04 10:33:22 -05:00
David Lynch d69d366469 Edit check API
Change-Id: Ic5504eb2fe8d1d3f22e88abe1dd88790bdfd8b9c
2024-06-12 11:01:04 +01:00