Commit graph

364 commits

Author SHA1 Message Date
jenkins-bot
8d2bdc20c2 Merge "Specify DB to query when checking if a user is blocked from a page" 2021-08-26 17:43:34 +00:00
Daimona Eaytoy
f1978dbd73 Build the page deletion form in DeleteAction, not Article
This is the first patch in that direction, and for now, the code is
**only moved** with minimal changes, to keep the diff small and make it
easier to review. More patches will be sent to clean up this code,
before moving parts of it to a separate service.

Article::delete() and friends were hard-deprecated, given the lack of
callers according to codesearch (searched in "Everything").

The logic for varying the form depending on the page type is also being
moved to DeleteAction, which means there's currently no way for
extensions to customize that (and I couldn't find any extension doing
that at the moment). Should we need this behaviour, we could add a hook to
DeleteAction to allow altering the form.

Bug: T288282

Change-Id: I34525cf3e7c9a82032101b8c2e7b14d6dff59092
2021-08-16 13:02:47 +02:00
Taavi Väänänen
26e32a70a0
Include mediawiki.actions.styles with patrol link
Always add the RL module when the patrolling link is shown.

Bug: T288799
Change-Id: Id0baeb88a080ecf9bdcb075edda3bf609a12e679
2021-08-14 12:17:47 +03:00
Ppchelko
759642ec1e Revert "Build the page deletion form in DeleteAction, not Article"
This reverts commit 2644eba483.

Reason for revert: breaking changes without deprecation. 

Change-Id: I52b843bdd82fc9038504fb7258c3e324e58a1b8e
2021-08-13 14:38:24 +00:00
Daimona Eaytoy
2644eba483 Build the page deletion form in DeleteAction, not Article
This is the first patch in that direction, and for now, the code is
**only moved** with minimal changes, to keep the diff small and make it
easier to review. More patches will be sent to clean up this code,
before moving parts of it to a separate service.

Article::delete() is being removed since there's going to be no
reasonable way to maintain BC, and it's also unused (which I think is
expected, given how many things that method would do).

The logic for varying the form depending on the page type is also being
moved to DeleteAction, which means there's currently no way for
extensions to customize that (and I couldn't find any extension doing
that at the moment). Should we need this behaviour, we could add a hook to
DeleteAction to allow altering the form.

Bug: T288282
Change-Id: Iadb8137d728f4fd4e749a1052f8aef4bab11ec09
2021-08-12 15:48:47 -04:00
Petr Pchelko
c563798b51 Remove hard-deprecated Article::getContentObject
Change-Id: I31eb3cc5574391c9e35d57ac5b2fc83e12f5a1bc
2021-08-12 11:32:28 -07: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
Petr Pchelko
0d75fdb4f7 Use CsrfTokenSet as CSRF token source
Change-Id: I079d2c802d9b48d6abf7f37fa9ef7dafac631345
2021-07-12 14:19:15 -07:00
Roman Stolar
6ebaa5caf6 Remove the fallback for create rights (covered in PM edit rights check).
Remove key to i18n message, no longer being used.

Bug: T272079
Change-Id: Id6566e5241b06ba377c2eca083221ee02556365f
2021-06-30 17:30:30 +03:00
DannyS712
47d70dbfba Post Revision-removal cleanup
Updates for the removal of the Revision class itself
and the various methods/hooks/variables removed in the
process, including:

- Update some documentation removing most references
to the Revision class and updating the MCR migration
notes to reflect the past tense for Revision methods.

- Change some capitalization from "Revision" to "revision"
to make it clear comments are about revisions in general,
not the Revision class in particular.

- Minor code tweaks including removing unused variables that
were around for the old hooks that were removed, and
removing the use of DeprecatablePropertyArray where no
longer needed for anything.

- Fix incorrect documentation for PageUpdater::getStatus(),
the status value changed a while ago to have revision-record
in addition to revision, and recently to only have the
revision-record, but ironically PageUpdater was never updated.

- Removed Parser::$mRevisionObject, used to be a Revision object
and was deprecated in 1.35, missed earlier because it was no
longer being set to Revision objects, always null.

- Add RevisionRecord typehints in DummyLinker to match those
in the corresponding Linker methods

This should be a no-op in terms of functionality.

