![](/img/trans.png)
[英]Access to the user's reels media feed highlight story (Get all user's stories) by `mgp25/Instagram-API` project
[英]phabricator get commit author from feed story for stories that are concerns , comments and audits
我正在尝试将phabricator与jabber chat集成。 我创建了一个机器人,可以针对每个新的供稿查询通过jabber聊天将消息发送给提交作者。 我的要求是,如果提要故事是一个令人关注,审计或通信的问题,我如何获得提交的原始作者。 我想将提交所引起的任何关注通知提交人。 我是否需要分析故事以获取此信息? 我该怎么做呢?
提前致谢
故事对象应具有一个数据元素,其中应包含有关作者和提交者的信息。 像这样:
"PHID-STRY-spjfpdv4wuigblmh3ygb" : {
"class" : "PhabricatorFeedStoryCommit",
"epoch" : 1409840112,
"authorPHID" : "PHID-USER-tcyihgi43sw6o7yrnhu5",
"chronologicalKey" : "6055220066741547443",
"data" : {
"commitPHID" : "PHID-CMIT-ievqiimtsnlfhlk5imqq",
"summary" : "[blah]",
"authorName" : "Author Name <author_email@example.com>",
"authorPHID" : "PHID-USER-tcyihgi43sw6o7yrnhu5",
"committerName" : "Commiter Name <commiter_email@example.com>",
"committerPHID" : "PHID-USER-tcyihgi43sw6o7yrnhu5"
}
}
如果没有,则应具有一个objectPHID:
"PHID-STRY-mqlkjzwkbr3th4h5n2eg" : {
"class" : "PhabricatorApplicationTransactionFeedStory",
"epoch" : 1409841382,
"authorPHID" : "PHID-USER-2bubef6xonwicvaool4w",
"chronologicalKey" : "6055222630292077307",
"data" : {
"objectPHID" : "PHID-CMIT-is7pmo5nyvv4eruq2msn",
"transactionPHIDs" : [
"PHID-XACT-CMIT-svvkzf7dfplzdxp"
]
}
}
您可以使用管道调用从那里查询。
理解和测试此内容的最佳方法是以下http://phabricator.yourhost.com/conduit/method/feed.query/
点击[通话方式]
这将返回您感兴趣的更改列表:“ objectPHID”:“ PHID-DREV-xxxxxxx”,
...
现在http://phabricator.yourhost.com/conduit/method/differential.query/
设置phids => [“ PHID-DREV-xxxxxxx”]
...
这将返回“ authorPHID”:“ PHID-USER-xxxxx”和“ reviewers”:[“ xxxx”,“ xxxx”,“ xxxx”]
...
我还建议查看/src/infrastructure/daemon/bot/handler/PhabricatorBotFeedNotificationHandler.php
现在的代码
$stories = $this->getConduit()->callMethodSynchronous(
'feed.query',
array(
'limit' => $config_page_size,
'after' => $chrono_key_cursor,
'view' => 'text',
)
);
foreach ($stories as $story) {
$objects = $this->getConduit()->callMethodSynchronous(
'phid.lookup',
array(
'names' => array($story['objectPHID']),
)
);
$diff_query_results = $this->getConduit()->callMethodSynchronous(
'differential.query',
array(
'phids' => array($story['objectPHID']),
));
foreach ($diff_query_results as $diff_query) {
$authorResults = $this->getConduit()->callMethodSynchronous(
'phid.lookup',
array(
'names' => array($diff_query['authorPHID']),
)
);
$message .= ' '.$objects[$story['objectPHID']]['uri'];
foreach ($authorResults as $author) {
$authorName = $author['name'];
print_r ($authorName);
}
$reviewersResults = $this->getConduit()->callMethodSynchronous(
'phid.lookup',
array(
'names' => $diff_query['reviewers'],
)
);
foreach ($reviewersResults as $reviewer) {
$reviewerName = $reviewer['name'];
print_r ($reviewerName );
}
}
我查询了feed.query。 并提取authorPHID
和objectPHID
如果可用)。 使用objectPHID
我查询了differnetial.query
管道方法以查找reviewers
和ccs
。 所述ccs
是具有接收所述消息的用户立方厘米的阵列。 然后,我使用了user.query
管道方法来提取用户名,并将其映射到jabber用户名并发送消息。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.