mirror of
https://github.com/gitnex-org/gitnex.git
synced 2026-03-11 17:34:09 -05:00
Fix PR info when coming from notification (#1547)
Fixes #1545 Reviewed-on: https://codeberg.org/gitnex/GitNex/pulls/1547 Co-authored-by: M M Arif <mmarif@swatian.com> Co-committed-by: M M Arif <mmarif@swatian.com>
This commit is contained in:
@@ -1119,25 +1119,7 @@ public class IssueDetailActivity extends BaseActivity
|
||||
viewBinding.statusesLvMain.setVisibility(View.VISIBLE);
|
||||
|
||||
getStatuses();
|
||||
|
||||
viewBinding.prInfoLayout.setVisibility(View.VISIBLE);
|
||||
String displayName;
|
||||
User user = issue.getIssue().getUser();
|
||||
if (user != null && user.getFullName() != null && !user.getFullName().isEmpty()) {
|
||||
displayName = user.getFullName();
|
||||
} else {
|
||||
displayName = user != null && user.getLogin() != null ? user.getLogin() : "Unknown";
|
||||
}
|
||||
|
||||
PullRequest pr = issue.getPullRequest();
|
||||
if (pr != null && pr.getHead() != null && pr.getBase() != null) {
|
||||
viewBinding.prInfo.setText(
|
||||
getString(
|
||||
R.string.pr_info,
|
||||
displayName,
|
||||
pr.getHead().getRef(),
|
||||
pr.getBase().getRef()));
|
||||
}
|
||||
updatePrInfo();
|
||||
|
||||
if (issue.getIssue().getPullRequest().isMerged()) { // merged
|
||||
|
||||
@@ -1557,6 +1539,7 @@ public class IssueDetailActivity extends BaseActivity
|
||||
issue.setPullRequest(response.body());
|
||||
loadingFinishedPr = true;
|
||||
updateMenuState();
|
||||
updatePrInfo();
|
||||
} else {
|
||||
loadingFinishedPr = true;
|
||||
}
|
||||
@@ -1573,6 +1556,30 @@ public class IssueDetailActivity extends BaseActivity
|
||||
});
|
||||
}
|
||||
|
||||
private void updatePrInfo() {
|
||||
if (issue.getIssue() != null && issue.getIssue().getPullRequest() != null) {
|
||||
PullRequest pr = issue.getPullRequest();
|
||||
if (pr != null && pr.getHead() != null && pr.getBase() != null) {
|
||||
viewBinding.prInfoLayout.setVisibility(View.VISIBLE);
|
||||
String displayName;
|
||||
User user = issue.getIssue().getUser();
|
||||
if (user != null && user.getFullName() != null && !user.getFullName().isEmpty()) {
|
||||
displayName = user.getFullName();
|
||||
} else {
|
||||
displayName =
|
||||
user != null && user.getLogin() != null ? user.getLogin() : "Unknown";
|
||||
}
|
||||
|
||||
viewBinding.prInfo.setText(
|
||||
getString(
|
||||
R.string.pr_info,
|
||||
displayName,
|
||||
pr.getHead().getLabel(),
|
||||
pr.getBase().getRef()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void checkAndInitWithIssue() {
|
||||
if ((loadingFinishedIssue || pullRequestFetchAttempted) && !issueInitialized) {
|
||||
initWithIssue();
|
||||
|
||||
Reference in New Issue
Block a user