mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/DiscussionTools
synced 2024-11-30 19:16:39 +00:00
Migrate cookie hack users to beta feature
Bug: T277783 Change-Id: I455cab2acd0729b1c117b65cc1ede0ad9eb651cf
This commit is contained in:
parent
5938e97250
commit
2352fefb58
|
@ -50,6 +50,7 @@
|
||||||
{
|
{
|
||||||
"name": "config.json",
|
"name": "config.json",
|
||||||
"config": {
|
"config": {
|
||||||
|
"beta": "DiscussionToolsBeta",
|
||||||
"enable": "DiscussionToolsEnable"
|
"enable": "DiscussionToolsEnable"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -30,6 +30,15 @@ if ( uri.query.dtdebug ) {
|
||||||
// so reply links are added on the server.
|
// so reply links are added on the server.
|
||||||
if ( !config.enable && !uri.query.dtenable ) {
|
if ( !config.enable && !uri.query.dtenable ) {
|
||||||
mw.cookie.set( 'discussiontools-tempenable', 1 );
|
mw.cookie.set( 'discussiontools-tempenable', 1 );
|
||||||
|
} else if ( config.enable && config.beta && mw.cookie.get( 'discussiontools-tempenable' ) ) {
|
||||||
|
// If they were using the cookie but we're available as a beta feature now:
|
||||||
|
if ( mw.user.options.get( 'discussiontools-betaenable' ) ) {
|
||||||
|
// Clear the cookie if the beta feature is enabled
|
||||||
|
mw.cookie.set( 'discussiontools-tempenable', null );
|
||||||
|
} else {
|
||||||
|
// Enable the beta feature if it isn't (cookie will be cleared the next time)
|
||||||
|
( new mw.Api() ).saveOption( 'discussiontools-betaenable', 1 );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
|
Loading…
Reference in a new issue