Commit graph

1594 commits

Author SHA1 Message Date
jenkins-bot
bd78869618 Merge "No yoda conditions" 2018-12-09 01:34:23 +00:00
Dayllan Maza
65bd5b5e65 Change rules when displaying block log extract
Show log extract if the user is sitewide blocked, or is partially
blocked and not allowed to edit their user page or user talk page.

Bug: T203171
Change-Id: I9bcc50cfc1fad23f6bbbe5374a9a866f77bebc11
2018-12-05 22:58:46 +00:00
jenkins-bot
2cf4a2c296 Merge "Add block notice stats on EditPage." 2018-11-28 19:55:12 +00:00
Dayllan Maza
49bb28b557 Add block notice stats on EditPage.
Monitoring block notices is behind $wgEnableBlockNoticeStats config
flag which is set to false by default.

The reason behind this metric is to get an idea on how
frequently blocked users attempt to edit a page. Similar tracking
is being added to MobileFrontend and VisualEditor.

Bug: T201718
Change-Id: I6bd1c95548616677e1f72ba6bcfc6f2b551c1ca6
2018-11-28 00:51:37 -05:00
Fomafix
3ee1560232 No yoda conditions
Replace
  if ( 42 === $foo )
by
  if ( $foo === 42 )

Change-Id: Ice320ef1ae64a59ed035c20134326b35d454f943
2018-11-21 17:54:39 +01:00
jenkins-bot
ee8aceaeba Merge "Make the context page the edited page in EditPages" 2018-11-19 20:19:14 +00:00
daniel
501bb93e3e Make the context page the edited page in EditPages
This forces the WikiPage returned by $this->getContext()->getPage()
to be the same as $this->page.

This seems to be redundant at the moment, but it seems prudent to
make sure this does not break. Having two WikiPage instances may
cause subtle problems, such as redundant parsing of content during
edits.

Bug: T205369
Change-Id: I8dd3235ec395fa8772ad810f8b09a098a940ab0c
2018-11-16 09:30:12 +00:00
Roan Kattouw
6d4b92f930 EditPage: Add returntoquery parameter to anoneditwarning links
It's important to send people back not just to the page they were
editing, but to the actual edit action as well.

Bug: T208989
Change-Id: I010145840da1ac93927db846872eaf9843116bd7
2018-11-14 17:08:45 -08:00
LukBukkit
d99700ca82
Wrap the text for out-of-date edits into a warningbox
I'm using the Html util class, because of T166915

Bug: T202248
Change-Id: I073cb5a214da939986a8d7a2a244a04e4dfad1e3
2018-11-12 14:16:32 +01:00
jenkins-bot
ee975d6d1a Merge "Only expand {{...}} in messages once (part 2)" 2018-11-01 17:20:51 +00:00
C. Scott Ananian
24cb939294 Replace deprecated calls to OutputPage::parse()
Use OutputPage::parseAsInterface() to tidy the output and make the
selection of user interface language explicit.

Bug: T198214
Change-Id: Ifeb1ca6eb8b5c743421b8f9e329f1e3658050e47
2018-10-29 15:34:43 -04:00
C. Scott Ananian
873c89fcc4 Only expand {{...}} in messages once (part 2)
If we're going to call `OutputPage::addWikiTextAs*` or
`OutputPage::parseAs*` to parse the message, we don't need to
pre-expand `{{...}}` markup before passing it to the parser.

Follow up to I2f68f73365df876e6f9d017e4e3ddea39c4a1284.

Bug: T206574
Change-Id: I0ee493207ea80c1caba7e60a31714805dc54c64e
2018-10-26 17:09:42 +00:00
jenkins-bot
954b695a85 Merge "Remove old "bulletin board style toolbar" from core" 2018-10-24 05:30:14 +00:00
C. Scott Ananian
ade27ecba3 Use OutputPage::wrapWikiTextAsInterface() to add safe <div> wrappers
This ensures that broken messages can't break the <div> wrapper and
that the output is tidy.

Bug: T205624
Change-Id: I2511adf593a13528e205a82d9fcdc8a524d0a95f
2018-10-17 11:08:16 -04:00
C. Scott Ananian
c0ed262053 Use OutputPage::addWikiTextAsInterface() instead of untidy addWikiText()
This change ensures that the output is tidy, and is necessary to support
future parsers which will not be able to produce untidy output.

