Commit graph

24 commits

Author SHA1 Message Date
Daimona Eaytoy
9ef58c1d0b Lock selection to a single side in diffs
This is inspired by the github approach, with some adjustments,
simplifications and improvements. This approach should be supported by
all grade C browsers, except for Firefox 27-51. As such, it seems the
best solution until we can use the grid layout (T270775).

The boilerplate code for the new module was shamelessly stolen from
Ied858465c2e938828fc146880827acb6aa15fdd6.

Also noting here for posterity: this will NOT work in WMF servers (beta
or prod), since we use wikidiff2 to generate diffs there.

Bug: T285956
Change-Id: I0cb5f10254af78043b0f6250f7695c6b962fbf6b
2021-07-27 20:45:22 +00: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
James D. Forrester
df5eb22f83 Replace uses of DB_MASTER with DB_PRIMARY
Just an auto-replace from codesniffer for now.

Change-Id: I5240dc9ac5929d291b0ef1c743ea2bfd3f428266
2021-04-29 09:24:31 -07:00
Reedy
729f20afc8 Tests: Mark more closures as static
Bug: T274036
Change-Id: I911d3041cebe417d162934223b46ea295c6d20e3
2021-02-07 13:26:56 +01:00
Ed Sanders
27319def63 Create diff markers with CSS
Also put <br>s into empty lines so linebreaks are preserved when copying.

Bug: T192526
Change-Id: I926bedf71562c74a0aa33fbeb11f8d1a4e4130c7
2020-12-30 12:52:08 +00:00
Ed Sanders
351077388f TableDiffFormatter: Build HTML using utility class
Change-Id: Idab793bb1aabe8bffcbb2d00f68860d8b05172ef
2020-12-29 22:24:28 +00:00
DannyS712
2f4b71fc6c Replace uses of Revision constants
Bug: T257010
Change-Id: Id63123e8b8becd31756d5b68ca11edb238ec8a59
2020-07-03 01:23:44 +00:00
DannyS712
e36fc3a8dd Remove use of the Revision object returned in WikiPage::doEditContent
Each file's changes are independent and can be reviewed separately

Bug: T251853
Bug: T254952
Change-Id: I197c3db4cfb2ead920c8e6071120ae29543ee404
2020-06-09 23:38:03 +00:00
Varun Das
7f75052074 Added timestamp to action=compare
Added timestamp props to ApiComparePages.php with value setting only
occuring when getTimestamp() does not return null. Added Appropriate
tests to ApiComparePagesTest.php

Bug: T247686
Change-Id: I15523d11741786f3c5d572a6cff79aef787af78f
2020-04-09 16:24:21 -04:00
DannyS712
7380aba100 Pass a user to WikiPage::doDeleteArticleReal, use new signature
Don't need to worry about supporting prior versions, since its core

Bug: T247869
Change-Id: Iad9397327731817b8c276d0b9786c3bc5ecf6476
2020-03-19 00:54:29 +00:00
Brad Jorsch
f3058c81b9 Add $wgDiffEngine
The immediate use case is for testing, where some tests need to use the
PHP implementation even when wikidiff2 is installed.

Bug: T237049
Change-Id: I41dc4c0933429065d7638f518ec31f0a056afc41
2019-11-05 10:38:52 -05:00
James D. Forrester
5b3bbd5ade Drop strings for wgExternalDiffEngine, deprecated in 1.27 and 1.32
Also move the 'unit' test into integration, given it tests code
using globals.

Change-Id: Ie039cae9b5d2870c18a6deefec9a73de522dd847
2019-10-03 22:09:38 +00:00
Thalia
5e683829d6 Ensure calls to Title::getArticleID use the same case as the definition
Change-Id: Ic92f43c9e9df2782ba20aa28ad9e6d2ef7976d2e
2019-02-06 22:15:05 +00:00
jenkins-bot
9ef78ab4c1 Merge "ApiComparePages: Don't error with no prev/next rev" 2018-12-18 10:06:23 +00:00
Brad Jorsch
3c95d3bdd9 ApiComparePages: Don't try to find next/prev of a deleted revision
RevisionStore::getPreviousRevision() and ::getNextRevision() don't
handle being passed a RevisionArchiveRecord very well. Even if they
would, it's not clear whether the user wants to be comparing with the
next/previous deleted revision or the next/previous revision even if not
deleted. So let's just make it an error, at least for now.

