Skip to content

Commit 562e06b

Browse files
author
Nyo
authored
Handle expiry for temporary accounts in twinkleblock.js
Automatically adjust block duration for temporary accounts.
1 parent 681fa1f commit 562e06b

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

modules/twinkleblock.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,10 @@ Twinkle.block.processUserInfo = function twinkleblockProcessUserInfo(data, fn) {
195195
Twinkle.block.userIsBot = !!userinfo.groupmemberships && userinfo.groupmemberships.map(function(e) {
196196
return e.group;
197197
}).indexOf('bot') !== -1;
198+
Twinkle.block.isTemporary = /^~/.test(userinfo.name);
198199
} else {
199200
Twinkle.block.userIsBot = false;
201+
Twinkle.block.isTemporary = false;
200202
}
201203

202204
if (blockinfo) {
@@ -1345,6 +1347,10 @@ Twinkle.block.callback.evaluate = function twinkleblockCallbackEvaluate(e) {
13451347
return alert('Geef een blokkadeduur!');
13461348
} else if (Morebits.string.isInfinity(blockoptions.expiry) && !Twinkle.block.isRegistered) {
13471349
return alert('Een IP-adres kan niet voor onbepaalde tijd geblokkeerd worden!');
1350+
} else if (Morebits.string.isInfinity(blockoptions.expiry) && Twinkle.block.isTemporary) {
1351+
blockoptions.expiry = '90 days';
1352+
templateoptions.expiry = '90 days';
1353+
alert('Blokkadeduur voor tijdelijk account is automatisch aangepast van onbepaalde tijd naar 90 dagen.');
13481354
}
13491355
if (!blockoptions.reason) {
13501356
return alert('Geef een rede voor de blokkade!');

0 commit comments

Comments
 (0)