Bug: T247143
Change-Id: I03bbb94fc29085855448780b1a5ad9063911ecc4
2021-06-24 00:32:39 +00:00
jenkins-bot
3d487a3b89 Merge "Replace easy usages of User for UserIdentity/Authority" 2021-06-11 11:56:46 +00:00
Petr Pchelko
6a8a786599 Replace easy usages of User for UserIdentity/Authority
Change-Id: Id176ee0fab64707020ac6c47a087ef00f8bed4e3
2021-06-09 07:53:52 -07:00
Petr Pchelko
92564edc7c Use Message::page instead of Message::title
Also modified new APIs added to ApiErrorFormatter to
use PageReference instead of Title.

Change-Id: I093c89f8e1e6d383603f887358be6ece70f23a02
2021-06-09 13:18:22 +00:00
Petr Pchelko
8f644e7b9b Remove some User typehints that are just passthrough
Change-Id: I7183998df9e76c107d46efe17bde0491b500cc62
2021-06-02 20:41:30 -07:00
Roman Stolar
dbe594a3ce Replace RecentChange::getPerformer with RecentChange::getPerformerIdentity
Preparing replace in core (DifferenceEngine.php, Article.php, ChangesListSpecialPage.php)

Bug: T276412
Change-Id: I4fd9cbd9404879d082179b68a9993e7203e43a8d
2021-05-27 11:45:17 +03:00
Thalia
23b9b9c61b Specify DB to query when checking if a user is blocked from a page
When calling PermissionManager::isBlockedFrom, don't query the
primary database when only showing UI elements.

