Formalize targets (users and channel) into objects
Summary: Make users/channels/rooms into objects, so we can later sort out stuff like Campfire user IDs, Phabricator vs chat accounts, etc. The only change here is that I removed output buffering from the macro handler. We should move throttling/buffering to adapters instead and have it apply globally. Test Plan: Ran IRC and Campfire bots and interacted with them. Reviewers: indiefan Reviewed By: indiefan CC: aran Differential Revision: https://secure.phabricator.com/D4924
This commit is contained in:
@@ -170,13 +170,13 @@ final class PhabricatorBotObjectNameHandler extends PhabricatorBotHandler {
|
||||
// in public channels, so we avoid spamming the chat over and over
|
||||
// again for discsussions of a specific revision, for example.
|
||||
|
||||
$reply_to = $original_message->getReplyTo();
|
||||
if (empty($this->recentlyMentioned[$reply_to])) {
|
||||
$this->recentlyMentioned[$reply_to] = array();
|
||||
$target_name = $original_message->getTarget()->getName();
|
||||
if (empty($this->recentlyMentioned[$target_name])) {
|
||||
$this->recentlyMentioned[$target_name] = array();
|
||||
}
|
||||
|
||||
$quiet_until = idx(
|
||||
$this->recentlyMentioned[$reply_to],
|
||||
$this->recentlyMentioned[$target_name],
|
||||
$phid,
|
||||
0) + (60 * 10);
|
||||
|
||||
@@ -185,7 +185,7 @@ final class PhabricatorBotObjectNameHandler extends PhabricatorBotHandler {
|
||||
continue;
|
||||
}
|
||||
|
||||
$this->recentlyMentioned[$reply_to][$phid] = time();
|
||||
$this->recentlyMentioned[$target_name][$phid] = time();
|
||||
$this->replyTo($original_message, $description);
|
||||
}
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user