Bug: T198214
Change-Id: I743f4185a03403f8d9b9db010ff1ee4e9342e062
2018-10-17 10:35:28 -04:00
James D. Forrester
cfa70ea6d0 Remove old "bulletin board style toolbar" from core
With this change, MediaWiki will no longer have a 'JavaScript-powered'
wikitext toolbar, and instead sysadmins will be required to choose one
(or more) of the several extensions available for this purpose if they
need the functionality. For over half a decade MediaWiki's tarball has
included the 2010-era replacement for this feature, WikiEditor. We are
now working on replacing even that, with the 2013-era visual editor, a
mode of which is the forthcoming 2017-era wikitext editor, and several
more specialised editors like CodeEditor.

Beyond this, the core editor toolbar is ancient, un-loved, and is used
only exceptionally rarely, mostly by accident. It is unhelpful to give
implicitly this as the primary editor for MediaWiki just because we've
not removed it from core when it is not a very good experience for any
kind of user, and has not received the attention that users deserve to
be worth retaining in core.

The old core preference, which was intended to govern whether this old
toolbar should be shown, has since mutated into whether the to run the
EditPageBeforeEditToolbar hook. The hook is used by several extensions
to provide toolbars in lieu of the core one. This preference has been,
in practice, a very confusing preference for MediaWiki users, who have
to interact with quite similar preferences to toggle their real editor
which sit next to this one on the preferences page. Consequently, this
preference is also removed.

The code could be made into an extension for those (very few) users of
MediaWiki who might want to keep on using it. However, the author will
offer their services but not their encouragement in said undertaking.

Bug: T30856
Bug: T32795
Change-Id: I2b05f0ca25873ad8e0b33a5e4938bef52c4e9347
2018-10-16 20:08:32 -07:00
C. Scott Ananian
709e94e05c Only expand {{...}} in messages once
If we're going to call `OutputPage::addWikiText` to parse the message,
we don't need to pre-expand `{{...}}` markup before passing it to the
parser.  This makes these callsites consistent with how
`OutputPage::addWikiMsg()` inserts messages.

Bug: T206574
Change-Id: I2f68f73365df876e6f9d017e4e3ddea39c4a1284
2018-10-11 09:05:05 -04:00
C. Scott Ananian
c54a9912bd Update users of deprecated OutputPage::addWikiText*Tidy() methods
This is a follow-up to Ia58910164baaca608cea3b24333b7d13ed773339 which
added new & improved names for the addWikiText*Tidy() methods.

Bug: T198214
Depends-On: I42d198e6d03afd5b976da741f235c175bfe9f767
Change-Id: I1993c2009e861fdb45c9b1bd42eab1e28a776d9a
2018-10-10 14:54:27 -04:00
Fomafix
1472f02b36 Phabricator: Use Tddddd instead of Bug ddddd in comments
Change-Id: Ic9fe03cab270bd6be738af346164ad5d31a0d780
2018-10-04 09:15:02 +02:00
Timo Tijhof
6dad00ff4c Document some understanding of MessageCache in RawAction/EditPage
Bug: T193271
Change-Id: I8d110dd7b84faf6b1b64553e8088185de5aac7f2
2018-09-29 01:24:33 +00:00
daniel
9da12daf46 Provide a way to restore an old revision with multiple slots.
Bug: T204732
Change-Id: I0ea2711e68c78465a5e5cfaa0181ad5ce983d35a
2018-09-24 19:46:30 +02:00
Umherirrender
a4caa4d0c6 build: Updating mediawiki/mediawiki-codesniffer to 22.0.0
Added spaces around .
Removed empty return statement which are not required
Removed return after phpunit markTestIncomplete,
which is throwing to exit the test, no need for a return

Change-Id: I2c80b965ee52ba09949e70ea9e7adfc58a1d89ce
2018-09-16 15:51:11 +00:00
jenkins-bot
0dafdebb2b Merge "Improve page display title handling for category pages" 2018-09-12 07:25:46 +00:00
Niklas Laxström
d89704bc4c Improve page display title handling for category pages
One use case of display title is to localise page names with Translate
extension or without. While the page title changes, the subheadings still
say something like "Pages in category Foo/de".

