-1

phabricator を jabber チャットと統合しようとしています。新しいフィード クエリごとに jabber チャットでコミット作成者にメッセージを送信するボットを作成しました。私の要件は、フィード ストーリーが懸念事項、監査、またはコメントである場合、コミットの元の作成者をどのように取得するかということです。コミットの作成者に、彼のコミットで提起された懸念を通知したいと思います。この情報を得るためにストーリーを分析する必要がありますか? どうすればこれを行うことができますか?

前もって感謝します

4

3 に答える 3

2

The best way to understand and test this is the following http://phabricator.yourhost.com/conduit/method/feed.query/
click [call method]
This will return a list of changes that you will be interested in: "objectPHID": "PHID-DREV-xxxxxxx",
...
Now http://phabricator.yourhost.com/conduit/method/differential.query/
set phids => ["PHID-DREV-xxxxxxx"]
...
This will return "authorPHID": "PHID-USER-xxxxx", and "reviewers": ["xxxx","xxxx","xxxx"]
...
I also suggest reviewing /src/infrastructure/daemon/bot/handler/PhabricatorBotFeedNotificationHandler.php

Now the code

$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 );
    }
}
于 2015-01-09T15:57:13.780 に答える
0

feed.query にクエリを実行しました。authorPHIDそして、利用可能な場合はandを抽出しましたobjectPHIDobjectPHIDI queryedコンジット メソッドを使用して、およびdiffernetial.queryを見つけます。は、メッセージの cc を受信する必要があるユーザーの配列です。次に、コンジット メソッドを使用してユーザー名を抽出し、それらを jabber ユーザー名にマップして、メッセージを送信しました。reviewersccsccsuser.query

于 2014-09-08T16:03:22.440 に答える