Page MenuHomePhabricator

MediaWiki:Group-temp.js/.css do not load
Open, Stalled, Needs TriagePublicBUG REPORT

Description

Under the current specs, MediaWiki:Group-*.js and MediaWiki:Group-*.css are the only sitewide, user group–specific modules that intentionally do not load. However, MediaWiki:Group-temp.js and MediaWiki:Group-temp.css also do not load at present, despite the existence of dedicated interface messages (1, 2).
I believe these should load, because:

  • We cannot target temporary users via gadgets-definition (there is no such user right as temp; |rights=temp does not work).
  • Without these group-specific modules, temp-user-targeting scripts would have to be implemented in both Common.js and Mobile.js using identical code.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

Change #1176742 had a related patch set uploaded (by Dragoniez; author: Dragoniez):

[mediawiki/core@master] ResourceLoader: Load group JS for temporary accounts

https://gerrit.wikimedia.org/r/1176742

Dragoniez renamed this task from MediaWiki:Group-temp.js does not load to MediaWiki:Group-temp.js/.css do not load.Aug 10 2025, 8:46 AM
Dragoniez updated the task description. (Show Details)
Dreamy_Jazz subscribed.

Adding our sprint tag to track code review on this. Thanks for the patch!

I would raise is that a user would only be in the temp group after their first edit to the site.

Therefore, anon users who are currently making their first edit would be unaffected by the Group-temp.css and Group-temp.js even if the proposed patch was merged. However, after their first edit they would have a temporary account.

@Dragoniez @Dreamy_Jazz For future reference, could please describe the use case on this task? I.e. what is it that you want to modify or style differently for temp users specifically?

In particular, I'd like to know how that use case was solved in the past before temp users, and, if you see a future in which this wouldn't be needed (i.e. is it working around a shortcoming or desired feature in the software.)

Depending on how things evolve, and what performance improvements/constraints we explore, distinguishing anons from temp users might be harder in the future. Being able to go back to a task like this and understand the problem separately from its current solution, would allow us to then make sure we solve it another way, even if the specific solution may disappear. This keeps ResourceLoader able to evolve and adapt as needed!

@Krinkle I became aware of this issue when I implemented ja:MediaWiki:Group-temp.js following a community discussion.

We wanted to address the issue of users creating multiple temporary accounts, sometimes for abusive purposes, other times simply because they didn’t realize they could continue using an existing temp account. The script displays a confirmation popup when a temp user attempts to log out, and Group-temp.js proved essential for implementing this behaviour and resolving the mismatch where the dedicated interface messages existed but the corresponding site scripts did not load.

Hope this answers your question.

The script displays a confirmation popup when a temp user attempts to log out

I would note that we have plans to implement such a dialog in MediaWiki T378806: Add confirmation step to exit session flow for temp accounts.

Niharika changed the task status from Open to Stalled.Aug 14 2025, 9:43 AM
Niharika subscribed.

@Dragoniez thanks for your effort on this task! We discussed this internally and think it is better to implement the logout confirmation step for all users as outlined in T378806: Add confirmation step to exit session flow for temp accounts. Our team will take on this work (or if you want to - more than happy to support!).

I will mark this task as stalled for now until we have clarity about other use cases which require loading JS and CSS scripts for temp accounts specifically.

@Dragoniez thanks for your effort on this task! We discussed this internally and think it is better to implement the logout confirmation step for all users as outlined in T378806: Add confirmation step to exit session flow for temp accounts. Our team will take on this work (or if you want to - more than happy to support!).

I will mark this task as stalled for now until we have clarity about other use cases which require loading JS and CSS scripts for temp accounts specifically.

Another example is MediaWiki:Blockedtext, the "Appeal on talk page" section should only display to registered users and temporary users but not anonymous users because anonymous users doesn't have their own's talk page and Special:Mytalk of an anonymous user will redirects to login page.

Dragoniez changed the task status from Stalled to In Progress.Sep 10 2025, 7:36 PM

This change would raise server load concerns; hence stalled.

Another example is MediaWiki:Blockedtext, the "Appeal on talk page" section should only display to registered users and temporary users but not anonymous users because anonymous users doesn't have their own's talk page and Special:Mytalk of an anonymous user will redirects to login page.

In your case, I think you should use a Lua module instead to parse $7 for user type. You don’t really need to rely on JS and CSS to achieve that, AFAICT. See e.g. the Util class in https://ja.wikipedia.org/wiki/Module:IP.

Dragoniez changed the task status from In Progress to Stalled.Sep 10 2025, 7:37 PM

Oops

This change would raise server load concerns; hence stalled.

Another example is MediaWiki:Blockedtext, the "Appeal on talk page" section should only display to registered users and temporary users but not anonymous users because anonymous users doesn't have their own's talk page and Special:Mytalk of an anonymous user will redirects to login page.

In your case, I think you should use a Lua module instead to parse $7 for user type. You don’t really need to rely on JS and CSS to achieve that, AFAICT. See e.g. the Util class in https://ja.wikipedia.org/wiki/Module:IP.

A quick and dirty way is using {{#invoke:String|match|<currect user name>|^%d+-%d+-?%d*%d+$|nomatch=}} to match the format of temporary account. But I haven't found a way to get the current user name yet.

A quick and dirty way is using {{#invoke:String|match|<currect user name>|^%d+-%d+-?%d*%d+$|nomatch=}} to match the format of temporary account. But I haven't found a way to get the current user name yet.

{{#ifeq:{{#invoke:String|match|{{REVISIONUSER}}|^~2|nomatch=}}|~2|temp|other}} would do the job. Matching against /^~2/ should be pretty sufficient under the WMF-wiki setup because $wgAutoCreateTempUser['matchPattern'] is defined as ~2$1 in CommonSettings.php#4369.

A quick and dirty way is using {{#invoke:String|match|<currect user name>|^%d+-%d+-?%d*%d+$|nomatch=}} to match the format of temporary account. But I haven't found a way to get the current user name yet.

{{#ifeq:{{#invoke:String|match|{{REVISIONUSER}}|^~2|nomatch=}}|~2|temp|other}} would do the job. Matching against /^~2/ should be pretty sufficient under the WMF-wiki setup because $wgAutoCreateTempUser['matchPattern'] is defined as ~2$1 in CommonSettings.php#4369.

Okay, I used {{#ifeq:{{#invoke:String|match|{{{7|}}}|^~2|nomatch=}}|~2|<div style="margin: 0.1em 0;">|<div class="user-show" style="margin: 0.1em 0;">}}, and the problem seems resolved. The "Appeal on talk page" section will display when a blocked user is a temporary account.

Special:Mytalk of an anonymous user will redirects to login page.

After T398673: Unregistered editors on blocked ranges need a way to interact on-wiki to appeal a block, if IP is blocked but talk page access is enabled, Special:MyTalk will show a page that allow users to create a temporary account and use it to appeal the block.

@Dragoniez thanks for your effort on this task! We discussed this internally and think it is better to implement the logout confirmation step for all users as outlined in T378806: Add confirmation step to exit session flow for temp accounts. Our team will take on this work (or if you want to - more than happy to support!).

I will mark this task as stalled for now until we have clarity about other use cases which require loading JS and CSS scripts for temp accounts specifically.

Another example is MediaWiki:Blockedtext, the "Appeal on talk page" section should only display to registered users and temporary users but not anonymous users because anonymous users doesn't have their own's talk page and Special:Mytalk of an anonymous user will redirects to login page.

See also: T285612: Create parameter(s) to have the blocked message customize based on whether or not talk page access is revoked