BryanDavis has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/394356 )

Change subject: !log: only update Phabricator tasks if we are responding in 
channel
......................................................................

!log: only update Phabricator tasks if we are responding in channel

Add a guard condition to stashbot.sal._store_in_es() to prevent
Phabricator task comments from being created. Set this guard condition
to the same value as stashbot.sal.log()'s respond_to_channel flag when
processing log events.

There is a funky edge case for !log messages in #wikimedia-cloud and
These messages are written both to the main SAL for the channel the
message originates in and to the Release Engineering SAL. An unintended
side effect of this double logging was that any Phabricator tasks
mentioned in the log message would get two Stashbot mentions (one for the
original SAL and a second for the RelEng SAL).

Change-Id: I7c078e538440b186f8ce9cf17e5f85cb824859e4
---
M stashbot/sal.py
1 file changed, 3 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/labs/tools/stashbot 
refs/changes/56/394356/1

diff --git a/stashbot/sal.py b/stashbot/sal.py
index 27733b6..7ada76f 100644
--- a/stashbot/sal.py
+++ b/stashbot/sal.py
@@ -130,7 +130,7 @@
                         channel='#wikimedia-releng'
                     )
 
-        self._store_in_es(bang)
+        self._store_in_es(bang, do_phab=respond_to_channel)
 
         if 'wiki' in channel_conf:
             try:
@@ -225,10 +225,11 @@
             self.logger.exception('Exception getting LDAP data for %s', dn)
         return []
 
-    def _store_in_es(self, bang):
+    def _store_in_es(self, bang, do_phab=True):
         """Save a !log message to elasticsearch."""
         ret = self.es.index(index='sal', doc_type='sal', body=bang)
         if (
+            do_phab and
             'phab' in self.config['sal'] and
             'created' in ret and ret['created'] is True
         ):

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7c078e538440b186f8ce9cf17e5f85cb824859e4
Gerrit-PatchSet: 1
Gerrit-Project: labs/tools/stashbot
Gerrit-Branch: master
Gerrit-Owner: BryanDavis <bda...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to