Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Paste
P1839
PhabricatorBotFeedNotificationHandler dirty patch to support filtering by projects
Active
Public
Actions
Authored by
srijan
on Aug 5 2015, 6:21 PM.
Edit Paste
Archive Paste
View Raw File
Subscribe
Mute Notifications
Award Token
Flag For Later
Tags
None
Referenced Files
F691183: PhabricatorBotFeedNotificationHandler dirty patch to support filtering by projects
Aug 5 2015, 6:21 PM
2015-08-05 18:21:19 (UTC+0)
Subscribers
None
diff --git a/src/infrastructure/daemon/bot/handler/PhabricatorBotFeedNotificationHandler.php b/src/infrastructure/daemon/bot/handler/PhabricatorBotFeedNotificationHandler.php
index 21eadf1..a058789 100644
--- a/src/infrastructure/daemon/bot/handler/PhabricatorBotFeedNotificationHandler.php
+++ b/src/infrastructure/daemon/bot/handler/PhabricatorBotFeedNotificationHandler.php
@@ -17,12 +17,31 @@ final class PhabricatorBotFeedNotificationHandler
$show = $this->getConfig('notification.types');
+ $projects = $this->getConfig('notification.projects');
+
+ $obj_type = phid_get_type($story_objectphid);
if ($show) {
- $obj_type = phid_get_type($story_objectphid);
if (!in_array(strtolower($obj_type), $show)) {
return false;
}
}
+ if ($projects) {
+ if ($obj_type == 'TASK') {
+ $api_parameters = array(
+ 'phids' => array(
+ $story_objectphid
+ ),
+ 'projectPHIDs' => $projects
+ );
+ $objects = $this->getConduit()->callMethodSynchronous(
+ 'maniphest.query',
+ $api_parameters
+ );
+ if(empty($objects)) {
+ return false;
+ }
+ }
+ }
$verbosity = $this->getConfig('notification.verbosity', 3);
@@ -125,12 +144,12 @@ final class PhabricatorBotFeedNotificationHandler
'feed.query',
array(
'limit' => $config_page_size,
- 'after' => $chrono_key_cursor,
+ 'before' => $chrono_key_cursor,
'view' => 'text',
));
foreach ($stories as $story) {
- if ($story['chronologicalKey'] == $last_seen_chrono_key) {
+ if ($story['chronologicalKey'] <= $last_seen_chrono_key) {
// Caught up on feed
return;
}
@@ -161,7 +180,7 @@ final class PhabricatorBotFeedNotificationHandler
$message .= ' '.$objects[$story['objectPHID']]['uri'];
}
- $channels = $this->getConfig('join');
+ $channels = $this->getConfig('notification.channels');
foreach ($channels as $channel_name) {
$channel = id(new PhabricatorBotChannel())
Event Timeline
srijan
edited the content of this paste.
(Show Details)
Aug 5 2015, 6:21 PM
2015-08-05 18:21:19 (UTC+0)
srijan
changed the title of this paste from untitled to
PhabricatorBotFeedNotificationHandler dirty patch to support filtering by projects
.
srijan
updated the paste's language from
autodetect
to
diff
.
srijan
changed the edit policy from "All Users" to "
srijan (Srijan Choudhary)
".
Log In to Comment