Bug: T283268
Change-Id: I9a79badf8a7cfb6afc7b4d12e4f1fbb5c24b6a86
2021-05-24 16:22:17 +01:00
Marius Hoch
754132a4a3 Article: Use correct timestamp for OutputPage::setRevisionTimestamp
Instead of always (except when reading from ParserCache),
using the latest version.
This can also clearly be seen by visiting an old revision on
Wikipedia (https://en.wikipedia.org/w/index.php?oldid=N)
and looking for "This page was last edited on …". When first
loading the old revision, the TS of the last rev will be shown,
upon reloading, the correct time will be shown (as the output
is fetched from parser cache).

This reverts the test removals from I83a43d651.

Bug: T282648
Change-Id: I517d4970d5c682489f27a65ba01ee30db9c62276
2021-05-12 15:22:35 +02:00
jenkins-bot
d8765841c8 Merge "Article::generateContentOutput: Ensure OutputPage has rev id set" 2021-05-12 00:44:27 +00:00
Marius Hoch
929dbef76d Article::generateContentOutput: Ensure OutputPage has rev id set
This should not default to latest revision id, but
Article::getRevIdFetched() if the ParserCache doesn't
have the id set. Also set the revision id before calling
OutputPage::addParserOutput to make sure the id is
already set when the "OutputPageBeforeHTML" hook is run
(which is the case in other code paths).

Additionally I've made the tests more robust, by no
longer manually getting the revision into parser cache.

Bug: T281587
Change-Id: I999195441f9d75a7e4bde4d843ad7729cdb1bee0
2021-05-11 21:33:12 +02:00
daniel
753b1bcaff Introduce Block interface and replace AbstractBlock.
In order to allow Authority to know about user blocks,
we need a narrow interface to represent such blocks.

This deprecates some methods on AbstractBlocks in favor
of new methods on the Block interface that avoid binding to
the User class.

Bug: T271494
Change-Id: I7bb950533970984a014de0434518fbbefb695131
2021-05-11 11:36:11 +02:00
DannyS712
c0dd682544 Start removing places using Revision objects
- EditPage::$mBaseRevision
- EditPage::getBaseRevision()
- Title::getFirstRevision()
- LinksUpdate::setRevision()
- LinksUpdate::getRevision()
- Article::$mRevision
- Article::getRevisionFetched()
- WikiPage::getOldestRevision()
- WikiPage::getRevision()
- ContribsPager::tryToCreateValidRevision()

To make things easier, instead of rewritting
the Revision tests that were using WikiPage::getRevision,
just delete them, its not worth the effort to rewrite
them since the class is going away. For the WikiPage
tests, replace uses of getRevision with getRevisionRecord,
manually converting to a Revision object where needed

Bug: T247143
Change-Id: I52bc1f49649f8bd25797e3f7a090bec9c63ac2d1
2021-04-30 12:33:15 -07:00
vladshapik
9cc797695b Hard deprecate User ::isIP, ::getOptions
Bug: T275602
Change-Id: Id4be13751ca0a900e51214c1855a4624077a5a62
2021-04-26 16:10:24 +00:00
Cindy Cicalese
fb6b6e058c Fix parameter order of setWatch to match add/removeWatch
Change-Id: I0ea63482a5cab24c23b49b8bbe6c80bdbe8b102b
2021-04-21 04:41:38 +00:00
Cindy Cicalese
a384acffa7 Use WatchlistManager in several classes
Change-Id: I720629e08373736b5fc1e12563b5059311b113e1
2021-04-21 00:37:40 -04:00
mainframe98
ddbf011257 Move most remaining legacy styles to interface.helpers.styles
This module is used almost everywhere these elements are found.
Methods in Linker that produce these elements list that this module
is required for proper styling.

Where possible, the module is added to retain the styles.

Bug: T278576
Change-Id: I7dedebd3bce3b4aec127738edc81b180325f0836
2021-04-20 07:15:25 +00:00
Reedy
fb771021ea Use some more neutral language
Bug: T277987
Change-Id: Ieceb01f7a61693a0f03cc331213cb8f93163b8e9
2021-04-18 16:49:36 +01:00
mainframe98
a6a051340c Create mediawiki.actions.styles module for misc action styles
These are styles for actions that do not have a dedicated style module.
Given that the amount of css it contains it marginal, creating a
dedicated module for each action would be overkill.

Bug: T278504
Change-Id: Id03c81e7d5ebf179731649aa230def2e8e21ac02
2021-03-31 15:39:51 +00:00
jenkins-bot
e98ae90c02 Merge "Avoid using User::getBoolOption()" 2021-03-28 02:18:21 +00:00
ZabeMath
60606a2986 Avoid using User::getBoolOption()
User::getBoolOption() is deprecated and should be replaced with UserOptionsLookup::getBoolOption()

Bug: T277600
Change-Id: Ife3c721237258d50852bbf764def74657cc70428
2021-03-27 22:51:03 +01:00
Petr Pchelko
cf763fe116 Drop most hard-deprecated methods in Article
Bug: T239975
Change-Id: I6ca9fbaa699d0465a59e86abbf2bca6bbdb69c01
2021-03-24 19:34:41 +00:00
Petr Pchelko
07b63105ec WatchAction:doWatchOrUnwarch - use Authority
Change-Id: If3ed65093ea6db99fbd1314104e530163fb6a46b
2021-03-03 23:25:23 -07:00
Petr Pchelko
af13f8732a Convert Article and ImagePage to Authority
Change-Id: I7cb0f1da105fe155ce5f54b31f7ff763458b93f0
2021-03-02 16:39:12 -07:00
Petr Pchelko
782a46f661 Use Authority for revision audience where possible
Depends-On: I963a79d94b9e39086940a43945def7c8eff1536d
Change-Id: If99d428b391c0eaf61396565af7f38740bef6c4a
2021-02-24 10:56:50 -07:00
C. Scott Ananian
8fe7e1d26a Add new ArticleParserOptions hook
This hook allows discussion tools to toggle a parser option based on
artice title (namespace) and user identity.  In particular, it sets a
flag to generates reply links (a) on talk pages (b) if the user's
preferences opt in to discussion tools.  Other extensions may also
wish to be able to customize article parsing based on title or user.

Change-Id: I883a37fd67108243e7a20683b1a5d59fd0f6e39f
2021-01-05 11:17:32 -05:00
James D. Forrester
abdc94a3da Swap out uses of User->isLoggedIn() with ->isRegistered()
Bug: T270450
Change-Id: I90ff94a553ebae9a4ef97c25c333f067f19c327d
2020-12-22 03:13:37 +00:00
Reedy
d2781d9b5c Cache some context and service variables
Change-Id: I1217d9d5112774bb3ad124605239dcc1705ab2eb
2020-12-20 01:32:07 +00:00
DannyS712
b5e7f210cd SECURITY: Act like users don't exist if hidden from viewer
When viewing Special:Contributions for a hidden user and
a missing user, or the user page of a hidden user and a
missing user, if the viewer cannot see hidden users
the output should be the same for hidden users and
missing users.

To that end
* In OutputPage.php, only set the `wgRelevantUserName` javascript
  variable if the user is not hidden, or the viewer can see hidden
  users
* In Article.php, show the `userpage-userdoesnotexist-view` on user
  pages of hidden users if the viewer cannot see hidden users
* In Skin.php, do not add user-specific sidebar links (contributions,
  logs, mute, etc.) if the user is hidden and the viewer cannot see
  hidden users
* In SpecialContributions.php, stop calling Skin::setRelevantUser
  for non-existing users, so that callers of Skin::getRelevantUser
  can ignore users that are hidden from the viewer without creating
  divergent behavior
* In SpecialContributions.php, for users that do exist but are
  hidden from the viewer, don't show `sp-contributions-footer`,
  but do show `contributions-userdoesnotexist`

Bug: T120883
Change-Id: I83b723402f315447bc4b50992e28620e3daace8f
2020-12-18 00:35:54 +00:00
Petr Pchelko
0eef0a6a3a Article: view from old revision cache - set correct revId.
Bug: T270361
Change-Id: Ice99038df450bb6892a5064b67f3d35f3255267b
2020-12-17 07:22:35 -06:00
jdlrobson
ddb0c53f46 mw-warning class is replaced with warningbox
The styles can be removed as there are no caching implications here
If a skin is loading `legacy` feature or providing its own (e.g
Minerva)

Non-Wikimedia skins loading content but not legacy will lose
styling here, but that will be consistent with other message
boxes in the interface.

Bug: T269797
Change-Id: I5cfa9d83bedd2786d65d835c1f7623b7a61317c4
2020-12-09 13:27:52 -08:00
Petr Pchelko
7cf60852fa Article::view - remove the old subtitle from doOutputFromParserCache.
The method is called from two places:
- For new revision ParserCache, when the subtitle doesn't need
to be applied. That call is protected by !oldid check
- For old revision cache, when subtitle is already applied before
checking the cache. So, no need to set it.

Bug: T269727
Change-Id: Ibec845ccfe43ae2cb4bbe0152c932cb74f3cef4b
2020-12-08 21:52:11 -06:00
Petr Pchelko
9872b627ff Article:view - always try using ParserCache for old revisions.
Bug: T268075
Change-Id: Ie318a6275c1fb5aedff830b72ee838def815e190
2020-12-07 15:18:08 -06:00
jenkins-bot
c0874e2d9e Merge "Article: split view() method." 2020-11-19 17:16:16 +00:00
daniel
acd06b3848 Article: split view() method.
This unrolls the while/switch construct.

Change-Id: Id20e70037b76f94db2e74a10b80218b74f1e22dc
2020-11-18 22:53:00 +00:00
jenkins-bot
a4d2077424 Merge "Drop Article::getEmptyPageParserOutput" 2020-11-18 19:21:15 +00:00
jenkins-bot
d5f44804ad Merge "Drop Article::setParserOptions." 2020-11-18 19:16:22 +00:00
Umherirrender
fb7a930708 Change object to stdClass type hints in page related classes
Change-Id: Ic8a00da5a24b86e1c0d512ecd756012e91c0ca4d
2020-11-18 00:43:59 +01:00
jenkins-bot
9c253febe2 Merge "Remove deprecated content-related fields and methods." 2020-11-16 18:52:45 +00:00
Petr Pchelko
890452301d Drop Article::getEmptyPageParserOutput
The only place where this was used is to show the system
message contents on a missing article page in NS_MEDIAWIKI
namespace, which is much easier done without MessageContent.

The override in ImagePage is a guaranteed no-op, cause we can't
have ImagePage for NS_MEDIAWIKI namespace.

These were the only two places where this method was used across
codesearch.

Change-Id: I9b9be61eaff6d153fbd2381c91c598b3421e5ea2
2020-11-15 08:57:24 -07:00
Petr Pchelko
83d7a4a9a2 Drop Article::setParserOptions.
This is entirely unused anywhere.

Change-Id: I20f2c7f3266ac4e3cec0ed97a1a7415cdceb6265
2020-11-14 22:09:31 -07:00
Petr Pchelko
5a3e7d2028 Remove deprecated content-related fields and methods.
Hard-deprecate getContentObject since it's used in a few
non-wmf extensions. Drop the rest, since they're unused.

Depends-On: Id0a6eab1e31591c5a6b00fe6135b9747afa7f44b
Depends-On: I352dbcc31643567d12ccf1892ce4fee7d5d2f474
Change-Id: I79f590c385402859b26e9b7ea3927f4357abee9f
2020-11-14 08:20:30 -07:00