Skip to content

LHN — report with a failed DEW approval shows a GBR for every participant, not just the approver #100863

Description

@melvin-bot

Problem

When a Dynamic External Workflow approval fails (for example, someone tries to approve their own report and the API returns You cannot approve your own reports.), Auth writes a DEWAPPROVEFAILED report action and pushes it to every participant on the report. The App then surfaces the report in the LHN with a green dot for all of them — including people who are neither the report owner, the manager, nor the actor who triggered the failed approval.

Reported case: a user with only auditor/comment permissions on an expense report saw it pinned in their LHN with a GBR, while their next step still read "waiting for <approver> to approve". They had no action to take.

Root cause

In getReasonAndReportActionThatRequiresAttention in src/libs/ReportUtils.ts, the first check returns HAS_DEW_APPROVE_FAILED whenever the report statusNum is SUBMITTED and any non-deleted DEW_APPROVE_FAILED action exists on it. There is no check on the current user's relationship to the report.

That sets requiresAttention, which in SidebarUtils.shouldDisplayReportInLHN overrides a hidden notification preference and pins the row with a GBR.

The neighbouring paths are gated correctly, which is what makes this look like an oversight:

  • the DEW submit-failed branch requires isReportOwner
  • the "Fix issue" next step requires isCurrentUserTheApprover

Expected behavior

A failed DEW approval should only require attention from the user who can actually resolve it — the current approver (and arguably the report owner). Other participants should not get a GBR or a pinned LHN row.

Actual behavior

Every participant on the report gets the GBR and the pinned LHN row, with no matching next step telling them what to do.

Steps to reproduce

  1. Set up a workspace with a Dynamic External Workflow and several participants on an expense report.
  2. Submit the report, then have the submitter attempt to approve it themselves so the approval fails.
  3. Sign in as an unrelated participant (not owner, not manager, not the actor).
  4. The report appears in that user's LHN with a GBR, while their next step still shows "waiting for <approver> to approve".

Proposed fix

Gate the HAS_DEW_APPROVE_FAILED branch on the current user being the approver (or the report owner), matching how the DEW submit-failed branch and the "Fix issue" next step are already gated.

Reported in Slack.

Issue OwnerCurrent Issue Owner: @Krishna2323

Activity

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

Metadata

Metadata

Labels

BugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions