mirror of
https://github.com/bitwarden/browser
synced 2025-12-16 08:13:42 +00:00
fixed up the send date fallbacks again (#293)
* fixed up the send date fallbacks again * gave localizations string a better name * added fallback values to clear expiration
This commit is contained in:
@@ -114,7 +114,9 @@ export class AddEditComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get expirationDateTimeFallback() {
|
get expirationDateTimeFallback() {
|
||||||
return `${this.expirationDateFallback}T${this.expirationTimeFallback}`;
|
return this.nullOrWhiteSpaceCount([this.expirationDateFallback, this.expirationTimeFallback]) > 0 ?
|
||||||
|
null :
|
||||||
|
`${this.expirationDateFallback}T${this.expirationTimeFallback}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
get deletionDateTimeFallback() {
|
get deletionDateTimeFallback() {
|
||||||
@@ -175,7 +177,12 @@ export class AddEditComponent implements OnInit {
|
|||||||
async submit(): Promise<boolean> {
|
async submit(): Promise<boolean> {
|
||||||
if (!this.isDateTimeLocalSupported) {
|
if (!this.isDateTimeLocalSupported) {
|
||||||
this.deletionDate = this.deletionDateTimeFallback;
|
this.deletionDate = this.deletionDateTimeFallback;
|
||||||
if ((this.editMode && this.expirationDateFallback != null) || this.expirationDateSelect === 0) {
|
if (this.nullOrWhiteSpaceCount([this.expirationDateFallback, this.expirationTimeFallback]) === 1) {
|
||||||
|
this.platformUtilsService.showToast('error', this.i18nService.t('errorOccurred'),
|
||||||
|
this.i18nService.t('expirationDateAndTimeRequired'));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (this.editMode || this.expirationDateSelect === 0) {
|
||||||
this.expirationDate = this.expirationDateTimeFallback;
|
this.expirationDate = this.expirationDateTimeFallback;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -252,6 +259,8 @@ export class AddEditComponent implements OnInit {
|
|||||||
|
|
||||||
clearExpiration() {
|
clearExpiration() {
|
||||||
this.expirationDate = null;
|
this.expirationDate = null;
|
||||||
|
this.expirationDateFallback = null;
|
||||||
|
this.expirationTimeFallback = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
copyLinkToClipboard(link: string) {
|
copyLinkToClipboard(link: string) {
|
||||||
@@ -333,4 +342,8 @@ export class AddEditComponent implements OnInit {
|
|||||||
this.showPassword = !this.showPassword;
|
this.showPassword = !this.showPassword;
|
||||||
document.getElementById('password').focus();
|
document.getElementById('password').focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected nullOrWhiteSpaceCount(strarray: string[]): number {
|
||||||
|
return strarray.filter(str => str == null || str.trim() === '').length;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user