jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/516502 )

Change subject: [bugfix] Allow user with 0 contributions to be welcomed
......................................................................

[bugfix] Allow user with 0 contributions to be welcomed

Also validate option settings for numbers

Bug: T225434
Change-Id: Ia60bea2476a1aeae79729595e7cf87f3e590a7be
---
M scripts/welcome.py
1 file changed, 28 insertions(+), 27 deletions(-)

Approvals:
  Dalba: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/scripts/welcome.py b/scripts/welcome.py
index f36beff..a9f3d7f 100755
--- a/scripts/welcome.py
+++ b/scripts/welcome.py
@@ -783,31 +783,26 @@
         """Check whether the user is to be skipped."""
         if users.isBlocked():
             showStatus(3)
-            pywikibot.output('{} has been blocked!'
-                             .format(users.username))
+            pywikibot.output('{} has been blocked!'.format(users.username))

         elif 'bot' in users.groups():
             showStatus(3)
-            pywikibot.output('{} is a bot!'
-                             .format(users.username))
+            pywikibot.output('{} is a bot!'.format(users.username))

         elif 'bot' in users.username.lower():
             showStatus(3)
             pywikibot.output('{} might be a global bot!'
                              .format(users.username))

-        elif users.editCount() == 0:
-            if not globalvar.quiet:
+        elif users.editCount() < globalvar.attachEditCount:
+            if not users.editCount() == 0:
+                showStatus(1)
+                pywikibot.output('{0} has only {1} contributions.'
+                                 .format(users.username, users.editCount()))
+            elif not globalvar.quiet:
                 showStatus(1)
                 pywikibot.output('{} has no contributions.'
                                  .format(users.username))
-
-        elif users.editCount() < globalvar.attachEditCount:
-            showStatus(1)
-            pywikibot.output('{0} has only {1} contributions.'
-                             .format(users.username,
-                                     users.editCount()))
-
         else:
             return super(WelcomeBot, self).skip_page(users)

@@ -971,17 +966,20 @@
     for arg in pywikibot.handle_args(args):
         arg, _, val = arg.partition(':')
         if arg == '-edit':
-            globalvar.attachEditCount = int(val or pywikibot.input(
-                'After how many edits would you like to welcome new users? '
-                '(0 is allowed)'))
+            globalvar.attachEditCount = int(
+                val if val.isdigit() else pywikibot.input(
+                    'After how many edits would you like to welcome new users?'
+                    ' (0 is allowed)'))
         elif arg == '-timeoffset':
-            globalvar.timeoffset = int(val or pywikibot.input(
-                'Which time offset (in minutes) for new users would you like '
-                'to use?'))
+            globalvar.timeoffset = int(
+                val if val.isdigit() else pywikibot.input(
+                    'Which time offset (in minutes) for new users would you '
+                    'like to use?'))
         elif arg == '-time':
-            globalvar.timeRecur = int(val or pywikibot.input(
-                'For how many seconds would you like to bot to sleep before '
-                'checking again?'))
+            globalvar.timeRecur = int(
+                val if val.isdigit() else pywikibot.input(
+                    'For how many seconds would you like to bot to sleep '
+                    'before checking again?'))
         elif arg == '-offset':
             _handle_offset(val)
         elif arg == '-file':
@@ -993,12 +991,15 @@
                 'Which signature to use?')
             globalvar.defaultSign += timeselected
         elif arg == '-limit':
-            globalvar.queryLimit = int(val or pywikibot.input(
-                'How many of the latest new users would you like to load?'))
+            globalvar.queryLimit = int(
+                val if val.isdigit() else pywikibot.input(
+                    'How many of the latest new users would you like to '
+                    'load?'))
         elif arg == '-numberlog':
-            globalvar.dumpToLog = int(val or pywikibot.input(
-                'After how many welcomed users would you like to update the '
-                'welcome log?'))
+            globalvar.dumpToLog = int(
+                val if val.isdigit() else pywikibot.input(
+                    'After how many welcomed users would you like to update '
+                    'the welcome log?'))
         elif arg in mapping:
             setattr(globalvar, *mapping[arg])
         else:

--
To view, visit https://gerrit.wikimedia.org/r/516502
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.wikimedia.org/r/settings

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ia60bea2476a1aeae79729595e7cf87f3e590a7be
Gerrit-Change-Number: 516502
Gerrit-PatchSet: 4
Gerrit-Owner: Xqt <[email protected]>
Gerrit-Reviewer: D3r1ck01 <[email protected]>
Gerrit-Reviewer: Dalba <[email protected]>
Gerrit-Reviewer: John Vandenberg <[email protected]>
Gerrit-Reviewer: Meno25 <[email protected]>
Gerrit-Reviewer: jenkins-bot (75)
_______________________________________________
Pywikibot-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikibot-commits

Reply via email to