You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(tasks): keep assignees when tasks/edit omits users - #494
The assignee sync in the TaskController::edit after-action listener now runs only when users is present in the request. An omitted users leaves assignees unchanged and no longer returns 500; an explicit users: [] still unassigns everyone.
Verification
Added EditTest::test_edit_without_users_field_keeps_assignees (fails on main with the count() TypeError) and test_edit_with_empty_users_unassigns_everyone.
Full PHPUnit suite: 592 tests, 3018 assertions, all passing.
An omitted users field made the after-action listener call sync(null),
detaching all assignees, and then whereIn(null) failed with HTTP 500.
Only sync (and record history) when users is present in the request.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
No actionable comments were generated in the recent review.
Walkthrough
Task edits now leave assignees unchanged when the request omits users. When the request includes users, the controller synchronizes assignees and records user-change history only when synchronization reports changes.
The edit action synchronizes users only when the request includes users. Tests verify that omitting the field preserves an assignee and submitting an empty array removes assignments.
Edits preserve assignees when omitted and remove them when an empty list is submitted. No merge-blocking risk was identified.
Pre-merge checks: 5
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
The title clearly and concisely describes the main change: preserving task assignees when the edit request omits the users field.
Linked Issues check
Issue #474 requires three things: (1) an omitted users field leaves assignees unchanged, (2) the request does not return HTTP 500, and (3) an explicit users: [] still unassigns everyone. Also, regress…
Out of Scope Changes check
The whole-PR diff (merge base e0e9789 to head 8f4f607) changes two files only: TaskController.php and tests/Feature/Tasks/EditTest.php. The controller change is limited to the assignee sync and its hi…
Docstring Coverage
No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Full details: Linked Issues check
Explanation
Issue #474 requires three things: (1) an omitted users field leaves assignees unchanged, (2) the request does not return HTTP 500, and (3) an explicit users: [] still unassigns everyone. Also, regression tests must cover edits with and without users on a task with assignees.
Code at head (app/Http/Controllers/Api/TaskController.php, after-action listener in edit): the users sync and the users history dispatch now run only inside if ($request->has('users')). When users is omitted, sync() is not called, so assignees are kept. The whereIn('id', $userIds) call that caused the count(null) TypeError is only reached when users is present, so the 500 path is removed. When users is [], has() is true, sync([]) detaches all assignees, and the existing behavior is preserved.
Validation check: app/Http/Requests/Task/EditTaskRequest.php declares 'users' => 'sometimes|array' with no nullable rule. An explicit users: null is rejected with 422 before the listener runs, so the has() guard does not leave a null path open.
Tests (tests/Feature/Tasks/EditTest.php): test_edit_without_users_field_keeps_assignees attaches an assignee, omits users, and asserts HTTP OK and that tasks_users still holds the assignee row. test_edit_with_empty_users_unassigns_everyone attaches an assignee, sends users: [], and asserts HTTP OK and no tasks_users rows. Together these cover both required cases. I did not execute the test suite. The result relies on the reviewed source and the PR's reported test run.
Full details: Out of Scope Changes check
Explanation
The whole-PR diff (merge base e0e9789 to head 8f4f607) changes two files only: TaskController.php and tests/Feature/Tasks/EditTest.php. The controller change is limited to the assignee sync and its history dispatch in the edit after-action listener. It replaces get('users') with input('users') and stores the value in $userIds. The inner history dispatch remains conditional on sync changes, and the unconditional SaveTaskEditHistory dispatch is unchanged. The test change adds the Arr import and the two tests required by #474. No unrelated refactoring, feature, or configuration change appears in the diff.
Full details: Docstring Coverage
Explanation
No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 2 files.
Finishing Touches
Generate docstrings
Commit to this branch
Create a new PR
Generate unit tests (beta)
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Reviewing files that changed from the base of the PR and between ed67358 and 8f4f607.
Files selected for processing: 2
app/Http/Controllers/Api/TaskController.php
tests/Feature/Tasks/EditTest.php
Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #474
The assignee sync in the
TaskController::editafter-action listener now runs only whenusersis present in the request. An omittedusersleaves assignees unchanged and no longer returns 500; an explicitusers: []still unassigns everyone.Verification
EditTest::test_edit_without_users_field_keeps_assignees(fails onmainwith thecount()TypeError) andtest_edit_with_empty_users_unassigns_everyone.🤖 Generated with Claude Code
Summary by CodeRabbit