jenkins-bot has submitted this change and it was merged.

Change subject: If the local user has the bot userright, mark the edit as bot.
......................................................................


If the local user has the bot userright, mark the edit as bot.

In I0fbe0646, I submitted a patch that fixed this for the publishInOtherWiki
function. This patchset addresses the publishHere function,
which is used for notifications on the same wiki as the translation
(e.g. Meta translation notified on Meta user talk).

The function now checks if the user has the "bot" right, and if so modify the
bitflags to include EDIT_FORCE_BOT. We could theoretically add the flag even
if the user did not have the "bot" right, but this allows the local wiki to
choose whether they want it marked as a bot or not.

The user receiving the message will always get the new notifications message
since EDIT_FORCE_BOT and EDIT_MINOR will never both be set.

Bug: 41637
Change-Id: I68202241fd83b652fe5fc2cf33f5080ec5961d2f
---
M TranslationNotificationJob.php
1 file changed, 6 insertions(+), 1 deletion(-)

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



diff --git a/TranslationNotificationJob.php b/TranslationNotificationJob.php
index ee857d6..e28e23d 100644
--- a/TranslationNotificationJob.php
+++ b/TranslationNotificationJob.php
@@ -61,12 +61,17 @@
                }
 
                global $wgNotificationUsername;
+               $user = User::newFromName( $wgNotificationUsername );
+               if ( $user->isAllowed( 'bot' ) ) {
+                       $flags = $flags | EDIT_FORCE_BOT; // If the user has 
the bot right, mark edit as bot
+               }
+
                $status = $talkPage->doEditContent(
                        ContentHandler::makeContent( $text, $this->title ),
                        $this->params['editSummary'],
                        $flags,
                        false,
-                       User::newFromName( $wgNotificationUsername )
+                       $user
                );
 
                return $status->isGood();

-- 
To view, visit https://gerrit.wikimedia.org/r/73918
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I68202241fd83b652fe5fc2cf33f5080ec5961d2f
Gerrit-PatchSet: 5
Gerrit-Project: mediawiki/extensions/TranslationNotifications
Gerrit-Branch: master
Gerrit-Owner: Legoktm <[email protected]>
Gerrit-Reviewer: Nikerabbit <[email protected]>
Gerrit-Reviewer: Ori.livneh <[email protected]>
Gerrit-Reviewer: Siebrand <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to