1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-22 11:45:59 +01:00

[PS-1194] Display Creation Date in Clients (#3181)

* Add CreationDate to common libs

* Add CreationDate to Browser

* Add CreationDate to CLI

* Add CreationDate to Desktop

* Add CreationDate to Web

* Update tests

Co-authored-by: Matt Gibson <mgibson@bitwarden.com>
This commit is contained in:
David Frankel 2022-10-11 21:25:27 -04:00 committed by GitHub
parent a1b13f9b18
commit 18bc209b73
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 54 additions and 0 deletions

View File

@ -1311,6 +1311,10 @@
"message": "Updated", "message": "Updated",
"description": "ex. Date this item was updated" "description": "ex. Date this item was updated"
}, },
"dateCreated": {
"message": "Created",
"description": "ex. Date this item was created"
},
"datePasswordUpdated": { "datePasswordUpdated": {
"message": "Password updated", "message": "Password updated",
"description": "ex. Date this password was updated" "description": "ex. Date this password was updated"

View File

@ -622,6 +622,10 @@
<b class="font-weight-semibold">{{ "dateUpdated" | i18n }}:</b> <b class="font-weight-semibold">{{ "dateUpdated" | i18n }}:</b>
{{ cipher.revisionDate | date: "medium" }} {{ cipher.revisionDate | date: "medium" }}
</div> </div>
<div *ngIf="cipher.creationDate">
<b class="font-weight-semibold">{{ "dateCreated" | i18n }}:</b>
{{ cipher.creationDate | date: "medium" }}
</div>
<div *ngIf="cipher.passwordRevisionDisplayDate"> <div *ngIf="cipher.passwordRevisionDisplayDate">
<b class="font-weight-semibold">{{ "datePasswordUpdated" | i18n }}:</b> <b class="font-weight-semibold">{{ "datePasswordUpdated" | i18n }}:</b>
{{ cipher.passwordRevisionDisplayDate | date: "medium" }} {{ cipher.passwordRevisionDisplayDate | date: "medium" }}

View File

@ -11,6 +11,7 @@ export class CipherResponse extends CipherWithIdExport implements BaseResponse {
object: string; object: string;
attachments: AttachmentResponse[]; attachments: AttachmentResponse[];
revisionDate: Date; revisionDate: Date;
creationDate: Date;
deletedDate: Date; deletedDate: Date;
passwordHistory: PasswordHistoryResponse[]; passwordHistory: PasswordHistoryResponse[];
@ -22,6 +23,9 @@ export class CipherResponse extends CipherWithIdExport implements BaseResponse {
this.attachments = o.attachments.map((a) => new AttachmentResponse(a)); this.attachments = o.attachments.map((a) => new AttachmentResponse(a));
} }
this.revisionDate = o.revisionDate; this.revisionDate = o.revisionDate;
if (o.creationDate != null) {
this.creationDate = o.creationDate;
}
this.deletedDate = o.deletedDate; this.deletedDate = o.deletedDate;
if (o.passwordHistory != null) { if (o.passwordHistory != null) {
this.passwordHistory = o.passwordHistory.map((h) => new PasswordHistoryResponse(h)); this.passwordHistory = o.passwordHistory.map((h) => new PasswordHistoryResponse(h));

View File

@ -475,6 +475,10 @@
<b class="font-weight-semibold">{{ "dateUpdated" | i18n }}:</b> <b class="font-weight-semibold">{{ "dateUpdated" | i18n }}:</b>
{{ cipher.revisionDate | date: "medium" }} {{ cipher.revisionDate | date: "medium" }}
</div> </div>
<div *ngIf="cipher.creationDate">
<b class="font-weight-semibold">{{ "dateCreated" | i18n }}:</b>
{{ cipher.creationDate | date: "medium" }}
</div>
<div *ngIf="cipher.passwordRevisionDisplayDate"> <div *ngIf="cipher.passwordRevisionDisplayDate">
<b class="font-weight-semibold">{{ "datePasswordUpdated" | i18n }}:</b> <b class="font-weight-semibold">{{ "datePasswordUpdated" | i18n }}:</b>
{{ cipher.passwordRevisionDisplayDate | date: "medium" }} {{ cipher.passwordRevisionDisplayDate | date: "medium" }}

View File

@ -1266,6 +1266,10 @@
"message": "Updated", "message": "Updated",
"description": "ex. Date this item was updated" "description": "ex. Date this item was updated"
}, },
"dateCreated": {
"message": "Created",
"description": "ex. Date this item was created"
},
"datePasswordUpdated": { "datePasswordUpdated": {
"message": "Password Updated", "message": "Password Updated",
"description": "ex. Date this password was updated" "description": "ex. Date this password was updated"

View File

@ -787,6 +787,10 @@
<b class="font-weight-semibold">{{ "dateUpdated" | i18n }}:</b> <b class="font-weight-semibold">{{ "dateUpdated" | i18n }}:</b>
{{ cipher.revisionDate | date: "medium" }} {{ cipher.revisionDate | date: "medium" }}
</div> </div>
<div *ngIf="cipher.creationDate">
<b class="font-weight-semibold">{{ "dateCreated" | i18n }}:</b>
{{ cipher.creationDate | date: "medium" }}
</div>
<div *ngIf="showRevisionDate"> <div *ngIf="showRevisionDate">
<b class="font-weight-semibold">{{ "datePasswordUpdated" | i18n }}:</b> <b class="font-weight-semibold">{{ "datePasswordUpdated" | i18n }}:</b>
{{ cipher.passwordRevisionDisplayDate | date: "medium" }} {{ cipher.passwordRevisionDisplayDate | date: "medium" }}

View File

@ -3313,6 +3313,10 @@
"message": "Updated", "message": "Updated",
"description": "ex. Date this item was updated" "description": "ex. Date this item was updated"
}, },
"dateCreated": {
"message": "Created",
"description": "ex. Date this item was created"
},
"datePasswordUpdated": { "datePasswordUpdated": {
"message": "Password Updated", "message": "Password Updated",
"description": "ex. Date this password was updated" "description": "ex. Date this password was updated"

View File

@ -42,6 +42,7 @@ describe("Cipher DTO", () => {
revisionDate: null, revisionDate: null,
collectionIds: undefined, collectionIds: undefined,
localData: null, localData: null,
creationDate: null,
deletedDate: null, deletedDate: null,
reprompt: undefined, reprompt: undefined,
attachments: null, attachments: null,
@ -66,6 +67,7 @@ describe("Cipher DTO", () => {
type: CipherType.Login, type: CipherType.Login,
name: "EncryptedString", name: "EncryptedString",
notes: "EncryptedString", notes: "EncryptedString",
creationDate: "2022-01-01T12:00:00.000Z",
deletedDate: null, deletedDate: null,
reprompt: CipherRepromptType.None, reprompt: CipherRepromptType.None,
login: { login: {
@ -131,6 +133,7 @@ describe("Cipher DTO", () => {
revisionDate: new Date("2022-01-31T12:00:00.000Z"), revisionDate: new Date("2022-01-31T12:00:00.000Z"),
collectionIds: undefined, collectionIds: undefined,
localData: null, localData: null,
creationDate: new Date("2022-01-01T12:00:00.000Z"),
deletedDate: null, deletedDate: null,
reprompt: 0, reprompt: 0,
login: { login: {
@ -200,6 +203,7 @@ describe("Cipher DTO", () => {
cipher.type = CipherType.Login; cipher.type = CipherType.Login;
cipher.name = mockEnc("EncryptedString"); cipher.name = mockEnc("EncryptedString");
cipher.notes = mockEnc("EncryptedString"); cipher.notes = mockEnc("EncryptedString");
cipher.creationDate = new Date("2022-01-01T12:00:00.000Z");
cipher.deletedDate = null; cipher.deletedDate = null;
cipher.reprompt = CipherRepromptType.None; cipher.reprompt = CipherRepromptType.None;
@ -230,6 +234,7 @@ describe("Cipher DTO", () => {
passwordHistory: null, passwordHistory: null,
collectionIds: undefined, collectionIds: undefined,
revisionDate: new Date("2022-01-31T12:00:00.000Z"), revisionDate: new Date("2022-01-31T12:00:00.000Z"),
creationDate: new Date("2022-01-01T12:00:00.000Z"),
deletedDate: null, deletedDate: null,
reprompt: 0, reprompt: 0,
localData: undefined, localData: undefined,
@ -253,6 +258,7 @@ describe("Cipher DTO", () => {
type: CipherType.SecureNote, type: CipherType.SecureNote,
name: "EncryptedString", name: "EncryptedString",
notes: "EncryptedString", notes: "EncryptedString",
creationDate: "2022-01-01T12:00:00.000Z",
deletedDate: null, deletedDate: null,
reprompt: CipherRepromptType.None, reprompt: CipherRepromptType.None,
secureNote: { secureNote: {
@ -278,6 +284,7 @@ describe("Cipher DTO", () => {
revisionDate: new Date("2022-01-31T12:00:00.000Z"), revisionDate: new Date("2022-01-31T12:00:00.000Z"),
collectionIds: undefined, collectionIds: undefined,
localData: null, localData: null,
creationDate: new Date("2022-01-01T12:00:00.000Z"),
deletedDate: null, deletedDate: null,
reprompt: 0, reprompt: 0,
secureNote: { type: SecureNoteType.Generic }, secureNote: { type: SecureNoteType.Generic },
@ -305,6 +312,7 @@ describe("Cipher DTO", () => {
cipher.type = CipherType.SecureNote; cipher.type = CipherType.SecureNote;
cipher.name = mockEnc("EncryptedString"); cipher.name = mockEnc("EncryptedString");
cipher.notes = mockEnc("EncryptedString"); cipher.notes = mockEnc("EncryptedString");
cipher.creationDate = new Date("2022-01-01T12:00:00.000Z");
cipher.deletedDate = null; cipher.deletedDate = null;
cipher.reprompt = CipherRepromptType.None; cipher.reprompt = CipherRepromptType.None;
cipher.secureNote = new SecureNote(); cipher.secureNote = new SecureNote();
@ -329,6 +337,7 @@ describe("Cipher DTO", () => {
passwordHistory: null, passwordHistory: null,
collectionIds: undefined, collectionIds: undefined,
revisionDate: new Date("2022-01-31T12:00:00.000Z"), revisionDate: new Date("2022-01-31T12:00:00.000Z"),
creationDate: new Date("2022-01-01T12:00:00.000Z"),
deletedDate: null, deletedDate: null,
reprompt: 0, reprompt: 0,
localData: undefined, localData: undefined,
@ -352,6 +361,7 @@ describe("Cipher DTO", () => {
type: CipherType.Card, type: CipherType.Card,
name: "EncryptedString", name: "EncryptedString",
notes: "EncryptedString", notes: "EncryptedString",
creationDate: "2022-01-01T12:00:00.000Z",
deletedDate: null, deletedDate: null,
reprompt: CipherRepromptType.None, reprompt: CipherRepromptType.None,
card: { card: {
@ -382,6 +392,7 @@ describe("Cipher DTO", () => {
revisionDate: new Date("2022-01-31T12:00:00.000Z"), revisionDate: new Date("2022-01-31T12:00:00.000Z"),
collectionIds: undefined, collectionIds: undefined,
localData: null, localData: null,
creationDate: new Date("2022-01-01T12:00:00.000Z"),
deletedDate: null, deletedDate: null,
reprompt: 0, reprompt: 0,
card: { card: {
@ -416,6 +427,7 @@ describe("Cipher DTO", () => {
cipher.type = CipherType.Card; cipher.type = CipherType.Card;
cipher.name = mockEnc("EncryptedString"); cipher.name = mockEnc("EncryptedString");
cipher.notes = mockEnc("EncryptedString"); cipher.notes = mockEnc("EncryptedString");
cipher.creationDate = new Date("2022-01-01T12:00:00.000Z");
cipher.deletedDate = null; cipher.deletedDate = null;
cipher.reprompt = CipherRepromptType.None; cipher.reprompt = CipherRepromptType.None;
@ -446,6 +458,7 @@ describe("Cipher DTO", () => {
passwordHistory: null, passwordHistory: null,
collectionIds: undefined, collectionIds: undefined,
revisionDate: new Date("2022-01-31T12:00:00.000Z"), revisionDate: new Date("2022-01-31T12:00:00.000Z"),
creationDate: new Date("2022-01-01T12:00:00.000Z"),
deletedDate: null, deletedDate: null,
reprompt: 0, reprompt: 0,
localData: undefined, localData: undefined,
@ -469,6 +482,7 @@ describe("Cipher DTO", () => {
type: CipherType.Identity, type: CipherType.Identity,
name: "EncryptedString", name: "EncryptedString",
notes: "EncryptedString", notes: "EncryptedString",
creationDate: "2022-01-01T12:00:00.000Z",
deletedDate: null, deletedDate: null,
reprompt: CipherRepromptType.None, reprompt: CipherRepromptType.None,
identity: { identity: {
@ -511,6 +525,7 @@ describe("Cipher DTO", () => {
revisionDate: new Date("2022-01-31T12:00:00.000Z"), revisionDate: new Date("2022-01-31T12:00:00.000Z"),
collectionIds: undefined, collectionIds: undefined,
localData: null, localData: null,
creationDate: new Date("2022-01-01T12:00:00.000Z"),
deletedDate: null, deletedDate: null,
reprompt: 0, reprompt: 0,
identity: { identity: {
@ -557,6 +572,7 @@ describe("Cipher DTO", () => {
cipher.type = CipherType.Identity; cipher.type = CipherType.Identity;
cipher.name = mockEnc("EncryptedString"); cipher.name = mockEnc("EncryptedString");
cipher.notes = mockEnc("EncryptedString"); cipher.notes = mockEnc("EncryptedString");
cipher.creationDate = new Date("2022-01-01T12:00:00.000Z");
cipher.deletedDate = null; cipher.deletedDate = null;
cipher.reprompt = CipherRepromptType.None; cipher.reprompt = CipherRepromptType.None;
@ -587,6 +603,7 @@ describe("Cipher DTO", () => {
passwordHistory: null, passwordHistory: null,
collectionIds: undefined, collectionIds: undefined,
revisionDate: new Date("2022-01-31T12:00:00.000Z"), revisionDate: new Date("2022-01-31T12:00:00.000Z"),
creationDate: new Date("2022-01-01T12:00:00.000Z"),
deletedDate: null, deletedDate: null,
reprompt: 0, reprompt: 0,
localData: undefined, localData: undefined,

View File

@ -30,6 +30,7 @@ export class CipherData {
attachments?: AttachmentData[]; attachments?: AttachmentData[];
passwordHistory?: PasswordHistoryData[]; passwordHistory?: PasswordHistoryData[];
collectionIds?: string[]; collectionIds?: string[];
creationDate: string;
deletedDate: string; deletedDate: string;
reprompt: CipherRepromptType; reprompt: CipherRepromptType;
@ -50,6 +51,7 @@ export class CipherData {
this.name = response.name; this.name = response.name;
this.notes = response.notes; this.notes = response.notes;
this.collectionIds = collectionIds != null ? collectionIds : response.collectionIds; this.collectionIds = collectionIds != null ? collectionIds : response.collectionIds;
this.creationDate = response.creationDate;
this.deletedDate = response.deletedDate; this.deletedDate = response.deletedDate;
this.reprompt = response.reprompt; this.reprompt = response.reprompt;

View File

@ -38,6 +38,7 @@ export class Cipher extends Domain {
fields: Field[]; fields: Field[];
passwordHistory: Password[]; passwordHistory: Password[];
collectionIds: string[]; collectionIds: string[];
creationDate: Date;
deletedDate: Date; deletedDate: Date;
reprompt: CipherRepromptType; reprompt: CipherRepromptType;
@ -72,6 +73,7 @@ export class Cipher extends Domain {
this.revisionDate = obj.revisionDate != null ? new Date(obj.revisionDate) : null; this.revisionDate = obj.revisionDate != null ? new Date(obj.revisionDate) : null;
this.collectionIds = obj.collectionIds; this.collectionIds = obj.collectionIds;
this.localData = localData; this.localData = localData;
this.creationDate = obj.creationDate != null ? new Date(obj.creationDate) : null;
this.deletedDate = obj.deletedDate != null ? new Date(obj.deletedDate) : null; this.deletedDate = obj.deletedDate != null ? new Date(obj.deletedDate) : null;
this.reprompt = obj.reprompt; this.reprompt = obj.reprompt;
@ -200,6 +202,7 @@ export class Cipher extends Domain {
c.revisionDate = this.revisionDate != null ? this.revisionDate.toISOString() : null; c.revisionDate = this.revisionDate != null ? this.revisionDate.toISOString() : null;
c.type = this.type; c.type = this.type;
c.collectionIds = this.collectionIds; c.collectionIds = this.collectionIds;
c.creationDate = this.creationDate != null ? this.creationDate.toISOString() : null;
c.deletedDate = this.deletedDate != null ? this.deletedDate.toISOString() : null; c.deletedDate = this.deletedDate != null ? this.deletedDate.toISOString() : null;
c.reprompt = this.reprompt; c.reprompt = this.reprompt;

View File

@ -29,6 +29,7 @@ export class CipherResponse extends BaseResponse {
attachments: AttachmentResponse[]; attachments: AttachmentResponse[];
passwordHistory: PasswordHistoryResponse[]; passwordHistory: PasswordHistoryResponse[];
collectionIds: string[]; collectionIds: string[];
creationDate: string;
deletedDate: string; deletedDate: string;
reprompt: CipherRepromptType; reprompt: CipherRepromptType;
@ -50,6 +51,7 @@ export class CipherResponse extends BaseResponse {
this.organizationUseTotp = this.getResponseProperty("OrganizationUseTotp"); this.organizationUseTotp = this.getResponseProperty("OrganizationUseTotp");
this.revisionDate = this.getResponseProperty("RevisionDate"); this.revisionDate = this.getResponseProperty("RevisionDate");
this.collectionIds = this.getResponseProperty("CollectionIds"); this.collectionIds = this.getResponseProperty("CollectionIds");
this.creationDate = this.getResponseProperty("CreationDate");
this.deletedDate = this.getResponseProperty("DeletedDate"); this.deletedDate = this.getResponseProperty("DeletedDate");
const login = this.getResponseProperty("Login"); const login = this.getResponseProperty("Login");

View File

@ -36,6 +36,7 @@ export class CipherView implements View {
passwordHistory: PasswordHistoryView[] = null; passwordHistory: PasswordHistoryView[] = null;
collectionIds: string[] = null; collectionIds: string[] = null;
revisionDate: Date = null; revisionDate: Date = null;
creationDate: Date = null;
deletedDate: Date = null; deletedDate: Date = null;
reprompt: CipherRepromptType = CipherRepromptType.None; reprompt: CipherRepromptType = CipherRepromptType.None;
@ -55,6 +56,7 @@ export class CipherView implements View {
this.localData = c.localData; this.localData = c.localData;
this.collectionIds = c.collectionIds; this.collectionIds = c.collectionIds;
this.revisionDate = c.revisionDate; this.revisionDate = c.revisionDate;
this.creationDate = c.creationDate;
this.deletedDate = c.deletedDate; this.deletedDate = c.deletedDate;
// Old locally stored ciphers might have reprompt == null. If so set it to None. // Old locally stored ciphers might have reprompt == null. If so set it to None.
this.reprompt = c.reprompt ?? CipherRepromptType.None; this.reprompt = c.reprompt ?? CipherRepromptType.None;