Also converted one raw HTML message to be a parsed message.

First version of this patch caused an issue when previewing
because page title in h1 is not the same as page display title.

This issue is fixed by promoting page display title as it's own member
in OutputPage. Also added getUnprefixedDisplayTitle that attempts to
strip away the namespace prefix to mimic Title::getText() but which
works with display title instead.

Bug: T43720
Bug: T46197
Change-Id: I6097a873297eb57759252fc56ad6d02c44e4c366
2018-09-10 08:29:48 +02:00
daniel
465954aa23 Provide new, unsaved revision to PST to fix magic words.
This injects the new, unsaved RevisionRecord object into the Parser used
for Pre-Save Transform, and sets the user and timestamp on that revision,
to allow {{subst:REVISIONUSER}} and {{subst:REVISIONTIMESTAMP}} to function.

Bug: T203583
Change-Id: I31a97d0168ac22346b2dad6b88bf7f6f8a0dd9d0
2018-09-06 18:33:44 +02:00
Zoranzoki21
1f2e9c1b54 Fix common typos in code
Bug: T201491
Change-Id: Id962b79f2590c51380cb977e727b7548abc11d33
2018-09-02 09:03:07 +00:00
jenkins-bot
fede766fe9 Merge "Fix some warnings from phan-taint-check" 2018-08-30 02:54:03 +00:00
jenkins-bot
f7b7d9400d Merge "EditPage: Allow summary=0 in URL parameter" 2018-08-30 02:43:59 +00:00
Brad Jorsch
a9033efb28 MCR: Add temporary web UI mcrundo action
Since SDC doesn't actually require the edit form to handle multi-slot
editing, updating EditPage with its normal undo handling is being put
off for later. But in the mean time we still want some sort of "undo" to
work, hence this mcrundo that doesn't allow for editing.

Bug: T200216
Change-Id: I1f11d8ed141cb11576d2df883856d03e8f64bd38
Depends-On: Iedd9bf6c057e8b396a575bab700b15bd38b32cc9
2018-08-23 16:15:14 +00:00
Fomafix
a4c791b720 EditPage: Allow summary=0 in URL parameter
In PHP is '0' == false.

Bug: T202317
Change-Id: I855c6297750f7d989e69ed492f8e522e540a6a9c
2018-08-20 21:12:35 +02:00
petarpetkovic
39e5d8d843 Fix spelling of word "necessary"
Bug: T201491
Change-Id: Ic983889a5702b8b8552c88ebc4d676f35e9fe61e
2018-08-16 01:35:35 +02:00
Brian Wolff
f631c16e84 Fix some warnings from phan-taint-check
Change-Id: I58af7bc21f4c6b77dbda689faa904b53705fe576
2018-08-13 23:00:06 +00:00
jenkins-bot
fe25fde55b Merge "Add type hint for ParserOutput" 2018-08-12 07:03:19 +00:00
Aryeh Gregor
90d4f56fe4 Mass conversion of $wgContLang to service
Brought to you by vim macros.

Bug: T200246
Change-Id: I79e919f4553e3bd3eb714073fed7a43051b4fb2a
2018-08-11 22:44:29 -06:00
Timo Tijhof
fb997e1389 EditPage: Declare 'mediawiki.toolbar' needed for inline script
Switch from passing a plain function to RLQ that calls depends
on using() from 'mediawiki.base' and 'jquery', to using the new
array format introduced in Ica7bb9c3bdb (T192623).

This ensures the code will keep after we change the fact that
RLQ is blocked by base modules.

Bug: T192623
Change-Id: Id50e6dcc28c13b021d8395a2da0d83b46f88e18c
2018-08-07 19:49:15 +01:00
Adam Wight
43efaf2f3f Give a bit of love to EditPage docstrings
Change-Id: I9dea576f0cf5ba0ffe1cfba81bfe519e2ae19eeb
2018-08-04 09:07:55 +00:00
Fomafix
6a022c8d20 Add type hint for ParserOutput
EditPage::getPreviewLimitReport is called by EditPage::showEditForm
with $output = null. Specify this in the @param tag and allow this by a
default value.

Change-Id: Iec8905aab736a1f254a57853c7cab935d008653e
2018-07-30 09:23:59 +02:00
Reedy
a075271157 Update composer/spdx-licenses to 1.4.0 and mediawiki/mediawiki-codesniffer to 21.0.0
https://github.com/composer/spdx-licenses/compare/1.3.0...1.4.0

