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

Slightly improve handling of Scribunto/non-wikitext content models #857

Merged
merged 3 commits into from Mar 4, 2020

Conversation

Amorymeltzer
Copy link
Collaborator

@Amorymeltzer Amorymeltzer commented Feb 19, 2020

1st commit: morebits: lookupCreation won't query content and section unless lookupNonRedirectCreator is provided

PR #710 added the ability for fnLookupCreationSuccess to find the creator of the first non-redirect revision via fnLookupNonRedirectCreator (see also #805) by adding content to the rvprops list as well as rvsection=0. That doesn't work for non-wikitext content models, who will returned a rvnosuchsection error in such cases. Removing content would solve the error, as would rvsection=0, but the actual redirect check (/^\s*#redirect/i) doesn't make sense in those scenarios (e.g. Scribunto, JS, CSS), so there's no really point in even checking.

Instead, only attempt to use content and rvsection if lookupNonRedirectCreator is set. Currently, only AfD and PROD do so, which aligns with how it should be limited.

We could probably just use wgPageContentModel, but in theory the ability to query pages other than the current one, even if the two have different content models, seems useful. In practice, only twinklexfd attempts sch a thing, only for TfD merge nominations (involvedpages), and assumes that the target is in the same namespace as the current page, so Scribunto will match with Scribunto.

2nd commit: xfd/speedy: Watch tagged modules

Uses params.scribunto to check if we're dealing with a /doc subpage or not (easier and more portable than regex testing, etc.), and simply call the watch api. Also removes some collateral with undesired pageobj.setCreateOption('recreate') for non-module taggings. Closes #572; Sorry if you were actively looking at this @DannyS712 and I scooped you, I got thinking after the above.

3rd commit: xfd: Fix tfm preview when namespace is included

@Amorymeltzer Amorymeltzer added this to the March 2020 update milestone Feb 19, 2020
@Amorymeltzer Amorymeltzer changed the title Improve handling of Scribunto/non-wikitext content models Slightly improve some handling of Scribunto/non-wikitext content models Feb 19, 2020
@Amorymeltzer Amorymeltzer changed the title Slightly improve some handling of Scribunto/non-wikitext content models Slightly improve handling of Scribunto/non-wikitext content models Feb 19, 2020
@Amorymeltzer
Copy link
Collaborator Author

Another way of doing the first commit would be to rely on .setLookupNonRedirectCreator(), to toggle on ctx.lookupNonRedirectCreator === false then note that lookupNonRedirectCreator should/must be set to false for all non-wikitext lookups. It's a little more portable and probably makes more sense, and theoretically can cover more cases. The downside is it's theoretically possible that we might have a lookup that could apply to both, and that would rely on toggling setting lookupNonRedirectCreator on wgPageContentModel or the page title like here. Probably better to do that in code rather than the library. Will ponder but I'm leaning toward that idea.

…pNonRedirectCreator is provided

PR wikimedia-gadgets#710 added the ability for `fnLookupCreationSuccess` to find the creator of the first non-redirect revision via `fnLookupNonRedirectCreator` (see also wikimedia-gadgets#805) by adding `content` to the `rvprop`s list as well as `rvsection=0`.  That doesn't work for non-wikitext content models, who will returned a `rvnosuchsection` error in such cases.  Removing `content` would solve the error, as would `rvsection=0`, but the actual redirect check (`/^\s*#redirect/i`) doesn't make sense in those scenarios (e.g. Scribunto, JS, CSS), so there's no really point in even checking.

Instead, only attempt to use `content` and `rvsection` if `lookupNonRedirectCreator` is set.  Currently, only AfD and PROD do so, which aligns with how it should be limited.

We could probably just use `wgPageContentModel`, but in theory the ability to query pages other than the current one, even if the two have different content models, seems useful.  In practice, only `twinklexfd` attempts sch a thing, only for TfD merge nominations (`involvedpages`), and assumes that the target is in the same namespace as the current page, so Scribunto will match with Scribunto.
Uses params.scribunto to check if we're dealing with a /doc subpage or not (easier and more portable than regex testing, etc.), and simply call the `watch` api.  Closes wikimedia-gadgets#572.

Also removes some collateral with undesired `pageobj.setCreateOption('recreate')` for non-module taggings.
@Amorymeltzer
Copy link
Collaborator Author

Now works as I mentioned in #857 (comment)

@Amorymeltzer Amorymeltzer merged commit 712686d into wikimedia-gadgets:master Mar 4, 2020
@Amorymeltzer Amorymeltzer deleted the watchmodules branch March 4, 2020 17:27
Amorymeltzer added a commit to Amorymeltzer/twinkle that referenced this pull request Mar 22, 2020
…placements

Better and more complete way of doing 133d227 (wikimedia-gadgets#857), for both CfD and TfD, as well as some tidying for CfD/S.  Only replaces the current namepsace, which is basically what was being done anyway, but this way it's obvious when we're pigeonholing a page into an incorrect namespace.  For CfD/S, the behavior is basically inverted: instead of removing the namespace then adding it for just the discussion page, this removes it just for the tagging.
Amorymeltzer added a commit to Amorymeltzer/twinkle that referenced this pull request Mar 22, 2020
…placements

Better and more complete way of doing 133d227 (wikimedia-gadgets#857), for both CfD and TfD, as well as some tidying for CfD/S.  Only replaces the current namepsace, which is basically what was being done anyway, but this way it's obvious when we're pigeonholing a page into an incorrect namespace.  For CfD/S, the behavior is basically inverted: instead of removing the namespace then adding it for just the discussion page, this removes it just for the tagging.
Amorymeltzer added a commit to Amorymeltzer/twinkle that referenced this pull request Apr 19, 2020
…placements

Better and more complete way of doing 133d227 (wikimedia-gadgets#857), for both CfD and TfD, as well as some tidying for CfD/S.  Only replaces the current namepsace, which is basically what was being done anyway, but this way it's obvious when we're pigeonholing a page into an incorrect namespace.  For CfD/S, the behavior is basically inverted: instead of removing the namespace then adding it for just the discussion page, this removes it just for the tagging.
Amorymeltzer added a commit to Amorymeltzer/twinkle that referenced this pull request Apr 25, 2020
…placements

Better and more complete way of doing 133d227 (wikimedia-gadgets#857), for both CfD and TfD, as well as some tidying for CfD/S.  Only replaces the current namepsace, which is basically what was being done anyway, but this way it's obvious when we're pigeonholing a page into an incorrect namespace.  For CfD/S, the behavior is basically inverted: instead of removing the namespace then adding it for just the discussion page, this removes it just for the tagging.
wiki-ST47 pushed a commit to wiki-ST47/twinkle that referenced this pull request Sep 2, 2020
…placements

Better and more complete way of doing 133d227 (wikimedia-gadgets#857), for both CfD and TfD, as well as some tidying for CfD/S.  Only replaces the current namepsace, which is basically what was being done anyway, but this way it's obvious when we're pigeonholing a page into an incorrect namespace.  For CfD/S, the behavior is basically inverted: instead of removing the namespace then adding it for just the discussion page, this removes it just for the tagging.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

csd/xfd: Tagging a module doesn't add it to watchlist
1 participant