renderDiff()

in src/PrDisplay.js [536:559]


  renderDiff() {
    if (!this.state.commit) {
      return null;
    }

    // Try to find the diff in the commit message or PR body
    let text = this.state.commit.messageBody;
    let diff = null;
    if (this.isPr()) {
      text = this.state.pr.body;
    }
    const match = text.match(/Differential Revision: (\[)?(D\d+)(\])?/);
    if (match) {
      diff = match[2];
    }

    if (!diff && this.isPr()) {
      // If we didn't find a diff, search the PR comment for facebook-github-bot
      // comments
      diff = this.findDiffInComments(this.state.pr.comments.nodes);
    }

    return <a href={`https://www.internalfb.com/diff/${diff}`}>{diff}</a>;
  }