Commit graph

14480 commits

Author SHA1 Message Date
jenkins-bot
e3630b49d0 Merge "Add a test for SelectQueryBuilder::merge caller merging" 2023-07-05 13:47:59 +00:00
jenkins-bot
f74a79dc4f Merge "Migrate several wfGetDB() to use ICP" 2023-07-05 10:50:57 +00:00
Amir Sarabadani
3e157496ff Migrate several wfGetDB() to use ICP
And doing proper dependency injection.

Bug: T330641
Change-Id: I4978c158e513f88f5547343c4fbbe4b39078dc09
2023-07-05 11:00:59 +02:00
jenkins-bot
254c022d55 Merge "Use native assertGreater/LessThan in HandlerTestTrait" 2023-07-04 16:50:14 +00:00
jenkins-bot
a74eaea765 Merge "Add temporary users to a 'temp' group, and stop adding them to 'user'" 2023-07-03 17:05:56 +00:00
thiemowmde
131258cae4 Use native assertGreater/LessThan in HandlerTestTrait
The main benefit is that we can see the actual value, instead of
"expected true".

Change-Id: Ib620348911a9612aa630cb331b2b23b66207d57b
2023-07-03 16:13:58 +02:00
jenkins-bot
e6204467cf Merge "Migrate assertSelect() to SelectQueryBuilder" 2023-07-03 10:52:04 +00:00
Nikolas Nyby
e87316c4a4 Resolve GlobalFunctions phpunit filename deprecation errors
PHPUnit wants the filenames of the tests to match the class name being
tested.

Bug: T337333
Change-Id: Icc450c900b6d4589515d86889403043a5e4ef690
2023-07-01 09:30:42 +00:00
jenkins-bot
4690431357 Merge "Don't report temporary users as belonging to autopromote groups" 2023-06-30 14:19:36 +00:00
Jan Drewniak
2eedee7974 Create mediawiki.tempUserBanner module
Creates a new resourceLoader module which holds the
scripts and styles related to the temp user (IP masking) banner
described in T339379.

The temp user banner includes a tooltip which explains
what temporary accounts are. This is built using OO.ui.PopupWidget
and includes a clock icon and parsed i18n messages.

The Tooltip dependencies are loaded and instantiated on a click event
in order to minimize the dependencies on page load.

Bug: T339379
Change-Id: Ie2631221b0a07dd3bf55e970805d30fbb3cac190
Depends-on: Id5a4a9a00e50420c50868c54f899d36d7ddd373d
Depends-on: Icf622c4be910f5d14de95355efa02c05930179bf
2023-06-30 00:41:46 +00:00
jenkins-bot
79cfad5ee0 Merge "FakeQqxMessageLocalizer: Add @since" 2023-06-29 18:35:26 +00:00
Tim Starling
de2644edcb Add a test for SelectQueryBuilder::merge caller merging
Change-Id: I63a3fdf988dd5e344e409c9ee85c350cbe472e65
2023-06-29 11:36:36 +10:00
Thalia
dd2f898f86 Add temporary users to a 'temp' group, and stop adding them to 'user'
When we first deploy temporary account autocreation, we want temporary
users to resemble anon users more than registered users, for minimal
community impact.

If we add them to the 'user' group, then they will automatically get
whatever rights a wiki currently assigns to registered users. If we
don't, they will only get rights that are currently given to everyone
(same as anons).

Therefore stop adding them to the 'user' group, and instead add them
to a new 'temp' group, in case site admins want to give them extra
rights.

Bug: T340457
Depends-On: I6333fa2289f3142d1b5cedf2cc910ced3ba5019e
Change-Id: Idb46252fe6533ab0a5410bdb3093043cb359c206
2023-06-28 18:22:47 +01:00
Derick Alangi
e076836219 HtmlToContentTransformTest: Ensure individual defaults with options set
Follow-Up: I1fade591e73034e071417d31fbdfff1a83180360
Change-Id: Ie470dddf51407a4c1717ad32bf19f7ef870fc92d
2023-06-28 16:33:58 +03:00
daniel
9338889682 HtmlToContentTransform: define default values for options
It should not be necessary to call setOptions() to perform a
transformation. All options should have defaults defined.

Change-Id: I1fade591e73034e071417d31fbdfff1a83180360
2023-06-28 09:41:43 +00:00
jenkins-bot
29c5b33934 Merge "Catch RevisionAccessException in ParsoidOutputAccess" 2023-06-27 23:25:50 +00:00
Tim Starling
5e665d8cdb Migrate assertSelect() to SelectQueryBuilder
* Add MediaWikiIntegrationTestCase::newSelectQueryBuilder(), which
  creates a subclass of SelectQueryBuilder with assert methods.
* Migrate most callers of assertSelect() to this new query builder
  interface.

Bug: T311866
Change-Id: I7392b37988067020d5f684276320dae0a474631a
2023-06-28 09:03:58 +10:00
Arlo Breault
0f8aac2de8 Catch RevisionAccessException in ParsoidOutputAccess
A shared get content assertion is added to PageConfigFactory::create

Bug: T338925
Bug: T336501
Follows-Up: I647ed253691970bbf39321a3cd652ea14bc11278
Change-Id: Iaf3898e5c53f1673ade639f7990911e4595801a8
2023-06-27 14:04:19 -04:00
jenkins-bot
533472ae16 Merge "HookContainer: don't report handlers twice" 2023-06-27 16:18:30 +00:00
Thalia
827fa65c7f Don't report temporary users as belonging to autopromote groups
Autopromotion was disabled for temporary users in
d6a3b6cfa8. In that commit,
PermissionManager::getUserImplicitGroups, no longer checks autopromote
groups for temporary users, so PermissionManager::getUserPermissions
no longer finds autopromote groups for temporary users.

In this commit, UserGroupManager::getUserAutopromoteGroups no longer
finds autopromote groups for temporary users.

Bug: T340462
Change-Id: I189391bd9a41718648d198b83736d837c76ead52
2023-06-27 16:32:17 +01:00
Thalia
47d8c97460 Fix spelling in UserGroupManagerTest
Change-Id: I59bb85bdae91ee595e19aee30f204f33d4ad1efc
2023-06-27 16:11:01 +01:00
jenkins-bot
ebc21303b2 Merge "Fix unused parameters in assertRecentChangeByCategorization" 2023-06-27 10:30:11 +00:00
jenkins-bot
29a179ee9c Merge "Add User::newQueryBuilder()" 2023-06-27 09:24:31 +00:00
jenkins-bot
15383f611f Merge "Add SelectQueryBuilder::merge() and ::clearFields()" 2023-06-27 08:55:46 +00:00
jenkins-bot
739400eacd Merge "Add a test for SelectQueryBuilder::queryInfo() which demonstrates array merging" 2023-06-27 07:23:38 +00:00
jenkins-bot
ea6e237948 Merge "Add a test for DifferenceEngine::showDiffPage" 2023-06-27 03:14:29 +00:00
Tim Starling
38f760268c Add a test for DifferenceEngine::showDiffPage
An integration test that checks for a regex match on the HTML output.
Achieves 92% coverage of showDiffPage.

Change-Id: I3b2af33257f2326b67ff6f0734aeff0da3b69f43
2023-06-27 12:17:06 +10:00
Tim Starling
361fff633b Fix unused parameters in assertRecentChangeByCategorization
These parameters are unused since 6dedffc2d7

Change-Id: Ib1bbf0289b13f87377eea534730025aafa558fd0
2023-06-27 12:09:04 +10:00
Tim Starling
4edbb29307 Add User::newQueryBuilder()
Replace all core calls to User::getQueryInfo() with an equivalent
SelectQueryBuilder.

Bug: T311866
Change-Id: Ib249a9d9098b1c09907a90607206edd8331bad3d
2023-06-27 11:45:39 +10:00
Tim Starling
b6907d2d9a Add SelectQueryBuilder::merge() and ::clearFields()
Add SelectQueryBuilder::merge(), which is essentially the same as

  $sqb1->queryInfo( $sqb2->getQueryInfo() );

This allows things like User::getQueryInfo() to be replaced with similar
methods that return a pre-configured SelectQueryBuilder for merging into
some larger query.

Add SelectQueryBuilder::clearFields(), which erases the list of fields,
allowing queries to be merged without merging their fields, which is a
common use case.

Change-Id: If1b36acbc6aebec472fa83dd9481295f0648bc61
2023-06-27 11:45:39 +10:00
Tim Starling
aa2eef5ea0 Add a test for SelectQueryBuilder::queryInfo() which demonstrates array merging
Change-Id: I3df2d9ca0130967558f40ec977383e34727770c9
2023-06-27 11:36:39 +10:00
Sam Wilson
ae46eb63d5 Switch back to oo-ui-element-hidden from mw-diff-element-hidden
Using the OOUI class name is an established pattern outside of
OOUI widgets, so it's easier to stick with it for the diff page
hiding and showing (switching to and from inline/table diffs, etc.).

