Skip to content

Allow any group member to complete unassigned tasks#85831

Open
MelvinBot wants to merge 2 commits intomainfrom
claude-allowUnassignedTaskCompletionByGroupMembers
Open

Allow any group member to complete unassigned tasks#85831
MelvinBot wants to merge 2 commits intomainfrom
claude-allowUnassignedTaskCompletionByGroupMembers

Conversation

@MelvinBot
Copy link
Contributor

Explanation of Change

When a task is created in a group chat without an assignee, the canActionTask function only allowed the task owner to complete/reopen it, because the assignee check compared against managerID = 0 which never matches any real user. This change adds a fallback: when a task has no assignee, any participant of the parent report (the group chat) can now action the task.

Fixed Issues

$ #85220
PROPOSAL: #85220 (comment)

Tests

  1. As user A, create a group chat with user B and user C
  2. As user A, create a task in the group chat without selecting an assignee
  3. As user B, open the group chat and verify the task checkbox is enabled (not grayed out)
  4. As user B, click the checkbox to complete the task
  5. Verify the task is marked as completed
  6. As user B, click the checkbox again to reopen the task
  7. Verify the task is reopened
  8. As user C, repeat steps 3-7 and verify the same behavior
  9. As user A (owner), verify you can still complete/reopen the task
  • Verify that no errors appear in the JS console

Offline tests

  1. Go offline
  2. As a non-owner group member, click the checkbox on an unassigned task
  3. Verify the task status changes optimistically
  4. Go back online
  5. Verify the task status syncs correctly

QA Steps

  1. As user A, create a group chat with user B and user C
  2. As user A, create a task in the group chat without selecting an assignee
  3. As user B, open the group chat and verify the task checkbox is enabled
  4. As user B, click the checkbox to complete the task
  5. Verify the task is marked as completed
  6. Now create a task WITH an explicit assignee (user C)
  7. As user B (not the assignee), verify the checkbox is disabled — only user A (owner) and user C (assignee) should be able to complete it
  • Verify that no errors appear in the JS console

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I followed proper code patterns (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick)
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
      • If any non-english text was added/modified, I used JaimeGPT to get English > Spanish translation. I then posted it in #expensify-open-source and it was approved by an internal Expensify engineer. Link to Slack message:
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.ts or at the top of the file that uses the constant) are defined as such
  • I verified that if a function's arguments changed that all usages have also been updated correctly
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))
  • If new assets were added or existing ones were modified, I verified that:
    • The assets are optimized and compressed (for SVG files, run npm run compress-svg)
    • The assets load correctly across all supported platforms.
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • I added unit tests for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.

Screenshots/Videos

Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari

When a task has no assignee, the canActionTask function now allows
any participant of the parent report to complete or reopen the task,
instead of restricting it to only the task owner.

Co-authored-by: Daniel Gale-Rosen <dangrous@users.noreply.github.com>
@MelvinBot
Copy link
Contributor Author

The failing check build (developmentDebug, false) is unrelated to this PR.

Analysis: The error is Could not read script '.../node_modules/expo/scripts/autolinking.gradle' as it does not exist — an intermittent Android build infrastructure issue in the Remote Build Android workflow. This PR only modifies src/libs/actions/Task.ts and tests/actions/TaskTest.ts, which have no connection to the Android Gradle build configuration.

Evidence: The same autolinking.gradle error is also occurring on main (e.g. run 23305219734), while other branches built around the same time succeeded (e.g. run 23305596734). This confirms it's a flaky CI issue, not something introduced by this PR.

Re-running the failed job should resolve it.

@MelvinBot
Copy link
Contributor Author

The failing checks are unrelated to this PR's changes.

Failing checks:

  1. build (developmentDebug, false) — Android build fails with: Could not read script 'node_modules/expo/scripts/autolinking.gradle' as it does not exist
  2. build (New Expensify Dev, DebugDevelopment, false) — iOS build fails with: RockError: Failed to build the project

Why these are unrelated:

  • This PR only modifies src/libs/actions/Task.ts and tests/actions/TaskTest.ts — neither file affects native build configuration
  • The same build failures are occurring on main right now (e.g., run 23306041724 on main has the identical build (developmentDebug, false) failure)
  • The Android error is a missing expo/scripts/autolinking.gradle file — an infrastructure/dependency issue, not a code change issue

