예제 #1
0
  private void loadAvatar(AccountInfo account, int size, boolean addPopup) {
    if (!Gerrit.info().plugin().hasAvatars()) {
      setVisible(false);
      return;
    }

    // TODO Kill /accounts/*/avatar URL.
    String u = account.email();
    if (Gerrit.isSignedIn() && u.equals(Gerrit.getUserAccount().email())) {
      u = "self";
    }
    RestApi api = new RestApi("/accounts/").id(u).view("avatar");
    if (size > 0) {
      api.addParameter("s", size);
      setSize("", size + "px");
    }
    setVisible(false);
    setUrl(api.url());
    popup(account, addPopup);
  }
예제 #2
0
  @Override
  protected void onLoad() {
    if (!loaded) {
      RestApi call = ChangeApi.detail(changeId.get());
      ChangeList.addOptions(
          call, EnumSet.of(ListChangesOption.ALL_COMMITS, ListChangesOption.ALL_REVISIONS));
      call.get(
          new AsyncCallback<ChangeInfo>() {
            @Override
            public void onSuccess(ChangeInfo result) {
              if (edit != null) {
                edit.setName(edit.commit().commit());
                result.revisions().put(edit.name(), RevisionInfo.fromEdit(edit));
              }
              render(result.revisions());
              loaded = true;
            }

            @Override
            public void onFailure(Throwable caught) {}
          });
    }
  }