Commit graph

11 commits

Author SHA1 Message Date
Alexander Vorwerk
dfb88f21ac McrUndoAction: inject ReadOnlyMode
Bug: T253078
Change-Id: I381fb0a4018f3e4cebe7aa21be36dbf1e8306316
2021-08-06 03:14:20 +02:00
Kunal Mehta
a85f569dd1 Revert "Use CsrfTokenSet as CSRF token source"
This reverts commit 0d75fdb4f7.

Bug: T287542
Change-Id: Iedd3461869f973f8d621a39e6ad4674cbb577551
2021-08-05 15:48:26 -07:00
DannyS712
b8b44a6de9 Inject services into Mcr(Undo|Restore)Action
Bug: T253078
Change-Id: I7519f41df37a47a56bfb2d4419b52860ca1bb732
2021-08-04 18:04:43 +00:00
libraryupgrader
5357695270 build: Updating dependencies
composer:
* mediawiki/mediawiki-codesniffer: 36.0.0 → 37.0.0
  The following sniffs now pass and were enabled:
  * Generic.ControlStructures.InlineControlStructure
  * MediaWiki.PHPUnit.AssertCount.NotUsed

npm:
* svgo: 2.3.0 → 2.3.1
  * https://npmjs.com/advisories/1754 (CVE-2021-33587)

Change-Id: I2a9bbee2fecbf7259876d335f565ece4b3622426
2021-07-22 03:36:05 +00:00
Petr Pchelko
0d75fdb4f7 Use CsrfTokenSet as CSRF token source
Change-Id: I079d2c802d9b48d6abf7f37fa9ef7dafac631345
2021-07-12 14:19:15 -07:00
DannyS712
b45ddb2ab3 Use WikiPage::doUserEditContent() instead of ::doEditContent()
Results in passing a user where previously the fallback
to $wgUser was being used, mostly in tests.

Bug: T255507
Change-Id: Iabe24315b23c0ad1272353186425e71974528d23
2021-06-28 00:11:30 -07:00
Umherirrender
b64d838062 Skip undo related phpunit tests when diff3 is missing
Change-Id: I7fcbcfcd191805c00bdac07f681d266fe3e1fccb
2020-12-12 20:22:17 +00:00
Umherirrender
5d41326891 Use ::class together with createMock in unit tests
This makes it easier for IDEs to find usage
This works even for non-existing classes

Change-Id: I4a6389a9bc0b3c212633841d69bd4f48a7ed6f56
2020-10-30 14:45:37 +01:00
Ostrzyciel
603cf919ee EditPage: Fix member call on boolean when undo is impossible
Ugh, my mistake.
Also added a test that should cover this. It fails on the previous
version of code, succeeds after applying this patch.

Bug: T262463
Change-Id: Ifda30daadea5a908505423caaf818b9f88f989ad
2020-09-09 22:59:00 +02:00
Ostrzyciel
a1e9038a68 EditPage: don't mark "dirty" undos as undos
This is a follow-up of T259014 which describes issues stemming from
users being able to mark arbitrary edits as undos (mitigation #3).

A "dirty" undo is when the user clicks the undo link and applies some
changes to page's content before saving. By doing so, the user can
set the edit's content to anything, while still marking the edit
with the mw-undo change tag and communicating to extensions that this
was an undo.

With this patch EditPage will only consider edits that had their
content provided by automatic conflict resolution as undos. Anything
other than that can't be reliably considered an undo.

THIS CHANGES THE BEHAVIOR OF EditPage IN A NOTICEABLE MANNER.
Most users should not notice anything different. In my opinion this
change makes EditPage's behavior more sensible and is justified.

Bug: T259014
Change-Id: I9279230303a01461039ae8a4641d9897ce194f73
2020-07-29 10:42:07 +02:00
Ostrzyciel
5bf2cf380b EditPage: handle undoafter param properly
This is to fix issues with reverts being marked incorrectly,
especially when using the undoafter param which, until this patch,
wasn't really supported.

Honestly, EditPage is such a mess that I'm not sure if this is good
or not, but I did a lot of manual testing and it seems to work fine.

WikiPage::doEditContent() now checks whether the provided original
revision really has the same content as the new revision. This was
previously the task of callers, but that doesn't make much sense to
me because:
* This task would fall on EditPage otherwise and it should be more
focused on the UI side of things, without too much worrying about
backend details.
* This would require adding another parameter to WikiPage::
doEditContent(), $undoAfterId. It would be only useful for multiple-
revision undos that are not top revisions. In all other cases it
would be the same as $originalRevId.
* An extra sanity check before applying the value to the PageUpdater
won't hurt. Who knows what crazy ideas extensions might have.

The test cases are almost identical to those written for
McrUndoAction, so I decided to group them in a single file.
This should cover most undo cases.

Bug: T256915
Change-Id: I78641b3de0a012af932ea38265b695362f1f8491
2020-07-08 21:46:04 +02:00