use of com.meisolsson.githubsdk.model.PullRequest in project PocketHub by pockethub.
the class IconAndViewTextManager method formatPullRequest.
void formatPullRequest(GitHubEvent event, StyledText main, StyledText details) {
boldActor(main, event);
PullRequestPayload payload = (PullRequestPayload) event.payload();
String action = payload.action();
if ("synchronize".equals(action)) {
action = "updated";
}
main.append(' ');
main.append(action);
main.append(' ');
main.bold("pull request " + payload.number());
main.append(" on ");
boldRepo(main, event);
if (ISSUES_PAYLOAD_ACTION_OPENED.equals(action) || "closed".equals(action)) {
PullRequest request = payload.pullRequest();
if (request != null) {
String title = request.title();
if (!TextUtils.isEmpty(title)) {
details.append(title);
}
}
}
}
use of com.meisolsson.githubsdk.model.PullRequest in project PocketHub by pockethub.
the class IssueFragment method openPullRequestCommits.
private void openPullRequestCommits() {
if (IssueUtils.isPullRequest(issue)) {
PullRequest pullRequest = issue.pullRequest();
String base = pullRequest.base().sha();
String head = pullRequest.head().sha();
Repository repo = pullRequest.base().repo();
startActivity(CommitCompareViewActivity.createIntent(repo, base, head));
}
}
use of com.meisolsson.githubsdk.model.PullRequest in project PocketHub by pockethub.
the class RefreshIssueTask method subscribe.
@Override
public void subscribe(ObservableEmitter<FullIssue> emitter) throws Exception {
try {
Issue issue = store.refreshIssue(repo, issueNumber);
if (issue.pullRequest() != null) {
PullRequest pull = getPullRequest(repo.owner().login(), repo.name(), issueNumber);
issue = issue.toBuilder().pullRequest(pull).build();
}
bodyImageGetter.encode(issue.id(), issue.bodyHtml());
List<GitHubComment> comments;
if (issue.comments() > 0) {
comments = getAllComments(repo.owner().login(), repo.name(), issueNumber);
} else {
comments = Collections.emptyList();
}
for (GitHubComment comment : comments) {
commentImageGetter.encode(comment.id(), comment.bodyHtml());
}
List<IssueEvent> events = getAllEvents(repo.owner().login(), repo.name(), issueNumber);
emitter.onNext(new FullIssue(issue, comments, events));
} catch (IOException e) {
emitter.onError(e);
}
}
Aggregations