aboutsummaryrefslogtreecommitdiffstats
path: root/resources/src/mediawiki.special.block.js
Commit message (Collapse)AuthorAgeFilesLines
* build: Fix and re-enable eslint rule unicorn/prefer-includesJames D. Forrester2025-03-211-3/+1
| | | | Change-Id: I34bb289e941751ae4722c708511326a2a5431bfc
* eslint: Manually enforce prefer-const on special page JSEd Sanders2024-10-051-1/+1
| | | | Change-Id: Ia5d59fb9acb7e9b38696b61ea206ee7764ab9094
* eslint: Autofix var to let/constEd Sanders2024-09-121-5/+5
| | | | | | | Temporarily disable no-var & prefer-const as resulting errors need to be fixed manually. Change-Id: I6cb62a2c70a4c1fc265a00b1f18af127ac9d5029
* ESLint: Enforce prefer-arrow-callback and autofixEd Sanders2024-06-111-4/+4
| | | | Change-Id: Iddfa574e42e569ac5e2a2b098ad2f11ca80c5955
* mediawiki.special.block: use mw.util.isInfinityMusikAnimal2024-03-311-3/+1
| | | | | Bug: T353389 Change-Id: I9f9bd282c16c1b44efec833278656847e0b6c8c3
* Allow temporary accounts to be blocked with 'hideuser' enabledDreamy Jazz2024-01-221-6/+1
| | | | | | | | | | | | | | | | | | Why: * The ability to block temporary account usernames with 'hideuser' needs to be added so that we can hide the username of temporary accounts in the case of accidental logged out edits by editors. * This brings similar behaviour how IP addresses are hidden on WMF wikis, as the IP addresses are hidden for logged out edits using the suppression tool. Blocking the account with 'hideuser' allows all edits to be hidden plus also prevent further editing using that temporary account. What: * This reverts commit 878602ad970770a3576673f6a804effc33000076. Bug: T355430 Change-Id: I7b38d2bf0155df479a179c69c91cfe1987bd234a
* Disallow hiding temporary users via blocksThalia2023-08-141-1/+6
| | | | | | | | | | | | | Ensure that temporary users cannot have their name hidden via a block. Temporary users are now handled the same as IP users: * SpecialBlock: the option to hide a user is disabled if the target entered is a temporary user name * BlockUser: the option to hide a user cannot be set to true if the target is a temporary user; however a non-hiding block is still made Bug: T343705 Change-Id: I47b2ca55797d4e7d9dc1b61d0368e1269ad0fd3c
* Revert "Update specialblock target text to use usersmultiselect."Func2023-04-171-12/+3
| | | | | | | | | | | This reverts commit 0aa3d208a3cbd66f9c27f280abc529b4d641ee50 and c71406a1ccf322a0a66f4b9551a96b2a4fc18013. Reason for revert: Proper handling of complete input should be done in the CheckUser extension instead of changing the input field type. Bug: T334870 Change-Id: Ic5681b297ba2c4f3603c578d98b058639217645c
* Fix javascript error on Special:Unblock/<user>Umherirrender2023-03-291-7/+14
| | | | | | | | | The target field is hidden and a info field is set on the special page Detect the hidden field and set the watch field based on the raw value, use the OOUI code when the target field is open, when no user is set Bug: T333173 Change-Id: I657447d8d9be9066a2c02e29f526eaedb3ec8663
* mediawiki.special.block.js: Make target widget editable if pre-filled with IPThalia2023-03-271-0/+9
| | | | | Bug: T332994 Change-Id: Id912a5e57d519e3655fd5d70efb6b335108a4477
* mediawiki.special.block.js: Cast target value to stringThalia2023-03-241-1/+1
| | | | | Bug: T332979 Change-Id: Ie4faa0989f3a0fc6b994e5af53a8884f21abeca4
* Merge "specials: Add watch option for userpage to Special:Unblock"jenkins-bot2023-03-171-5/+23
|\
| * specials: Add watch option for userpage to Special:UnblockUmherirrender2023-03-081-5/+23
| | | | | | | | | | | | | | Disable the checkbox for auto blocks and range blocks Bug: T257662 Change-Id: I883c21c4255247dac766ea5e02d7084cec43fabd
* | Update specialblock target text to use usersmultiselect.tsepothoabala2023-03-131-1/+1
|/ | | | | | | - Using usersmultiselect to prevent calling updatingBlockOptions on each key stroke Bug: T324602 Change-Id: I29657f3c76bfa85764387a82151bba31180625ef
* specials: Remove js config var export from Special:BlockUmherirrender2023-01-181-12/+6
| | | | | | | Just check if the widget is part of the html, that is already done for hideuser and watch Change-Id: I92b0943ee12928832dd26aa82ac2e912825c4c7c
* Update Special:Block UISTran2021-09-081-18/+7
| | | | | | | | Adjust UI to be more explicit about which options apply to sitewide vs partial blocks Bug: T280719 Change-Id: I38943124c7f3c1aeb4ea8c9b92971a8f59801205
* Stop resetting partial action block options when values changeSTran2021-05-061-4/+0
| | | | | | | | | | updateBlockOptions() was unchecking all action blocks whenever it was run and it's run any time a value changes. User inputs were being lost if they didn't select actions last. Remove that code from the update function. Bug: T282177 Change-Id: Id06d172afb1998f9bd32ea0b7cb39d42b2e94d11
* Introduce infrastructure for partial blocks for actionsThalia2021-04-271-2/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds a new type of block restriction for actions, which extends AbstractRestriction. Like page and namespace restrictions, action restrictions are stored in the ipblocks_restrictions table. Blockable actions are defined in a BlockActionInfo service, with a method for getting all the blockable actions, getAllBlockActions. Action blocks are checked for in PermissionManager::checkUserBlock using DatabaseBlock::appliesToRight. To make this work, this patch also removes the 'edit' case from AbstractBlock::appliesToRight, which always returned true. This was incorrect, as blocks do not always apply to edit, so cases that called appliesToRight('edit') were fixed before this commit. appliesToRight('edit') now returns null (i.e. unsure), which is correct because it is not possible to determine whether a block applies to editing a particular page without knowing what that page is, and appliesToRight doesn't know that page. There are some flags on sitewide blocks that predate partial blocks, which block particular actions: 'createaccount' and 'sendemail'. These are still handled in AbstractBlock::appliesToRight, and are still checked for separately in the peripheral components. The feature flag $wgEnablePartialActionBlocks must set to true to enable partial action blocks. Bug: T279556 Bug: T6995 Change-Id: I17962bb7c4247a12c722e7bc6bcaf8c36efd8600
* Introduce backend class for blocking usersMartin Urbanec2020-09-221-1/+1
| | | | | | | | | | | | | | Rather than having to do DatabaseBlock calls directly, and then ManualLogEntry calls to facilitate logging, let's create a BlockUser service, capable of blocking users and logging, optionally with permission checking. This should make blocking users easier for developers, for instance, AbuseFilter or CheckUser can easily benefit from this commit. Bug: T189073 Change-Id: Ifdced735b694b85116cb0e43dadbfa8e4cdb8cab
* Remove $wgEnablePartialBlocks config and always enable partial blocksThalia2020-03-041-28/+23
| | | | | Bug: T242912 Change-Id: Icf737140dd112dc4d222274ae40e225cb7a9d3fc
* Remember checkbox state on Special:Block if checkbox disabledThalia2019-07-171-12/+32
| | | | | | | | | | | | | | | Many of the blocking options on Special:Block are only valid for certain inputs. These options are represented with checkboxes. If an option is not valid with the current form inputs, its checkbox is disabled (and not submitted) and it is set to false by default. To make this clear to the user, we uncheck the checkbox when it is disabled. This stores the value of the checkbox before it was disabled and restores it if the checkbox is enabled again. Bug: T221117 Change-Id: I3e52d7c3eb70f2798de3fb5ac3824d56e73306a6
* Fix user talk checkbox enabling/disabling on Special:BlockThalia2019-05-231-7/+10
| | | | | | | | | | | | | Partial blocks ignore the ipb_allow_usertalk field, so the user talk checkbox should be disabled on Special:Block when creating a partial block. The checkbox is already disabled for partial blocks against editing. This also disables the checkbox for partial blocks that do not involve editing. Bug: T224032 Change-Id: I2519ab30a90872d90f05861c65ab943d7937d9fa
* Enable/disable Special:Block widgets according to block parametersThalia2019-04-051-13/+22
| | | | | | | | | Different block options are available depending on the block parameters currently enetered in the form at a given time. Use enable/disable for these options instead of hide/show, and uncheck any disabled options. Bug: T212391 Change-Id: Ie715ae570641ad0af4008b9aa7f9ed8f2cda8fb8
* Simplify checking for widgets on special block pageThalia2019-04-051-54/+58
| | | | | | | | | Certain groups of widgets always exist if the form is loaded, or always exist if partial blocks is enabled. Others depend on certain user rights or config variables. Check these widgets in groups rather than checking for the existence of each one individually. Change-Id: I6950ebc22f4564aadaf6d6acd5ca36534d8b9962
* Fix wpCreateAccount bug when set on Special:Block url paramsDayllan Maza2019-04-031-1/+1
| | | | | | | | wpCreateAccount default is dynamically changed if the user has not posted the form or interacted with the field in any way Bug: T218554 Change-Id: Ied68dc60d57ed35ed3285c5cf89b772c8c4e41d1
* Fix account create checkbox bugDayllan Maza2019-03-201-1/+1
| | | | | | | | | | | | | | | | | | When a block is being created on Special:Block, the "create account" checkbox is checked by default if the block is set to "Sitewide" and unchecked by default if the block is set to "partial". There are multiple scenarios where the checkbox should not check and uncheck according to the type of block. 1.- When editing a block. This means that an admin already saved the the block so we shouldn't mess with the options 2.- After posting the form. An admin was ready to save and it didn't happen for whatever reason. Still we shouldn't mess with the options 3.- After manually clicking the checkbox itself (already working before this patch) Bug: T216845 Change-Id: I39b723d1f638d016c74ec20639efeecac95d8cdd
* Uncheck "create account" on Special:Block for partial blocksThalia2019-02-181-1/+15
| | | | | | | | | | | Set the default state for the checkbox for preventing a user from creating an account to unchecked, if the block is set to partial. However, if the user has already interacted with the checkbox, do not change its state just because the block type changes. Bug: T208510 Change-Id: If17b82b03553810508f22070865719bd1926949d
* Disallow user suppression in a partial blockThalia2019-02-051-5/+11
| | | | | | | | | | | Hide the "hide user" checkbox on Special:Block if the block parameters specify a partial block. Return an error message if a partial block with user suppression is specified via the API. Also, make sure that an existing user suppression is lifted if the user's block is reset to a partial block. Bug: T210002 Change-Id: If42edfc85580d6bad6f4b397517e77e63deecc87
* Add namespace restrictions to Special:Block and APIThalia2019-01-221-9/+23
| | | | | | | | | | | | | | | | | | | | | | This adds a UI for blocking namespaces to Special:Block and a namespacerestrictions parameter to the block API. The number of namespace restrictions in a single block is not limited as page restrictions are. The checkbox allowing the blocker to specify whether the target can edit their own user page is normally disabled for a partial block, but is re-enabled if the block is to the user talk namespace. If the config $wgBlockAllowsUTEdit is set to false, the checkbox will not appear, and the target will not be able to edit their own user talk page if they are sitewide-blocked, namespace-blocked from the user talk namespace, or page-blocked from their user talk page. Bug: T204986 Change-Id: I9e231ad109d7285486ec332b26780339592b8df7
* Simplify boolean logic for Special:Block widgetsThalia2019-01-161-11/+7
| | | | | | | | | | | | The boolean logic controlling the showing/hiding of widgets on Special:Block could be expressed more simply. The logic is becoming more complex due to partial blocks, so now is a good time to rephrase it. This removes safeguards against passing undefined to toggle, so make sure none of the checks ever return undefined. Change-Id: I1e0eb288db708be951fe5cf11f658725a38a7c4d
* Update the design of Special:BlockThalia2019-01-071-3/+9
| | | | | | | | | Update the design now we have the extra options for partial blocks. Bug: T202773 Bug: T212964 Change-Id: I569eb2a8b15b9ad7f9f0e99bce2cd9b818a82fb4
* Add check for editing restriction widget on Special:BlockThalia2019-01-031-1/+3
| | | | | | | | If partial blocks is not enabled, editing restriction widget will not exist, so check before binding events. Bug: T212808 Change-Id: I33fd7efdc24c026338e25d7c0751d31bc9a7baba
* Add new rules when user is blocked for UTPDayllan Maza2018-12-111-0/+12
| | | | | | | | | | | | | No changes for sitewide blocks when "Prevent user... edit own talk page" is checked. On partial blocks, this option will be disabled and ignored. All users will be allowed to edit their own talk page unless a page restriction for their page is in place. New rules will be implemented for Namespace restrictions in a different patch when Namespace blocking is ready. Bug: T210475 Change-Id: I096edf2887441bccd59f09bf0eceb3988b36db1e
* Rewrite infuseOrNull to not suppress useful errorsEd Sanders2018-12-041-12/+11
| | | | | | | | | | | | Wrapping infuse in try/catch suppressed errors about missing dependencies. Instead only return null if the selector is empty. Rename to infuseIfExists for clarity. This exposed some missing dependencies which have been added. Change-Id: I7f6005b983a70f953550216a6483a9fe1e5699dd
* Update Special:Block to set Partial BlocksDavid Barratt2018-10-241-2/+9
| | | | | | | | Make the necessary UI changes to Special:Block in order to set/update partial blocks. Bug: T197109 Change-Id: Ib3067824b5dcbdd893ab1f165d169a35d0716cb2
* resources: Strip '$' and 'mw' from file closuresTimo Tijhof2018-09-141-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Follows-up Id6d13bbea6: - '$': mw.loader.implement does this already. - 'mw': Use the canonical name directly. This replaces the following patterns: File closures (common): - `( function ( $, mw ) {` => `( function () {` - `( function ( $ ) {` => `( function () {` - `( function ( mw ) {` => `( function () {` - `( function ( mw, $ ) {` => `( function () {` File closures (rare): - `( function ( mw, $, OO ) {` => `( function () {` - `( function ( mw, OO, $ ) {` => `( function () {` - `( function ( mw, document ) {` => `( function () {` Combined dom-ready and file closure (rare): - `jQuery( function ( $ ) {` => `$( function () { - `jQuery( function () {` => `$( function () { Remaining references in files without a closure, as found by the new ESLint setting (rare): - `jQuery` => `$` - `mediaWiki` => `mw` Change-Id: I7cf2426cde597259e8c6f3f6f615a1a81a0ca82b
* resources: Give mediawiki.special.* files their own place in src/Timo Tijhof2018-05-111-0/+58
Bug: T193826 Change-Id: Id25cd18079f48308f6ab42207445bbbd74ed5fda