Skip to content
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

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

Merged
merged 8 commits into from
Oct 12, 2022
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions apps/browser/src/_locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -1311,6 +1311,10 @@
"message": "Updated",
"description": "ex. Date this item was updated"
},
"dateCreated": {
"message": "Created",
"description": "ex. Date this item was created"
},
"datePasswordUpdated": {
"message": "Password Updated",
"description": "ex. Date this password was updated"
Expand Down
4 changes: 4 additions & 0 deletions apps/browser/src/popup/vault/view.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,10 @@ <h2 class="box-header">
<b class="font-weight-semibold">{{ "dateUpdated" | i18n }}:</b>
{{ cipher.revisionDate | date: "medium" }}
</div>
<div *ngIf="cipher.creationDate">
<b class="font-weight-semibold">{{ "dateCreated" | i18n }}:</b>
{{ cipher.creationDate | date: "medium" }}
</div>
<div *ngIf="cipher.passwordRevisionDisplayDate">
<b class="font-weight-semibold">{{ "datePasswordUpdated" | i18n }}:</b>
{{ cipher.passwordRevisionDisplayDate | date: "medium" }}
Expand Down
4 changes: 4 additions & 0 deletions apps/cli/src/models/response/cipherResponse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export class CipherResponse extends CipherWithIdExport implements BaseResponse {
object: string;
attachments: AttachmentResponse[];
revisionDate: Date;
creationDate: Date;
deletedDate: Date;
passwordHistory: PasswordHistoryResponse[];

Expand All @@ -22,6 +23,9 @@ export class CipherResponse extends CipherWithIdExport implements BaseResponse {
this.attachments = o.attachments.map((a) => new AttachmentResponse(a));
}
this.revisionDate = o.revisionDate;
if (o.creationDate != null) {
this.creationDate = o.creationDate;
}
this.deletedDate = o.deletedDate;
if (o.passwordHistory != null) {
this.passwordHistory = o.passwordHistory.map((h) => new PasswordHistoryResponse(h));
Expand Down
4 changes: 4 additions & 0 deletions apps/desktop/src/app/vault/view.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,10 @@
<b class="font-weight-semibold">{{ "dateUpdated" | i18n }}:</b>
{{ cipher.revisionDate | date: "medium" }}
</div>
<div *ngIf="cipher.creationDate">
<b class="font-weight-semibold">{{ "dateCreated" | i18n }}:</b>
{{ cipher.creationDate | date: "medium" }}
</div>
<div *ngIf="cipher.passwordRevisionDisplayDate">
<b class="font-weight-semibold">{{ "datePasswordUpdated" | i18n }}:</b>
{{ cipher.passwordRevisionDisplayDate | date: "medium" }}
Expand Down
4 changes: 4 additions & 0 deletions apps/desktop/src/locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -1266,6 +1266,10 @@
"message": "Updated",
"description": "ex. Date this item was updated"
},
"dateCreated": {
"message": "Created",
"description": "ex. Date this item was created"
},
"datePasswordUpdated": {
"message": "Password Updated",
"description": "ex. Date this password was updated"
Expand Down
4 changes: 4 additions & 0 deletions apps/web/src/app/vault/add-edit.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -753,6 +753,10 @@ <h3 class="mt-4">{{ "collections" | i18n }}</h3>
<b class="font-weight-semibold">{{ "dateUpdated" | i18n }}:</b>
{{ cipher.revisionDate | date: "medium" }}
</div>
<div *ngIf="cipher.creationDate">
<b class="font-weight-semibold">{{ "dateCreated" | i18n }}:</b>
{{ cipher.creationDate | date: "medium" }}
</div>
<div *ngIf="showRevisionDate">
<b class="font-weight-semibold">{{ "datePasswordUpdated" | i18n }}:</b>
{{ cipher.passwordRevisionDisplayDate | date: "medium" }}
Expand Down
4 changes: 4 additions & 0 deletions apps/web/src/locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -3250,6 +3250,10 @@
"message": "Updated",
"description": "ex. Date this item was updated"
},
"dateCreated": {
"message": "Created",
"description": "ex. Date this item was created"
},
"datePasswordUpdated": {
"message": "Password Updated",
"description": "ex. Date this password was updated"
Expand Down
17 changes: 17 additions & 0 deletions libs/common/spec/domain/cipher.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ describe("Cipher DTO", () => {
revisionDate: null,
collectionIds: undefined,
localData: null,
creationDate: null,
deletedDate: null,
reprompt: undefined,
attachments: null,
Expand All @@ -60,6 +61,7 @@ describe("Cipher DTO", () => {
type: CipherType.Login,
name: "EncryptedString",
notes: "EncryptedString",
creationDate: null,
frankeld marked this conversation as resolved.
Show resolved Hide resolved
deletedDate: null,
reprompt: CipherRepromptType.None,
login: {
Expand Down Expand Up @@ -125,6 +127,7 @@ describe("Cipher DTO", () => {
revisionDate: new Date("2022-01-31T12:00:00.000Z"),
collectionIds: undefined,
localData: null,
creationDate: null,
deletedDate: null,
reprompt: 0,
login: {
Expand Down Expand Up @@ -194,6 +197,7 @@ describe("Cipher DTO", () => {
cipher.type = CipherType.Login;
cipher.name = mockEnc("EncryptedString");
cipher.notes = mockEnc("EncryptedString");
cipher.creationDate = null;
cipher.deletedDate = null;
cipher.reprompt = CipherRepromptType.None;

Expand Down Expand Up @@ -224,6 +228,7 @@ describe("Cipher DTO", () => {
passwordHistory: null,
collectionIds: undefined,
revisionDate: new Date("2022-01-31T12:00:00.000Z"),
creationDate: null,
deletedDate: null,
reprompt: 0,
localData: undefined,
Expand All @@ -247,6 +252,7 @@ describe("Cipher DTO", () => {
type: CipherType.SecureNote,
name: "EncryptedString",
notes: "EncryptedString",
creationDate: null,
deletedDate: null,
reprompt: CipherRepromptType.None,
secureNote: {
Expand All @@ -272,6 +278,7 @@ describe("Cipher DTO", () => {
revisionDate: new Date("2022-01-31T12:00:00.000Z"),
collectionIds: undefined,
localData: null,
creationDate: null,
deletedDate: null,
reprompt: 0,
secureNote: { type: SecureNoteType.Generic },
Expand Down Expand Up @@ -299,6 +306,7 @@ describe("Cipher DTO", () => {
cipher.type = CipherType.SecureNote;
cipher.name = mockEnc("EncryptedString");
cipher.notes = mockEnc("EncryptedString");
cipher.creationDate = null;
cipher.deletedDate = null;
cipher.reprompt = CipherRepromptType.None;
cipher.secureNote = new SecureNote();
Expand All @@ -323,6 +331,7 @@ describe("Cipher DTO", () => {
passwordHistory: null,
collectionIds: undefined,
revisionDate: new Date("2022-01-31T12:00:00.000Z"),
creationDate: null,
deletedDate: null,
reprompt: 0,
localData: undefined,
Expand All @@ -346,6 +355,7 @@ describe("Cipher DTO", () => {
type: CipherType.Card,
name: "EncryptedString",
notes: "EncryptedString",
creationDate: null,
deletedDate: null,
reprompt: CipherRepromptType.None,
card: {
Expand Down Expand Up @@ -376,6 +386,7 @@ describe("Cipher DTO", () => {
revisionDate: new Date("2022-01-31T12:00:00.000Z"),
collectionIds: undefined,
localData: null,
creationDate: null,
deletedDate: null,
reprompt: 0,
card: {
Expand Down Expand Up @@ -410,6 +421,7 @@ describe("Cipher DTO", () => {
cipher.type = CipherType.Card;
cipher.name = mockEnc("EncryptedString");
cipher.notes = mockEnc("EncryptedString");
cipher.creationDate = null;
cipher.deletedDate = null;
cipher.reprompt = CipherRepromptType.None;

Expand Down Expand Up @@ -440,6 +452,7 @@ describe("Cipher DTO", () => {
passwordHistory: null,
collectionIds: undefined,
revisionDate: new Date("2022-01-31T12:00:00.000Z"),
creationDate: null,
deletedDate: null,
reprompt: 0,
localData: undefined,
Expand All @@ -463,6 +476,7 @@ describe("Cipher DTO", () => {
type: CipherType.Identity,
name: "EncryptedString",
notes: "EncryptedString",
creationDate: null,
deletedDate: null,
reprompt: CipherRepromptType.None,
identity: {
Expand Down Expand Up @@ -505,6 +519,7 @@ describe("Cipher DTO", () => {
revisionDate: new Date("2022-01-31T12:00:00.000Z"),
collectionIds: undefined,
localData: null,
creationDate: null,
deletedDate: null,
reprompt: 0,
identity: {
Expand Down Expand Up @@ -551,6 +566,7 @@ describe("Cipher DTO", () => {
cipher.type = CipherType.Identity;
cipher.name = mockEnc("EncryptedString");
cipher.notes = mockEnc("EncryptedString");
cipher.creationDate = null;
cipher.deletedDate = null;
cipher.reprompt = CipherRepromptType.None;

Expand Down Expand Up @@ -581,6 +597,7 @@ describe("Cipher DTO", () => {
passwordHistory: null,
collectionIds: undefined,
revisionDate: new Date("2022-01-31T12:00:00.000Z"),
creationDate: null,
deletedDate: null,
reprompt: 0,
localData: undefined,
Expand Down
2 changes: 2 additions & 0 deletions libs/common/src/models/data/cipherData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export class CipherData {
attachments?: AttachmentData[];
passwordHistory?: PasswordHistoryData[];
collectionIds?: string[];
creationDate: string;
deletedDate: string;
reprompt: CipherRepromptType;

Expand All @@ -50,6 +51,7 @@ export class CipherData {
this.name = response.name;
this.notes = response.notes;
this.collectionIds = collectionIds != null ? collectionIds : response.collectionIds;
this.creationDate = response.creationDate;
this.deletedDate = response.deletedDate;
this.reprompt = response.reprompt;

Expand Down
3 changes: 3 additions & 0 deletions libs/common/src/models/domain/cipher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export class Cipher extends Domain {
fields: Field[];
passwordHistory: Password[];
collectionIds: string[];
creationDate: Date;
deletedDate: Date;
reprompt: CipherRepromptType;

Expand Down Expand Up @@ -69,6 +70,7 @@ export class Cipher extends Domain {
this.revisionDate = obj.revisionDate != null ? new Date(obj.revisionDate) : null;
this.collectionIds = obj.collectionIds;
this.localData = localData;
this.creationDate = obj.creationDate != null ? new Date(obj.creationDate) : null;
this.deletedDate = obj.deletedDate != null ? new Date(obj.deletedDate) : null;
this.reprompt = obj.reprompt;

Expand Down Expand Up @@ -197,6 +199,7 @@ export class Cipher extends Domain {
c.revisionDate = this.revisionDate != null ? this.revisionDate.toISOString() : null;
c.type = this.type;
c.collectionIds = this.collectionIds;
c.creationDate = this.creationDate != null ? this.creationDate.toISOString() : null;
c.deletedDate = this.deletedDate != null ? this.deletedDate.toISOString() : null;
c.reprompt = this.reprompt;

Expand Down
2 changes: 2 additions & 0 deletions libs/common/src/models/response/cipherResponse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export class CipherResponse extends BaseResponse {
attachments: AttachmentResponse[];
passwordHistory: PasswordHistoryResponse[];
collectionIds: string[];
creationDate: string;
deletedDate: string;
reprompt: CipherRepromptType;

Expand All @@ -50,6 +51,7 @@ export class CipherResponse extends BaseResponse {
this.organizationUseTotp = this.getResponseProperty("OrganizationUseTotp");
this.revisionDate = this.getResponseProperty("RevisionDate");
this.collectionIds = this.getResponseProperty("CollectionIds");
this.creationDate = this.getResponseProperty("CreationDate");
this.deletedDate = this.getResponseProperty("DeletedDate");

const login = this.getResponseProperty("Login");
Expand Down
2 changes: 2 additions & 0 deletions libs/common/src/models/view/cipherView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export class CipherView implements View {
passwordHistory: PasswordHistoryView[] = null;
collectionIds: string[] = null;
revisionDate: Date = null;
creationDate: Date = null;
deletedDate: Date = null;
reprompt: CipherRepromptType = CipherRepromptType.None;

Expand All @@ -52,6 +53,7 @@ export class CipherView implements View {
this.localData = c.localData;
this.collectionIds = c.collectionIds;
this.revisionDate = c.revisionDate;
this.creationDate = c.creationDate;
this.deletedDate = c.deletedDate;
// Old locally stored ciphers might have reprompt == null. If so set it to None.
this.reprompt = c.reprompt ?? CipherRepromptType.None;
Expand Down