use of com.fastaccess.data.dao.model.User in project FastHub by k0shk0sh.
the class PullRequestPagerActivity method addPrReview.
private void addPrReview(@NonNull View view) {
PullRequest pullRequest = getPresenter().getPullRequest();
if (pullRequest == null)
return;
User author = pullRequest.getUser() != null ? pullRequest.getUser() : pullRequest.getHead() != null && pullRequest.getHead().getAuthor() != null ? pullRequest.getHead().getAuthor() : pullRequest.getUser();
if (author == null)
return;
ReviewRequestModel requestModel = new ReviewRequestModel();
requestModel.setComments(getPresenter().getCommitComment().isEmpty() ? null : getPresenter().getCommitComment());
requestModel.setCommitId(pullRequest.getHead().getSha());
boolean isAuthor = Login.getUser().getLogin().equalsIgnoreCase(author.getLogin());
ReviewChangesActivity.Companion.startForResult(requestModel, getPresenter().getRepoId(), getPresenter().getLogin(), pullRequest.getNumber(), isAuthor, isEnterprise(), pullRequest.isMerged() || pullRequest.getState() == IssueState.closed).show(getSupportFragmentManager(), ReviewChangesActivity.class.getSimpleName());
}
use of com.fastaccess.data.dao.model.User in project FastHub by k0shk0sh.
the class PullRequestPagerPresenter method isOwner.
@Override
public boolean isOwner() {
if (getPullRequest() == null)
return false;
User userModel = getPullRequest() != null ? getPullRequest().getUser() : null;
Login me = Login.getUser();
PullsIssuesParser parser = PullsIssuesParser.getForIssue(getPullRequest().getHtmlUrl());
return (userModel != null && userModel.getLogin().equalsIgnoreCase(me.getLogin())) || (parser != null && parser.getLogin().equalsIgnoreCase(me.getLogin()));
}
use of com.fastaccess.data.dao.model.User in project FastHub by k0shk0sh.
the class PullRequestPagerPresenter method onPutAssignees.
@Override
public void onPutAssignees(@NonNull ArrayList<User> users, boolean isAssignees) {
AssigneesRequestModel assigneesRequestModel = new AssigneesRequestModel();
ArrayList<String> assignees = Stream.of(users).map(User::getLogin).collect(Collectors.toCollection(ArrayList::new));
if (isAssignees) {
assigneesRequestModel.setAssignees(assignees.isEmpty() ? Stream.of(pullRequest.getAssignees()).map(User::getLogin).toList() : assignees);
makeRestCall(!assignees.isEmpty() ? RestProvider.getIssueService(isEnterprise()).putAssignees(login, repoId, issueNumber, assigneesRequestModel) : RestProvider.getIssueService(isEnterprise()).deleteAssignees(login, repoId, issueNumber, assigneesRequestModel), pullRequestResponse -> {
UsersListModel usersListModel = new UsersListModel();
usersListModel.addAll(users);
this.pullRequest.setAssignees(usersListModel);
manageObservable(pullRequest.save(pullRequest).toObservable());
sendToView(view -> updateTimeline(view, R.string.assignee_added));
});
} else {
assigneesRequestModel.setReviewers(assignees);
makeRestCall(RestProvider.getPullRequestService(isEnterprise()).putReviewers(login, repoId, issueNumber, assigneesRequestModel), pullRequestResponse -> sendToView(view -> updateTimeline(view, R.string.reviewer_added)));
}
}
use of com.fastaccess.data.dao.model.User in project FastHub by k0shk0sh.
the class CreateIssueActivity method onSelectedAssignees.
@Override
public void onSelectedAssignees(@NonNull ArrayList<User> users, boolean isAssignees) {
this.users.clear();
this.users.addAll(users);
SpannableBuilder builder = SpannableBuilder.builder();
for (int i = 0; i < users.size(); i++) {
User user = users.get(i);
builder.append(user.getLogin());
if (i != users.size() - 1) {
builder.append(", ");
}
}
assignee.setText(builder);
}
use of com.fastaccess.data.dao.model.User in project FastHub by k0shk0sh.
the class FeedsViewHolder method appendTeamEvent.
private void appendTeamEvent(SpannableBuilder spannableBuilder, Event eventsModel) {
TeamsModel teamsModel = eventsModel.getPayload().getTeam();
User user = eventsModel.getPayload().getUser();
spannableBuilder.bold("added").append(" ").append(user != null ? user.getLogin() : eventsModel.getRepo().getName()).append(" ").bold("in").append(" ").append(teamsModel.getName() != null ? teamsModel.getName() : teamsModel.getSlug());
}
Aggregations