jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/674578 )

Change subject: [cleanup] use revisions instead of deprecated getLatestEditors
......................................................................

[cleanup] use revisions instead of deprecated getLatestEditors

- replace getLatestEditors with list(revisions)
- use len(history) instead comparing timestamps
- second_text is set previously; no need to set it to False
- remove return statement at the end of the block

Change-Id: I136b68986fb4a24f1a131283b56d671d3b594747
---
M scripts/checkimages.py
1 file changed, 6 insertions(+), 11 deletions(-)

Approvals:
  Huji: Looks good to me, but someone else must approve
  Xqt: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/scripts/checkimages.py b/scripts/checkimages.py
index cde33f7..cc6a476 100755
--- a/scripts/checkimages.py
+++ b/scripts/checkimages.py
@@ -652,26 +652,24 @@
         emailPageName = i18n.translate(self.site, emailPageWithText)
         emailSubj = i18n.translate(self.site, emailSubject)
         if self.notification2:
-            self.notification2 = self.notification2 % self.image_to_report
+            self.notification2 %= self.image_to_report
         else:
             self.notification2 = self.notification
-        second_text = False

+        second_text = False
         # Getting the talk page's history, to check if there is another
         # advise...
         try:
             testoattuale = self.talk_page.get()
-            history = self.talk_page.getLatestEditors(limit=10)
+            history = list(self.talk_page.revisions(total=10))
             latest_user = history[0]['user']
             pywikibot.output(
                 'The latest user that has written something is: '
                 + latest_user)
-            if latest_user in self.bots:
+            # A block to prevent the second message if the bot also
+            # welcomed users...
+            if latest_user in self.bots and len(history) > 1:
                 second_text = True
-                # A block to prevent the second message if the bot also
-                # welcomed users...
-                if history[0]['timestamp'] == history[-1]['timestamp']:
-                    second_text = False
         except pywikibot.IsRedirectPage:
             pywikibot.output(
                 'The user talk is a redirect, trying to get the right talk...')
@@ -679,11 +677,9 @@
                 self.talk_page = self.talk_page.getRedirectTarget()
                 testoattuale = self.talk_page.get()
             except pywikibot.NoPage:
-                second_text = False
                 testoattuale = i18n.translate(self.site, empty)
         except pywikibot.NoPage:
             pywikibot.output('The user page is blank')
-            second_text = False
             testoattuale = i18n.translate(self.site, empty)

         if self.commTalk:
@@ -725,7 +721,6 @@
                     emailClass.send_email(emailSubj, text_to_send)
                 except NotEmailableError:
                     pywikibot.output('User is not mailable, aborted')
-                    return

     def regexGenerator(self, regexp, textrun) -> Generator[pywikibot.FilePage,
                                                            None, None]:

--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/674578
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.wikimedia.org/r/settings

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I136b68986fb4a24f1a131283b56d671d3b594747
Gerrit-Change-Number: 674578
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt <[email protected]>
Gerrit-Reviewer: D3r1ck01 <[email protected]>
Gerrit-Reviewer: Huji <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
_______________________________________________
Pywikibot-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikibot-commits

Reply via email to