Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for partial blocks #802

Closed
Amorymeltzer opened this issue Jan 13, 2020 · 1 comment · Fixed by #813
Closed

Add support for partial blocks #802

Amorymeltzer opened this issue Jan 13, 2020 · 1 comment · Fixed by #813

Comments

@Amorymeltzer
Copy link
Collaborator

Amorymeltzer commented Jan 13, 2020

The feature is now live nearly everywhere, should we attempt to support it? It's a fair bit different in structure from the current block module, and there's no policy yet in place, but it'd be good to consider it. cc @MusikAnimal as the original author

API-wise, the additional parameters are:

  • partial: 1
  • pagerestrictions
  • namespacerestrictions

Also, it seems allowusertalk must be true for partial blocks unless user talk is a restricted namespace.

Amorymeltzer added a commit to Amorymeltzer/twinkle that referenced this issue Jan 13, 2020
This merely notes whether a user is partially blocked or sitewide blocked in the red message to sysops.  Also notes in a few minor places that the module is for sitewide blocks (wikimedia-gadgets#802).

A query to `list: 'blocks'` without any `bkprop`s defined (as we have here) apparently returns `partial: ''` if the user is partially blocked, and nothing if they're not, so relies on that.
@Amorymeltzer
Copy link
Collaborator Author

This happened rather quickly so there aren't yet any PB-specific templates. I'd imagine we'd need different ones.

Amorymeltzer added a commit that referenced this issue Jan 16, 2020
This merely notes whether a user is partially blocked or sitewide blocked in the red message to sysops.  Also notes in a few minor places that the module is for sitewide blocks (#802).

A query to `list: 'blocks'` without any `bkprop`s defined (as we have here) apparently returns `partial: ''` if the user is partially blocked, and nothing if they're not, so relies on that.
Amorymeltzer added a commit to Amorymeltzer/twinkle that referenced this issue Jan 21, 2020
Closes wikimedia-gadgets#802.

- Move partial field to block options, better place
- Select partial block template and hide article if partial (MA smart as fuck, use pageparam and reasonparam)
- add hidden partial to field (helps build query and preview)
- Build rest of query
- Add defaultToPartialBlocks preference option
- Only show tooltip if partial
- Add checks for no talk editing and noemail/nocreate
- Don't disable partial block button, can add pblock template
- Better previous block log message
- Use a global variable for formatted namespace.  Empty string no good; Morebits.wikipedia.namespacesFriendly previously handled this, removed in wikimedia-gadgets#600

Use select2

This system needs multiple user inputs, which can't be done nicely with chosen (See harvesthq/chosen#166).  Can use select2's tags system.

Can't stop multiselect from showing dropdown:

- the empty string is awful
- minimumResultsForSearch: -1 doesn't work, nor does infinity
- dropdownCss and dropdownCssClass require the full version (https://stackoverflow.com/a/22138303/2521092)
- css stuff applies to both(?) absent the above
- dropdownParent: $form.find('[name=pagerestrictions]') weirdly works (puts it somewhere invisible?) but breaks scrolling without a visual cue
Amorymeltzer added a commit to Amorymeltzer/twinkle that referenced this issue Jan 21, 2020
Closes wikimedia-gadgets#802.

- Move partial field to block options, better place
- Select partial block template and hide article if partial (MA smart as fuck, use pageparam and reasonparam)
- add hidden partial to field (helps build query and preview)
- Build rest of query
- Add defaultToPartialBlocks preference option
- Only show tooltip if partial
- Add checks for no talk editing and noemail/nocreate
- Don't disable partial block button, can add pblock template
- Better previous block log message
- Use a global variable for formatted namespace.  Empty string no good; Morebits.wikipedia.namespacesFriendly previously handled this, removed in wikimedia-gadgets#600

Use select2

This system needs multiple user inputs, which can't be done nicely with chosen (See harvesthq/chosen#166).  Can use select2's tags system.

Can't stop multiselect from showing dropdown:

- the empty string is awful
- minimumResultsForSearch: -1 doesn't work, nor does infinity
- dropdownCss and dropdownCssClass require the full version (https://stackoverflow.com/a/22138303/2521092)
- css stuff applies to both(?) absent the above
- dropdownParent: $form.find('[name=pagerestrictions]') weirdly works (puts it somewhere invisible?) but breaks scrolling without a visual cue
Amorymeltzer added a commit to Amorymeltzer/twinkle that referenced this issue Jan 22, 2020
Closes wikimedia-gadgets#802.

- Move partial field to block options, better place
- Select partial block template and hide article if partial (MA smart as fuck, use pageparam and reasonparam)
- add hidden partial to field (helps build query and preview)
- Build rest of query
- Add defaultToPartialBlocks preference option
- Only show tooltip if partial
- Add checks for no talk editing and noemail/nocreate
- Don't disable partial block button, can add pblock template
- Better previous block log message
- Use a global variable for formatted namespace.  Empty string no good; Morebits.wikipedia.namespacesFriendly previously handled this, removed in wikimedia-gadgets#600

Use select2

This system needs multiple user inputs, which can't be done nicely with chosen (See harvesthq/chosen#166).  Can use select2's tags system.

Can't stop multiselect from showing dropdown:

- the empty string is awful
- minimumResultsForSearch: -1 doesn't work, nor does infinity
- dropdownCss and dropdownCssClass require the full version (https://stackoverflow.com/a/22138303/2521092)
- css stuff applies to both(?) absent the above
- dropdownParent: $form.find('[name=pagerestrictions]') weirdly works (puts it somewhere invisible?) but breaks scrolling without a visual cue
Amorymeltzer added a commit to Amorymeltzer/twinkle that referenced this issue Jan 22, 2020
Closes wikimedia-gadgets#802.

- Move partial field to block options, better place
- Select partial block template and hide article if partial (MA smart as fuck, use pageparam and reasonparam)
- add hidden partial to field (helps build query and preview)
- Build rest of query
- Add defaultToPartialBlocks preference option
- Only show tooltip if partial
- Add checks for no talk editing and noemail/nocreate
- Don't disable partial block button, can add pblock template
- Better previous block log message
- Use a global variable for formatted namespace.  Empty string no good; Morebits.wikipedia.namespacesFriendly previously handled this, removed in wikimedia-gadgets#600

Use select2

This system needs multiple user inputs, which can't be done nicely with chosen (See harvesthq/chosen#166).  Can use select2's tags system.

Can't stop multiselect from showing dropdown:

- the empty string is awful
- minimumResultsForSearch: -1 doesn't work, nor does infinity
- dropdownCss and dropdownCssClass require the full version (https://stackoverflow.com/a/22138303/2521092)
- css stuff applies to both(?) absent the above
- dropdownParent: $form.find('[name=pagerestrictions]') weirdly works (puts it somewhere invisible?) but breaks scrolling without a visual cue
Amorymeltzer added a commit to Amorymeltzer/twinkle that referenced this issue Jan 22, 2020
Closes wikimedia-gadgets#802.

- Move partial field to block options, better place
- Select partial block template and hide article if partial (MA smart as fuck, use pageparam and reasonparam)
- add hidden partial to field (helps build query and preview)
- Build rest of query
- Add defaultToPartialBlocks preference option
- Only show tooltip if partial
- Add checks for no talk editing and noemail/nocreate
- Don't disable partial block button, can add pblock template
- Better previous block log message
- Use a global variable for formatted namespace.  Empty string no good; Morebits.wikipedia.namespacesFriendly previously handled this, removed in wikimedia-gadgets#600

Use select2

This system needs multiple user inputs, which can't be done nicely with chosen (See harvesthq/chosen#166).  Can use select2's tags system.
Amorymeltzer added a commit to Amorymeltzer/twinkle that referenced this issue Jan 24, 2020
Partial blocks (https://phabricator.wikimedia.org/T190350) were turned on following an RfC (https://en.wikipedia.org/wiki/Wikipedia:Requests_for_comment/Partial_blocks), so it's time to support them.  Done so by adding a checkbox that toggles a "partial" status for both the blocking and templating behaviors.

In order to support entering specific pages, the modules needs to support multiple custom user inputs, which can't be done nicely with chosen (See harvesthq/chosen#166).  We can, however, use select2's tags system, recently added in wikimedia-gadgets#812 to make wikimedia-gadgets#692 (warn/xfd) happen.

This is all an active WIP, including the policy (WP:PB) and the/any templates (right now, only {{uw-pblock}}) so a lot of this is likely to be in flux for a while.

Some stray notes:

- Adds a `defaultToPartialBlocks` preference option
- Makes use of a hidden partial item to help build the query (like `reblock`)
- Includes checks to prevent empty entries (T208645])
- Adds jumping boxes for `email`/`accountcreate` when just issuing a partial template
- Will ignore the `email`/`accountcreate` template parameters if there's an `area`
- CSS and select2 tweaks a la wikimedia-gadgets#692
- I've skipped proper processing in `saveFieldset` of the select2 menu items, it's easier to just do `.join('|')` for the query
- This use a variable for formatted namespaces, namely "(Article)" rather than "".  The empty string really is no good here; Morebits.wikipedia.namespacesFriendly previously handled this sort of thing, was removed in wikimedia-gadgets#600.
- Compared to the rest of Twinkle, this is a weird module!  Very different but pretty enjoyable all in all; @MusikAnimal built something really quite elegant here in wikimedia-gadgets#260.

Closes wikimedia-gadgets#802.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant