-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[PM-7407] Implemented check for organizations with unassigned items #3150
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,6 +46,7 @@ public static class Constants | |
public const string PreLoginEmailKey = "preLoginEmailKey"; | ||
public const string ConfigsKey = "configsKey"; | ||
public const string DisplayEuEnvironmentFlag = "display-eu-environment"; | ||
public const string UnassignedItemsBannerFlag = "unassigned-items-banner"; | ||
public const string RegionEnvironment = "regionEnvironment"; | ||
public const string DuoCallback = "bitwarden://duo-callback"; | ||
|
||
|
@@ -136,6 +137,7 @@ public static string AccountBiometricIntegrityValidKey(string userId, string sys | |
public static string ShouldConnectToWatchKey(string userId) => $"shouldConnectToWatch_{userId}"; | ||
public static string ScreenCaptureAllowedKey(string userId) => $"screenCaptureAllowed_{userId}"; | ||
public static string PendingAdminAuthRequest(string userId) => $"pendingAdminAuthRequest_{userId}"; | ||
public static string ShouldCheckOrganizationUnassignedItemsKey(string userId) => $"shouldCheckOrganizationUnassignedItems_{userId}"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ⛏️ (not really relevant but worth mentioning) other similar constants don't have verbiage like "ShouldCheck". There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. IMO without the "should check" one doesn't know what the flag is for, only that it has to do with organization unassigned items. However, if having the verbiage alike others is more important I can change it. |
||
[Obsolete] | ||
public static string KeyKey(string userId) => $"key_{userId}"; | ||
[Obsolete] | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -233,6 +233,7 @@ private async Task UnlockedAsync() | |
} | ||
var previousPage = await AppHelpers.ClearPreviousPage(); | ||
|
||
_appOptions.HasJustLoggedInOrUnlocked = true; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💭 Instead of having this variable scattered around and risk missing a path to the vault, can't we just check once on TabsPage.OnCreate with a control variable There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The problem is that |
||
App.MainPage = new TabsPage(_appOptions, previousPage); | ||
} | ||
} | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -829,6 +829,24 @@ public async Task RestoreWithServerAsync(string id) | |
await ClearCacheAsync(); | ||
} | ||
|
||
public async Task<bool> VerifyOrganizationHasUnassignedItemsAsync() | ||
{ | ||
var organizations = await _stateService.GetOrganizationsAsync(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🤔 I'm not sure if it's possible for this to return 0 orgs and the next call returning true, I just noticed other clients aren't checking this. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is exactly why I had to wait for synchronization to complete, otherwise we'd have 0 orgs right after logging in given the sync wouldn't have finished. |
||
if (organizations?.Any() != true) | ||
{ | ||
return false; | ||
} | ||
|
||
try | ||
{ | ||
return await _apiService.HasUnassignedCiphersAsync(); | ||
} | ||
catch (ApiException ex) when (ex.Error?.StatusCode == System.Net.HttpStatusCode.BadRequest) | ||
{ | ||
return false; | ||
} | ||
} | ||
|
||
// Helpers | ||
|
||
private async Task<Tuple<SymmetricCryptoKey, EncString, SymmetricCryptoKey>> MakeAttachmentKeyAsync(string organizationId, Cipher cipher = null, CipherView cipherView = null) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤔 Naming wise, following a similar pattern to the other prompts (e.g.
Get/Set UnassignedItemsPromptShownAsync
) would make it easier to find this in the future.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem is that this getter doesn't return if the prompt has been shown or not, it returns whether the check (and potentially the prompt) should be done or not, i.e. if the user chose "Remind me later" or not.
Also there are also two other that have
Should
:Even though I agree having everything with the same name structure is better, but on the other hand I like having specific naming so one can exactly know what the method/property does without having to look much in other places.
What do you think?