Bug: T208929
Change-Id: I151019e336bda92aa4040ba4162eb2588c909652
2018-12-03 15:31:34 -05:00
Brad Jorsch
cf4f985f22 ApiComparePages: Don't error with no prev/next rev
Prior to I700edfa76, torelative=prev on the first revision of a page
would "diff" from an empty revision, and torelative=next on the latest
revision would diff to that same latest revision. People were depending
on that behavior, so restore it.

Bug: T203433
Change-Id: Ie81b58c196998a8047322740fe1d1fa44eff8526
2018-10-22 13:47:43 -04:00
Brad Jorsch
07530dfb63 ApiComparePages: Clean up handling of slot deletion
We can't allow the main slot to be deleted. DifferenceEngine assumes it
exits.

We also shouldn't allow parameters such as `tosection-{role}` to be used
without the corresponing `totext-{role}`. This will help prevent people
from being confused into thinking that `tosection-{role}` will do
anything in that situation (as opposed to `tosection`, which did).

Bug: T203255
Change-Id: I58573bb2c1ee68e6907ef2e88385fe36e5184076
2018-08-31 11:26:07 -04:00
Brad Jorsch
1ab2f7a56b ApiComparePages: Update for MCR
The main external change here is that it can now return diffs per slot,
and the various parameters for providing text are deprecated in favor of
templated per-slot versions.

Also, this deprecates the 'fromsection' and 'tosection' behavior
introduced for T183823 (extracting a section's content for the diff) in
favor of the more logical behavior requested in T185723 (expanding
'fromtext-{slot}'/'totext-{slot}' as if for a section edit).

Bug: T200569
Bug: T183823
Bug: T185723
Change-Id: I700edfa766bbc320887f2e0b7507fcdb11e72cdc
2018-08-23 14:56:10 +00:00
Bartosz Dziewoński
485f66f174 Use PHP 7 '??' operator instead of '?:' with 'isset()' where convenient
Find: /isset\(\s*([^()]+?)\s*\)\s*\?\s*\1\s*:\s*/
Replace with: '\1 ?? '

(Everywhere except includes/PHPVersionCheck.php)
(Then, manually fix some line length and indentation issues)

Then manually reviewed the replacements for cases where confusing
operator precedence would result in incorrect results
(fixing those in I478db046a1cc162c6767003ce45c9b56270f3372).

Change-Id: I33b421c8cb11cdd4ce896488c9ff5313f03a38cf
2018-05-30 18:06:13 -07:00
jenkins-bot
ba00b23a1d Merge "ApiComparePages: Add 'fromsection' and 'tosection' parameters" 2018-01-04 07:01:31 +00:00
Umherirrender
255d76f2a1 build: Updating mediawiki/mediawiki-codesniffer to 15.0.0
Clean up use of @codingStandardsIgnore
- @codingStandardsIgnoreFile -> phpcs:ignoreFile
- @codingStandardsIgnoreLine -> phpcs:ignore
- @codingStandardsIgnoreStart -> phpcs:disable
- @codingStandardsIgnoreEnd -> phpcs:enable

For phpcs:disable always the necessary sniffs are provided.
Some start/end pairs are changed to line ignore

Change-Id: I92ef235849bcc349c69e53504e664a155dd162c8
2018-01-01 14:10:16 +01:00
Brad Jorsch
b7f75836ee ApiComparePages: Add 'fromsection' and 'tosection' parameters
The deprecated diffing in prop=revisions and such used a 'rvsection'
parameter. To enable migration of things using that, action=compare
needs corresponding section parameters.

Bug: T183823
Change-Id: If1a0e2df614c083b37640418c69cca367ce0e895
2017-12-30 12:59:26 -05:00
Thiemo Mättig
72fa7b9dfc Fix inconsistent capitalization of different method calls
Change-Id: I9f5b9e59e8cdadf65e80077fe2d3a9822b4592fe
2017-12-27 12:35:13 +01:00
Brad Jorsch
c671ee1622 API: Rewrite ApiComparePages
Support diffing deleted revisions, user-supplied text, and additional
properties about the diffed revisions such as the user and edit summary.

Bug: T20189
Bug: T30047
Bug: T164529
Change-Id: I5565d717d9c2fd19da7cae02890a15e244cc238b
2017-06-05 12:23:32 -07:00