forgejo-contrib/forgejo-cli
20
407
Fork
You've already forked forgejo-cli
51

feat: assigning issues #414

Merged
Cyborus merged 2 commits from cyborus/assigning-issues into main 2026年04月16日 18:18:49 +02:00 AGit
Member
Copy link

Changes Made

Adds issue assign and pr assign to assign users to issues & PRs, and issue unassign and pr unassign to do the opposite.

  • fj issue assign <ISSUE> <USERS..>
  • fj issue unassign <ISSUE> <USERS..>
  • fj pr assign [--pr <PR>] <USERS..>
  • fj pr unassign [--pr <PR>] <USERS..>

Closes #338

Code of Conduct

  • I agree to act in accordance with the CoC & AI Agreement.
  • This contribution was not generated by an LLM, even in part.
### Changes Made Adds `issue assign` and `pr assign` to assign users to issues & PRs, and `issue unassign` and `pr unassign` to do the opposite. - `fj issue assign <ISSUE> <USERS..>` - `fj issue unassign <ISSUE> <USERS..>` - `fj pr assign [--pr <PR>] <USERS..>` - `fj pr unassign [--pr <PR>] <USERS..>` Closes #338 ### Code of Conduct - [x] I agree to act in accordance with the CoC & AI Agreement. - [x] This contribution was not generated by an LLM, even in part.
LordMZTE requested changes 2026年04月16日 17:19:40 +02:00
Dismissed
@ -886,0 +920,4 @@
.filter_map(|user|user.login)
.collect::<Vec<_>>();
letassigned_before=assignees.len();
assignees.extend(users);
Collaborator
Copy link

This doesn't take into account the fact that usernames are case-insensitive. If we try to assign the same user twice, but use a non-canonical capitalization of the username, the output message won't be what we expect.

This doesn't take into account the fact that usernames are case-insensitive. If we try to `assign` the same user twice, but use a non-canonical capitalization of the username, the output message won't be what we expect.
Cyborus marked this conversation as resolved
@ -886,0 +941,4 @@
letnum_added=assigned_after-assigned_before;
letnum_duplicate=num_to_add-num_added;
print!("assigned ");
ifnum_added==0{
Collaborator
Copy link

This can be simplified by combining the zero and many if branches.

This can be simplified by combining the zero and many if branches.
Author
Member
Copy link

oops, yes, that was a leftover from an earlier draft of that part where all users were already assigned was part of this if block too.

oops, yes, that was a leftover from an earlier draft of that part where `all users were already assigned` was part of this `if` block too.
Cyborus marked this conversation as resolved
@ -886,0 +960,4 @@
}elseifnum_duplicate==1{
println!(" (1 user was already assigned)")
}else{
println!(" ({num_duplicate} users was already assigned)")
Collaborator
Copy link

s/was/were

s/was/were
Cyborus marked this conversation as resolved
@ -886,0 +982,4 @@
.filter_map(|user|user.login)
.collect::<Vec<_>>();
letassigned_before=assignees.len();
assignees.retain(|name|!users.contains(name));
Collaborator
Copy link

This only works when we capitalize the username correctly.

This only works when we capitalize the username correctly.
Author
Member
Copy link

Gonna check if Forgejo supports non-ascii usernames or not, which will determine if I should use .to_lowercase or if I can more optimally use .eq_ignore_ascii_case

Gonna check if Forgejo supports non-ascii usernames or not, which will determine if I should use `.to_lowercase` or if I can more optimally use `.eq_ignore_ascii_case`
Author
Member
Copy link

Indeed it is ASCII-only!

image

Indeed it is ASCII-only! ![image](/attachments/875f97bf-c628-4435-bcf0-551a9ba4c884)
Cyborus marked this conversation as resolved
@ -886,0 +984,4 @@
letassigned_before=assignees.len();
assignees.retain(|name|!users.contains(name));
letassigned_after=assignees.len();
letopt=forgejo_api::structs::EditIssueOption{
Collaborator
Copy link

More of a remark than a review comment: We should really add a Default::default implementation for this struct in forgejo-api and use ..Default::default() syntax here.

More of a remark than a review comment: We should really add a `Default::default` implementation for this struct in forgejo-api and use `..Default::default()` syntax here.
Cyborus marked this conversation as resolved
@ -886,0 +1001,4 @@
letnum_removed=assigned_before-assigned_after;
letnum_duplicate=num_to_remove-num_removed;
print!("unassigned ");
ifnum_removed==0{
Collaborator
Copy link

Ditto

Ditto
Cyborus marked this conversation as resolved
@ -886,0 +1020,4 @@
}elseifnum_duplicate==1{
println!(" (1 user was already not assigned)")
}else{
println!(" ({num_duplicate} users was already not assigned)")
Collaborator
Copy link

s/was/were

s/was/were
Cyborus marked this conversation as resolved
Cyborus force-pushed cyborus/assigning-issues from f9008a7d03
All checks were successful
ci/woodpecker/pr/check Pipeline was successful
to f37bea70ff
All checks were successful
ci/woodpecker/pr/check Pipeline was successful
2026年04月16日 17:34:41 +02:00
Compare
LordMZTE approved these changes 2026年04月16日 17:54:45 +02:00
Dismissed
LordMZTE left a comment
Copy link

Apart from the above review comment still left open, lgtm!

Apart from the above review comment still left open, lgtm!
Author
Member
Copy link

Oh shoot how did I miss that one

Oh shoot how did I miss that one
Cyborus dismissed LordMZTE's review 2026年04月16日 18:04:35 +02:00
Reason:

New commits pushed, approval review dismissed automatically according to repository settings

Cyborus force-pushed cyborus/assigning-issues from f37bea70ff
All checks were successful
ci/woodpecker/pr/check Pipeline was successful
to c6b6d7b14c 2026年04月16日 18:04:42 +02:00
Compare
Cyborus force-pushed cyborus/assigning-issues from c6b6d7b14c to 8b82c17b43
All checks were successful
ci/woodpecker/pr/check Pipeline was successful
2026年04月16日 18:09:34 +02:00
Compare
Cyborus added this to the v0.5.0 milestone 2026年04月16日 20:24:42 +02:00
Sign in to join this conversation.
No reviewers
Labels
Clear labels
Kind/Breaking
Breaking change that won't be backward compatible
Kind/Bug
Something is not working
Kind/Design
Discussion about UI/UX design
Kind/Documentation
Documentation changes
Kind/Enhancement
Improve existing functionality
Kind/Feature
New functionality
Kind/Security
This is security issue
Kind/Testing
Issue or pull request related to testing
Kind/Upstream
This is an issue with upstream software (Forgejo) that is probably not our fault
Priority
Critical
The priority is critical
Priority
High
The priority is high
Priority
Low
The priority is low
Priority
Medium
The priority is medium
Reviewed
Confirmed
Issue has been confirmed
Reviewed
Duplicate
This issue or pull request already exists
Reviewed
Invalid
Invalid issue
Reviewed
Won't Fix
This issue won't be fixed
Status
Abandoned
Somebody has started to work on this but abandoned work
Status
Blocked
Something is blocking this issue or pull request
Status
Need More Info
Feedback is required to reproduce issue or to continue work
Suspicious
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
2 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

No dependencies set.

Reference
forgejo-contrib/forgejo-cli!414
Reference in a new issue
forgejo-contrib/forgejo-cli
No description provided.
Delete branch "cyborus/assigning-issues"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?