Change-Id: I39f7a1310455159866bfed5224536e800befec0d
2018-07-26 17:44:28 +00:00
Daniel Kinzler
fe504a4772 Revert "Pedantic strict equals."
This reverts commit b24fafd606.

Reason for revert: T199504

The strict comparisons changes semantics when parameters are not set and thus null.

This could be fixed by setting the right defaults when getting parameter values, but needs a closer look. 

Bug: T199504
Change-Id: I7b3e5d4f4d50af6603b3414be099d5bda6571387
2018-07-13 19:27:42 +00:00
Adam Wight
b24fafd606 Pedantic strict equals.
Change-Id: I53b046def3ce44b218490ee2a1f0a77dc27825d7
2018-07-12 19:14:17 +00:00
jenkins-bot
ef97002179 Merge "Simplify PHP by using ?? and ?:" 2018-07-11 09:09:18 +00:00
Fomafix
6866cfec37 Simplify PHP by using ?? and ?:
Also remove not necessary surrounding parentheses.

Change-Id: I0eb5c9c1bdfb09a800258379cdcefb5fd4d3d21c
2018-07-10 20:03:17 +00:00
Umherirrender
130ec2523d Fix PhanTypeMismatchDeclaredParam
Auto fix MediaWiki.Commenting.FunctionComment.DefaultNullTypeParam sniff

Change-Id: I865323fd0295aabd06f3e3c75e0e5043fb31069e
2018-07-07 00:34:30 +00:00
Adam Wight
264b4039b3 Remove outdated transition code
This was a soft transition left over from when "edittime" was the last
form parameter. It has been replaced with an explicit "ultimate" param.

Change-Id: I28767fdf8fab512830fe6e24cacabb598d7cca90
2018-07-05 10:46:19 +00:00
jenkins-bot
712396e716 Merge "Make undo fail if more than just the main slot is affected." 2018-06-23 08:59:37 +00:00
daniel
ef1edcea3c Make undo fail if more than just the main slot is affected.
Bug: T194412
Change-Id: Ifdf9bc9d884844f9ffeb8019d9b13d5737862063
2018-06-22 15:18:41 +02:00
daniel
7732c79f67 Improve documentation of fields in EditPage
This is an attempt to clarify the semantics of several fields
and methods in EditPage that represent some kind of parent or base
revision.

Bug: T197685
Change-Id: I37b3803fc558fecc0c7b0c3cfb4ec93dce6997a5
2018-06-20 12:47:29 +02:00
James D. Forrester
18faa76dcb EditPage::getContextTitle(): Deprecate falling back to $wgTitle
Bug: T176526
Change-Id: I7b692def1695119291b26b2f2d25064af9e621f7
2018-06-14 17:25:15 +02:00
daniel
e8632ab0f6 [MCR] Factor PageUpdater out of WikiPage
This introduces PageUpdater to replace WikiPage::doEditContent,
and DerivedPageDataUpdater, to replace WikiPage::doEditUpdates
and WikiPage::prepareContentForEdit.

See docs/pageupdater.txt for a description of their
functionality.

MCR migration notes:

* The interface of PageUpdater is expected to
remain mostly stable after this patch. Code that has been using
WikiPage::doEditContent can be confidently migrated to using the
new mechanism for revision creation.

* This patch keeps the code inside PageUpdater largely aligned
with the old code in WikiPage, to make review easier to to avoid
mistakes. It is intended to be refactored further, moving
application logic into stateless services.

* DerivedPageDataUpdate is intended as a stepping stone for further
refactoring. Its behavior is designed to be compatible with
callback code that currently relies on
WikiPage::prepareContentForEdit. Much of the code that currently
lives in DerivedPageDataUpdate should be factored out into
services, all behavior relevant to calling code should be exposed
via narrow interfaces.

Bug: T174038
Bug: T196653
Change-Id: If610c68f4912e89af616cdcac1d35a1be3946afa
2018-06-14 13:22:13 +00:00
jenkins-bot
6fdfad6ddd Merge "Remove deprecated hook EditPageBeforeEditChecks" 2018-06-11 23:53:58 +00:00