Add option to delete branch after pr got merged
#929
Merged
mmarif
merged 10 commits from qwerty287/GitNex:delete-branch
into main
1 year ago
Reviewers
Request review
No reviewers
Labels
Requires and waits for changes in Gitea's API Backport
Bugfix ported to a release branch for point release Blocked
Waits for something else that must be solved first Brainstorming Breaking
Contains or will result in breaking changes Bug Cannot-reproduce Changelog CI
Related to the CI/CD Cleanup Confirmed Discussion Documentation Duplicate Enhancement External-dependecy F-droid Feature Frontport Good-first-issue Google-play Has-backport Improvement Invalid Investigate Long-term Major-release Minor-release Needs-backport Needs-cleanup Needs-feedback Needs-frontport Needs-help Performance Priority-critical Priority-high Priority-low Priority-medium Question Ready Refactor Regression Release Repository
Related to this repository and it's management Security Suggestion Summary Support Testing Translation UI/UX
Related to the user interface or experience Upstream Website
Related to the website Wontfix
This won't get fixed
Apply labels
Clear labels
API-dependency
Requires and waits for changes in Gitea's API Backport
Bugfix ported to a release branch for point release Blocked
Waits for something else that must be solved first Brainstorming Breaking
Contains or will result in breaking changes Bug Cannot-reproduce Changelog CI
Related to the CI/CD Cleanup Confirmed Discussion Documentation Duplicate Enhancement External-dependecy F-droid Feature Frontport Good-first-issue Google-play Has-backport Improvement Invalid Investigate Long-term Major-release Minor-release Needs-backport Needs-cleanup Needs-feedback Needs-frontport Needs-help Performance Priority-critical Priority-high Priority-low Priority-medium Question Ready Refactor Regression Release Repository
Related to this repository and it's management Security Suggestion Summary Support Testing Translation UI/UX
Related to the user interface or experience Upstream Website
Related to the website Wontfix
This won't get fixed
No Label
API-dependency
Backport
Blocked
Brainstorming
Breaking
Bug
Cannot-reproduce
Changelog
CI
Cleanup
Confirmed
Discussion
Documentation
Duplicate
Enhancement
External-dependecy
F-droid
Feature
Frontport
Good-first-issue
Google-play
Has-backport
Improvement
Invalid
Investigate
Long-term
Major-release
Minor-release
Needs-backport
Needs-cleanup
Needs-feedback
Needs-frontport
Needs-help
Performance
Priority-critical
Priority-high
Priority-low
Priority-medium
Question
Ready
Refactor
Regression
Release
Repository
Security
Suggestion
Summary
Support
Testing
Translation
UI/UX
Upstream
Website
Wontfix
Milestone
Set milestone
Clear milestone
No items
No Milestone
Projects
Clear projects
No project
Assignees
Assign users
Clear assignees
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.
No due date set.
Dependencies
This pull request currently doesn't have any dependencies.
Reference in new issue
There is no content yet.
Delete Branch 'qwerty287/GitNex:delete-branch'
Deleting a branch is permanent. It CANNOT be undone. Continue?
No
Yes
Describe what your pull request does and which issue you’re targeting
Closes #860
(Just FYI this is and was already ready for review)
@qwerty287 Here are some imprvoments to be made after my initial review:
actions
package with a namePullRequestActions
.PullRequestActions
.Here are some examples:
Action class method
Calling action class method from bottomsheet
You could also just create a
ViewModel
.I moved the delete branch method to the pull request actions class, but I can't move more things. Most of the actions aren't pr-specific and also moved to the IssueActions.
Btw, maybe you know it already, but the CI actions always fail
e.g. https://gitlab.com/opyale/gitnex/-/jobs/1322447387
import org.mian.gitnex.helpers.Toasty;
import retrofit2.Call;
import retrofit2.Callback;
You can add yourself as author here(blank line up, below).
public class PullRequestActions {
public static void deleteHeadBranch(@NonNull Context context, String repoOwner, String repoName, String headBranch, boolean showToasts) {
Remove @NonNull.
.getApiInterface(context)
.deleteBranch(Authorization.get(context), repoOwner, repoName, headBranch);
call.enqueue(new Callback<JsonElement>() {
Push this back one tab for proper alignment.
public void onFailure(@NonNull Call<JsonElement> call, @NonNull Throwable t) {
if(showToasts) Toasty.error(context, context.getString(R.string.deleteBranchError));
Log.i("onFailure", t.toString());
This is not needed, you can remove it.
}
private void deleteBranchFunction(String repoOwner, String repoName) {
Nice touch by removing this.
deletePullRequestBranch.setOnClickListener(v -> {
assert ctx != null;
Remove assert for ctx. To make this work, you can also remove @NonNull from the Context in PullRequestActions.
I found two settings string arrays (cache size) that aren't in the settings.xml, is it ok if I push them into this branch/pr?
Sure, go ahead.
Yes, don't worry, I will fix it soon. 🙂
d567a012d8
into main 1 year agoReviewers
d567a012d8
.