Page MenuHomePhabricator

67: Store user preferences in a separate personal JS subpage instead of using global.js
Closed, DeclinedPublic

Description

Currently user preferences of GlobalWatchlist are stored in a user's personal global.js on meta-wiki. Preferences can be stored separately in a personal JS subpage. And the GlobalWatchlist can load the script preferences JS file using mw.loader.load or similar method. Twinkle uses the same method and stores user preferences in a separate JS file.
This will allow us to address the following issues.

  • Global.js page are used by users to use the same JS across all SUL Wikimedia wikis. And it could be edited by hand. Inexperienced JS coders might break the settings if they edit it by hand.
  • GlobalWatchlist.js is optimized for mobile. But global modules are not currently loaded in mobile. So mobileusers can not set their preferences unless they set it manually in their minerva.js/mobile.js

Event Timeline

DannyS712 renamed this task from Store user preferences in a separate personal JS subpage instead of using global.js to 67: Store user preferences in a separate personal JS subpage instead of using global.js.Nov 1 2019, 2:43 AM

@Masumrezarock100 at one point, I considered storing them in a JSON page (see https://en.wikipedia.org/wiki/User:DannyS712/Global_watchlist/To_do)

However, I came to the conclusion that requiring an API or loader call each time wasn't necessarily the best idea

I don't see how we can address the second issue if we don't do it this way. Twinkle and some other scripts uses the same method, and I do not see how it would cause any problems. I might be wrong though.

Some questions:

  • Will users need to manually remove the obsolete GW preferences code in their global.js or the script will do that by itself?
  • If it's the latter case, when this action will be triggered? I am guessing when a user tries to update their preferences using the Settings page?

Some questions:

  • Will users need to manually remove the obsolete GW preferences code in their global.js or the script will do that by itself?
  • If it's the latter case, when this action will be triggered? I am guessing when a user tries to update their preferences using the Settings page?

Script automatically will do when updating settings

Some questions:

  • Will users need to manually remove the obsolete GW preferences code in their global.js or the script will do that by itself?
  • If it's the latter case, when this action will be triggered? I am guessing when a user tries to update their preferences using the Settings page?

Script automatically will do when updating settings

So I guess the script will need to remain compatible with Global.js for a while (until all users migrate to the new settings storags system). We'll need to notify users that saving settings in global.js is deprecated and tell them to update their preferences immediately.

Some questions:

  • Will users need to manually remove the obsolete GW preferences code in their global.js or the script will do that by itself?
  • If it's the latter case, when this action will be triggered? I am guessing when a user tries to update their preferences using the Settings page?

Script automatically will do when updating settings

So I guess the script will need to remain compatible with Global.js for a while (until all users migrate to the new settings storags system).

Indeed, just as it was compatible with storing window.GlobalWatchlistSites as an array before moving to an object. If anything, this will be easier - just, when saving, add a null flag to verify that the save was at the new page, and if that flag is not present remove the settings from the old page when saving. It also means that, once the settings are moved, I no longer need to check the pre-existing content of the page, since it will overwrite the whole page

@DannyS712 How about adding a button "Update version" to the Settings page if some changes related to configuration is required? Clicking this button would automatically apply necessary changes related to configuration and deprecated user configs.

@DannyS712 How about adding a button "Update version" to the Settings page if some changes related to configuration is required? Clicking this button would automatically apply necessary changes related to configuration and deprecated user configs.

Maybe, but that would require the old version to know what the new version needs...

Fine by me as long as I can save my preferences in the mobile site.