Search in sources :

Example 1 with PullRequest

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);
            }
        }
    }
}
Also used : PullRequestPayload(com.meisolsson.githubsdk.model.payload.PullRequestPayload) PullRequest(com.meisolsson.githubsdk.model.PullRequest)

Example 2 with PullRequest

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));
    }
}
Also used : Repository(com.meisolsson.githubsdk.model.Repository) PullRequest(com.meisolsson.githubsdk.model.PullRequest)

Example 3 with PullRequest

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);
    }
}
Also used : Issue(com.meisolsson.githubsdk.model.Issue) PullRequest(com.meisolsson.githubsdk.model.PullRequest) GitHubComment(com.meisolsson.githubsdk.model.GitHubComment) IOException(java.io.IOException) IssueEvent(com.meisolsson.githubsdk.model.IssueEvent)

Aggregations

PullRequest (com.meisolsson.githubsdk.model.PullRequest)3 GitHubComment (com.meisolsson.githubsdk.model.GitHubComment)1 Issue (com.meisolsson.githubsdk.model.Issue)1 IssueEvent (com.meisolsson.githubsdk.model.IssueEvent)1 Repository (com.meisolsson.githubsdk.model.Repository)1 PullRequestPayload (com.meisolsson.githubsdk.model.payload.PullRequestPayload)1 IOException (java.io.IOException)1