Page MenuHomePhabricator

D15318.diff
No OneTemporary

D15318.diff

diff --git a/src/infrastructure/daemon/bot/handler/PhabricatorBotObjectNameHandler.php b/src/infrastructure/daemon/bot/handler/PhabricatorBotObjectNameHandler.php
--- a/src/infrastructure/daemon/bot/handler/PhabricatorBotObjectNameHandler.php
+++ b/src/infrastructure/daemon/bot/handler/PhabricatorBotObjectNameHandler.php
@@ -11,9 +11,31 @@
*/
private $recentlyMentioned = array();
+ /**
+ * Checks if the message sender should be shown. The senders ignore list
+ * is stored in the bot configuration, at ignores.objects key.
+ *
+ * @param PhabricatorBotMessage The message sent to the bot
+ * @return bool
+ */
+ private function shouldShowLink(PhabricatorBotMessage $message) {
+ $ignores = $this->getConfig('ignores.objects', []);
+
+ $sender = $message->getSender();
+ if ($sender !== null && in_array($sender->getName(), $ignores)) {
+ return false;
+ }
+
+ return true;
+ }
+
public function receiveMessage(PhabricatorBotMessage $original_message) {
switch ($original_message->getCommand()) {
case 'MESSAGE':
+ if (!$this->shouldShowLink($original_message)) {
+ return false;
+ }
+
$message = $original_message->getBody();
$matches = null;

File Metadata

Mime Type
text/plain
Expires
Tue, Mar 18, 1:50 AM (3 w, 2 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7704835
Default Alt Text
D15318.diff (1 KB)

Event Timeline