[PM-41028] feat: Restrict View Send screen for policy non-compliant Sends - #2920
Conversation
🤖 Bitwarden Claude Code ReviewOverall Assessment: REQUEST CHANGES Reviewed the View Send screen restrictions for policy non-compliant Sends: the new Code Review Details
|
| /// Whether this Send has been disabled. | ||
| var isDisabled: Bool { | ||
| sendView.disabled | ||
| } |
There was a problem hiding this comment.
isDisabled treats every deactivated Send as a policy violation, with no Send Controls gate.
Details and fix
sendView.disabled is the user-controlled "Deactivate this Send" flag, not a policy-violation marker. It's round-tripped through AddEditSendItemState (isDeactivateThisSendOn: sendView.disabled → disabled: isDeactivateThisSendOn) and already surfaced independently in the Send list as DisabledSendIcon.
Consequences for a Send the user deactivated themselves (e.g. from the web vault):
- The banner claims "Organization policy restriction" for a Send that violates no policy.
sendLinkand the edit FAB are both hidden, so the Send can no longer be re-activated or edited from iOS.
This also isn't gated by the .sendControls feature flag. getSendPolicyOptions() returns empty options when the flag is off, so isSendTypeRestricted is false, but isDisabled never consults the flag or the policy — meaning the new banner and the hidden edit button ship to all users with a deactivated Send while the feature is still flagged off.
Consider gating on the Send Controls policy actually applying (flag enabled and non-default sendPolicyOptions), or deriving non-compliance from comparing the Send's fields to sendPolicyOptions rather than from disabled alone.
|
|
||
| self.init( | ||
| accessType: accessType, | ||
| isHideMyEmailOn: sendView.hideEmail, |
There was a problem hiding this comment.
hideEmail even when policy disables it, so the new Send is still non-compliant.
Details and fix
Hide-email is one of the restricted fields that makes a Send non-compliant, and it's exactly the case where "Make a copy" is offered (canMakeCopy is true for any disabled text Send whose type isn't restricted).
But the copy is never corrected for it:
AddEditSendItemProcessor.loadData()only overridesaccessTypeandpolicyEnforcedDeletionDate.shouldShowHideEmailFieldisfalsewhile the Send Controls policy disables hide-email, so the toggle isn't rendered.
The result is a new Send saved with hideEmail: true under a policy that forbids it, with no UI affordance for the user to fix it.
// AddEditSendItemProcessor.loadData()
if state.sendPolicyOptions.isHideEmailDisabled {
state.isHideMyEmailOn = false
}
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## matt/PM-38792-send-controls-restrict-deletion-days #2920 +/- ##
======================================================================================
+ Coverage 78.88% 78.98% +0.10%
======================================================================================
Files 1162 1168 +6
Lines 74715 75039 +324
======================================================================================
+ Hits 58939 59270 +331
+ Misses 15776 15769 -7 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
🎟️ Tracking
PM-41028
📔 Objective
SendPolicyOptions.isSendTypeRestricted(for:)to determine whether an existing Send violates the active Send Controls policy (restricted type takes priority over restricted access type/deletion date/hide-email).ActionCard"Organization policy restriction" banner for non-compliant Sends, with copy varying by violation: restricted text type, restricted file type, or restricted fields (with a "Make a copy" action).AddEditSendItemProcessorpolicy-enforcement logic.📸 Screenshots