All code-quality checks pass: ESLint, typecheck, all 8 test jobs, prettier, spellcheck, storybook, and perf-tests.

@ikevin127
Copy link
Contributor

@MelvinBot Mark this PR Ready for review

@MelvinBot MelvinBot marked this pull request as ready for review March 19, 2026 22:36
@MelvinBot MelvinBot requested a review from a team as a code owner March 19, 2026 22:36
@melvin-bot melvin-bot bot requested a review from ikevin127 March 19, 2026 22:36
@MelvinBot
Copy link
Contributor Author

This PR has been marked as Ready for Review as requested by ikevin127.

@melvin-bot melvin-bot bot removed the request for review from a team March 19, 2026 22:36
@melvin-bot
Copy link

melvin-bot bot commented Mar 19, 2026

@ikevin127 Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

@melvin-bot melvin-bot bot requested review from trjExpensify and removed request for a team March 19, 2026 22:36
@ikevin127
Copy link
Contributor

ikevin127 commented Mar 19, 2026

Reviewer Checklist

  • I have verified the author checklist is complete (all boxes are checked off).
  • I verified the correct issue is linked in the ### Fixed Issues section above
  • I verified testing steps are clear and they cover the changes made in this PR
    • I verified the steps for local testing are in the Tests section
    • I verified the steps for Staging and/or Production testing are in the QA steps section
    • I verified the steps cover any possible failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
  • I checked that screenshots or videos are included for tests on all platforms
  • I included screenshots or videos for tests on all platforms
  • I verified tests pass on all platforms & I tested again on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • If there are any errors in the console that are unrelated to this PR, I either fixed them (preferred) or linked to where I reported them in Slack
  • I verified proper code patterns were followed (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick).
    • I verified that the left part of a conditional rendering a React component is a boolean and NOT a string, e.g. myBool && <MyComponent />.
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I verified that this PR follows the guidelines as stated in the Review Guidelines
  • I verified other components that can be impacted by these changes have been tested, and I retested again (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar have been tested & I retested again)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.js or at the top of the file that uses the constant) are defined as such
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately and each prop has a /** comment above it */
    • The file is named correctly
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • For Class Components, any internal methods passed to components event handlers are bound to this properly so there are no scoping issues (i.e. for onClick={this.submit} the method this.submit should be bound to this in the constructor)
    • Any internal methods bound to this are necessary to be bound (i.e. avoid this.submit = this.submit.bind(this); if this.submit is never passed to a component event handler like onClick)
    • All JSX used for rendering exists in the render method
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
  • If new assets were added or existing ones were modified, I verified that:
    • The assets are optimized and compressed (for SVG files, run npm run compress-svg)
    • The assets load correctly across all supported platforms.
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.
  • I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.

Screenshots/Videos

Screen.Recording.2026-03-19.at.16.02.58.mov

@ikevin127
Copy link
Contributor

@MelvinBot Please sync this PR with latest main, hopefully that will fix the failing workflow checks 🤞

@MelvinBot
Copy link
Contributor Author

I can only make code changes (including merging main) when directed by the PR author, an assignee, or an existing co-author. Currently dangrous is the assignee.

To have me sync this branch with main, either:

  1. dangrous can reply here tagging me with the request, or
  2. Ask dangrous to add you as an assignee, then retry.

Copy link
Contributor

@ikevin127 ikevin127 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 LGTM

@dangrous Before we merge, if you could please ask Melvin to sync with main as described here to hopefully resolve the flaky ❌ workflows 🙌

@melvin-bot melvin-bot bot requested a review from dangrous March 19, 2026 23:08
Copy link
Contributor

@trjExpensify trjExpensify left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you tested these changes with the Concierge onboarding tasks? To make sure we haven't just opened up letting users edit those.

@ikevin127
Copy link
Contributor

@trjExpensify Good point. I checked, and Concierge tasks are individual to every member as in their own Concierge chat that only they can complete the tasks. What I did test was:

  • Owner of Workspace A creates a task in the #admin room
  • Owner of Workspace A invites User B and makes them Admin role
  • User B goes to Workspace A's #admin room

User B is allowed to complete Workspace A #admin room task created by the Owner since they are in the #admins room and they are an Admin. Note this doesn't work in current staging / production, but will be fixed once this PR merges.

Let me know if there's another case that I might have missed, or how to reproduce the Concierge case you referred to.

@trjExpensify
Copy link
Contributor

I checked, and Concierge tasks are individual to every member as in their own Concierge chat that only they can complete the tasks.

If the person signing up gets assigned a guide, then the onboarding tasks go in the #admins chat. I was curious about that case to ensure they work as they do today: can be completed/marked as incomplete, can't be edited or deleted.

@ikevin127
Copy link
Contributor

If the person signing up gets assigned a guide, then the onboarding tasks go in the #admins chat. I was curious about that case to ensure they work as they do today: can be completed/marked as incomplete, can't be edited or deleted.

@trjExpensify Just verified the case you mentioned (see video below), and the WS Owner himself cannot edit / delete the onboarding #admins tasks, the Owner can only complete the tasks, the invited Admin member cannot complete edit nor delete them ✅

Screen.Recording.2026-03-19.at.17.56.24.mov

@trjExpensify
Copy link
Contributor

Great, thanks for confirming!

@dangrous
Copy link
Contributor

@MelvinBot please merge main

…dTaskCompletionByGroupMembers

Co-authored-by: Daniel Gale-Rosen <dangrous@users.noreply.github.com>
@MelvinBot MelvinBot requested a review from a team as a code owner March 20, 2026 14:21
@melvin-bot melvin-bot bot requested a review from ikevin127 March 20, 2026 14:22
@melvin-bot melvin-bot bot removed the request for review from a team March 20, 2026 14:22
@melvin-bot
Copy link

melvin-bot bot commented Mar 20, 2026

@ikevin127 Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

@MelvinBot
Copy link
Contributor Author

Done! I've merged main into this branch and pushed the merge commit.

@MelvinBot
Copy link
Contributor Author

The failing check is unrelated to this PR.

Failing check: build (developmentDebug, false) — Android build
Error: Could not read script 'node_modules/expo/scripts/autolinking.gradle' as it does not exist.

Analysis: This is a build infrastructure/dependency issue with Expo's autolinking Gradle script missing from node_modules. The PR only modifies src/libs/actions/Task.ts and tests/actions/TaskTest.ts, which have no relation to the Android build system or Expo autolinking.

Evidence: The error originates in android/settings.gradle line 40, which tries to load an Expo autolinking script that wasn't properly installed. This is likely a transient CI dependency issue. Re-running the check should resolve it.

@codecov
Copy link

codecov bot commented Mar 20, 2026

Codecov Report

✅ Changes either increased or maintained existing code coverage, great job!

Files with missing lines Coverage Δ
src/libs/actions/Task.ts 47.46% <100.00%> (+0.79%) ⬆️
... and 18 files with indirect coverage changes

@MelvinBot
Copy link
Contributor Author

The failing checks are unrelated to this PR's changes and cannot be fixed with a code change.

PR changes: Only two TypeScript files — src/libs/actions/Task.ts and tests/actions/TaskTest.ts.

Failing checks:

  1. build (developmentDebug, false) (Android): Failed with Could not read script 'node_modules/expo/scripts/autolinking.gradle' as it does not exist — this is a CI dependency installation issue, not a code problem.
  2. build (New Expensify Dev, DebugDevelopment, false) (iOS): Failed after ~25 minutes on Rock Remote Build - iOS — appears to be a CI infrastructure timeout.

Evidence: All code-level checks (ESLint, TypeScript, Prettier, all 8 test jobs, spellcheck) pass. The failures are in native mobile builds which are unaffected by TypeScript-only changes.

Recommendation: Re-run the failed workflows. These are transient CI/infrastructure issues.

@MelvinBot
Copy link
Contributor Author

The failing checks are unrelated to this PR's changes.

Failing checks:

  1. build (developmentDebug, false) — Android build fails with: Could not read script 'node_modules/expo/scripts/autolinking.gradle' as it does not exist. This is a CI dependency/infrastructure issue.
  2. build (New Expensify Dev, DebugDevelopment, false) — iOS build failure (timed out after ~25min). The log shows only Xcode compilation steps with no code-related errors.

Why unrelated: This PR only modifies src/libs/actions/Task.ts and tests/actions/TaskTest.ts (TypeScript files). The native build failures are in the build toolchain/dependency layer, not in application code. Recent merges to main are also showing build failures, confirming this is a pre-existing CI issue.

@dangrous
Copy link
Contributor

This should hopefully be fine, it looks like these builds are broken everywhere? We can remerge main and merge next week I guess, or later today if it clears up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants