<!DOCTYPE html>
<!--
Copyright 2017 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->

<link rel="import" href="/elements/base-style.html">

<dom-module id="change-info">
  <template>
    <style include="base-style">
      p {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }
    </style>

    <p><a href="[[url(change)]]" target="_blank">[[subject(change)]]</a></p>
    <p class="commit">[[commit(change)]]</p>
    <p class="byline">By [[author(change)]]</p>
  </template>

  <script>
    'use strict';
    Polymer({
      is: 'change-info',

      properties: {
        change: {
          type: Object
        }
      },

      visibleCommit_(change) {
        if (!change) {
          return {};
        }

        if (change.patch) {
          return change.patch;
        }

        return change.commits[change.commits.length - 1];
      },

      url(change) {
        return this.visibleCommit_(change).url;
      },

      subject(change) {
        return this.visibleCommit_(change).subject;
      },

      author(change) {
        return this.visibleCommit_(change).author;
      },

      commit(change) {
        return this.visibleCommit_(change).commit;
      },
    });
  </script>
</dom-module>

<!DOCTYPE html>
<!--
Copyright 2017 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->

<link rel="import" href="/elements/base-style.html">

<dom-module id="change-info">
  <template>
    <style include="base-style">
      p {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }
    </style>

    <p><a href="[[url(change)]]" target="_blank">[[subject(change)]]</a></p>
    <p class="commit">[[commit(change)]]</p>
    <p class="byline">By [[author(change)]]</p>
  </template>

  <script>
    'use strict';
    Polymer({
      is: 'change-info',

      properties: {
        change: {
          type: Object
        }
      },

      visibleCommit_(change) {
        if (!change) {
          return {};
        }

        if (change.patch) {
          return change.patch;
        }

        return change.commits[change.commits.length - 1];
      },

      url(change) {
        return this.visibleCommit_(change).url;
      },

      subject(change) {
        return this.visibleCommit_(change).subject;
      },

      author(change) {
        return this.visibleCommit_(change).author;
      },

      commit(change) {
        return this.visibleCommit_(change).git_hash;
      },
    });
  </script>
</dom-module>

Use git_hash instead of commit
pinpoint: Use git_hash instead of commit

It turns out the property we're looking for in the commit is called
"git_hash".

R=f07c55753dac44d78e0294a1d64ea321baaa78f4@google.com, fancl@chromium.org

Change-Id: Iacd4cbbb9a3a490d47b296d56ecaa9933bc9197b
Reviewed-on: https://chromium-review.googlesource.com/c/catapult/+/2259316
Auto-Submit: Dean Berris <34a37f59e4ade3cf49221306f04217acf3e86255@chromium.org>
Commit-Queue: Andrew Bennetts <f07c55753dac44d78e0294a1d64ea321baaa78f4@google.com>
Reviewed-by: Andrew Bennetts <f07c55753dac44d78e0294a1d64ea321baaa78f4@google.com>