Bug: T324759
Change-Id: I805b6b71d8e137eaa3e000b15455557df42af838
2023-06-26 19:14:41 +08:00
jenkins-bot
7b7f1181d3 Merge "diff: Move SlotDiffRenderer::getTablePrefix() parts assembly up to DifferenceEngine" 2023-06-26 03:13:42 +00:00
Tim Starling
8983c9d862 diff: Move SlotDiffRenderer::getTablePrefix() parts assembly up to DifferenceEngine
getTablePrefix() is used to show the inline legend and inline switcher.
It is not yet part of a released stable interface.

Theoretically there may be multiple text slots on a page, and we don't
want multiple inline legends. There was already a fragment assembly
system, for the benefit of hook handlers, so move that up to the page
level, so that it can also deduplicate prefix fragments coming from
each slot.

Add tests.

Bug: T324759
Change-Id: I9baa5c24128c63bc318ba13e83a024843f4ab15e
2023-06-26 11:28:59 +10:00
jenkins-bot
db8c4b0699 Merge "Improve handling of diffs between incompatible content models" 2023-06-26 01:06:58 +00:00
jenkins-bot
b692451063 Merge "api tests: Call editPage() with WikiPage when used for same page" 2023-06-25 10:47:11 +00:00
Umherirrender
f3885d455e page: Remove deprecated WikiPage::factory/newFromID/newFromRow
Bug: T297688
Change-Id: Idfe97541d838d68ebebd556140e4816044080e66
2023-06-24 18:08:37 +00:00
Umherirrender
ddfcebc584 api tests: Call editPage() with WikiPage when used for same page
When calling editPage() with a string it converts it to a WikiPage each
time it is called. When edit a page only once that is okay,
but when adding more revision to the same page it is better to pass a
WikiPage instead to allow reuse of internal states of WikiPage to speed
up the tests

Bug: T225730
Change-Id: I7a0e7e3e75ade5d6abe8e62a03a029190f3b6da8
2023-06-24 18:07:34 +00:00
Gergő Tisza
a9e0562cfb Improve handling of diffs between incompatible content models
When the old and new content object for a slot cannot be compared,
show an error message for that slot only, instead of throwing an
exception.

Bug: T214217
Change-Id: I6e982df358f85ca78f0448b3a93ded3f40676310
2023-06-23 19:09:59 +00:00
jenkins-bot
36ba74999c Merge "tests: Replace deprecated calls to wfExpandUrl with hard-coded url" 2023-06-23 18:50:18 +00:00
jenkins-bot
7adb12742b Merge "Inline createPageConfig in tryToCreatePageConfig" 2023-06-23 17:46:57 +00:00
James D. Forrester
357f408c13 tests: Replace deprecated calls to wfExpandUrl with hard-coded url
Bug: T319340
Change-Id: Iae13352f0cc902f74eb4c918dbb1a451472b0985
2023-06-23 17:23:18 +00:00
jenkins-bot
571d511ff7 Merge "API: Replace deprecated calls to wfExpandUrl with UrlUtils::expand" 2023-06-23 17:17:28 +00:00
daniel
8f0e07cc93 HookContainer: don't report handlers twice
This fixes a bug in getHandlerDescriptions() that causes the description
of a handler to be returned twice after the handlers for a given hook
were initialized, so the handler would be present both in $this->hooks
as well as in the HookRegistry.

Change-Id: Iac913d96f0f2cdfc72f1f5f006af83691d79d4fe
2023-06-23 18:12:25 +02:00
jenkins-bot
8647f03800 Merge "Convert PageRedirectHandlerTrait to PageRedirectHelper" 2023-06-23 13:05:51 +00:00
Arlo Breault
d8c64f41b7 Inline createPageConfig in tryToCreatePageConfig
Change-Id: If1d62fc75895fc5322a64a1398d2b68e6fde72ac
2023-06-22 21:10:24 -04:00
daniel
63a610b8c7 Deprecate HookContainer::getHandlerCallbacks
There should be no need to call hook handlers directly,
this should only be done by HookContainer.

Change-Id: I8fa46c2eb6a40ad98e564c31dcfb103825608426
2023-06-23 00:26:40 +00:00
jenkins-bot
0cf30bff8a Merge "HookContainer: deprecate old hook handler formats" 2023-06-22 21:07:08 +00:00
James D. Forrester
83d72bc108 API: Replace deprecated calls to wfExpandUrl with UrlUtils::expand
Bug: T319340
Change-Id: Ic987f9381ac17e9e46504abdb2d07a5a94ba3b4a
2023-06-22 16:49:01 -04:00
jenkins-bot
888cf61c8c Merge "Replace IDatabase::delete with DeleteQueryBuilder" 2023-06-22 13:44:46 +00:00