From b4790583bbd809be27c3f2c918c0afd08540d3d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9rard=20Dethier?= Date: Thu, 23 Nov 2023 15:24:01 +0100 Subject: [PATCH] feat: no removal when item accepted. logion-network/logion-internal#1076 --- src/loc/CustomItemActions.test.tsx | 4 +- src/loc/LocItem.tsx | 2 +- src/loc/TemplateItemActions.test.tsx | 4 +- .../CustomItemActions.test.tsx.snap | 618 ++--------------- .../TemplateItemActions.test.tsx.snap | 620 +----------------- 5 files changed, 71 insertions(+), 1177 deletions(-) diff --git a/src/loc/CustomItemActions.test.tsx b/src/loc/CustomItemActions.test.tsx index 211b695b..267033fd 100644 --- a/src/loc/CustomItemActions.test.tsx +++ b/src/loc/CustomItemActions.test.tsx @@ -36,7 +36,7 @@ function tests(itemFactory: (status: ItemStatus, submitter: ValidAccountId) => I renderAndExpectMatchWith(itemFactory("REVIEW_PENDING", REQUESTER), undefined); }); - it("can be published or deleted by requester when approved", () => { + it("can be published by requester when approved", () => { asRequester(); givenOpenLoc(); renderAndExpectMatchWith(itemFactory("REVIEW_ACCEPTED", REQUESTER), "Requester"); @@ -72,7 +72,7 @@ function tests(itemFactory: (status: ItemStatus, submitter: ValidAccountId) => I renderAndExpectMatchWith(itemFactory("DRAFT", ISSUER), "VerifiedIssuer"); }); - it("can be published or deleted by requester when approved and submitted by issuer", () => { + it("can be published by requester when approved and submitted by issuer", () => { asIssuer(); givenOpenLoc(); renderAndExpectMatchWith(itemFactory("REVIEW_ACCEPTED", ISSUER), "Requester"); diff --git a/src/loc/LocItem.tsx b/src/loc/LocItem.tsx index d71c62e8..c19ea396 100644 --- a/src/loc/LocItem.tsx +++ b/src/loc/LocItem.tsx @@ -425,7 +425,7 @@ export function useDeleteLinkCallback(mutateLocState: (mutator: (current: LocReq export function canDelete(account: ValidAccountId | undefined, item: LocItem, viewer: Viewer, loc: LocData): boolean { return item.submitter?.address === account?.address && item.submitter?.type === account?.type && (loc.status === "DRAFT" || loc.status === "OPEN") - && (item.status === "DRAFT" || (item.status === "REVIEW_ACCEPTED" && item.submitter?.type === "Polkadot") || item.status === "REVIEW_REJECTED"); + && (item.status === "DRAFT" || item.status === "REVIEW_REJECTED"); } export function canAdd(viewer: Viewer, loc: LocData) { diff --git a/src/loc/TemplateItemActions.test.tsx b/src/loc/TemplateItemActions.test.tsx index 424651a6..b3ebb884 100644 --- a/src/loc/TemplateItemActions.test.tsx +++ b/src/loc/TemplateItemActions.test.tsx @@ -43,7 +43,7 @@ function tests(itemFactory: (status: ItemStatus | undefined, submitter: ValidAcc renderAndExpectMatchWith(itemFactory("REVIEW_PENDING", REQUESTER), undefined); }); - it("can be published or cleared by requester when approved", () => { + it("can be published by requester when approved", () => { asRequester(); givenOpenLoc(); renderAndExpectMatchWith(itemFactory("REVIEW_ACCEPTED", REQUESTER), "Requester"); @@ -79,7 +79,7 @@ function tests(itemFactory: (status: ItemStatus | undefined, submitter: ValidAcc renderAndExpectMatchWith(itemFactory("DRAFT", ISSUER), "VerifiedIssuer"); }); - it("can be published or cleared by requester when approved and submitted by issuer", () => { + it("can be published by requester when approved and submitted by issuer", () => { asIssuer(); givenOpenLoc(); renderAndExpectMatchWith(itemFactory("REVIEW_ACCEPTED", ISSUER), "Requester"); diff --git a/src/loc/__snapshots__/CustomItemActions.test.tsx.snap b/src/loc/__snapshots__/CustomItemActions.test.tsx.snap index 3778243e..7c2b9ae8 100644 --- a/src/loc/__snapshots__/CustomItemActions.test.tsx.snap +++ b/src/loc/__snapshots__/CustomItemActions.test.tsx.snap @@ -764,7 +764,7 @@ exports[`CustomItemActions Links can be acknowledged by owner when published 1`] `; -exports[`CustomItemActions Links can be published or deleted by requester when approved 1`] = ` +exports[`CustomItemActions Links can be published by requester when approved 1`] = ` - @@ -975,7 +909,7 @@ exports[`CustomItemActions Links can be published or deleted by requester when a `; -exports[`CustomItemActions Links can be published or deleted by requester when approved and submitted by issuer 1`] = ` +exports[`CustomItemActions Links can be published by requester when approved and submitted by issuer 1`] = ` - @@ -2963,7 +2831,7 @@ exports[`CustomItemActions Private files can be acknowledged by owner when publi `; -exports[`CustomItemActions Private files can be published or deleted by requester when approved 1`] = ` +exports[`CustomItemActions Private files can be published by requester when approved 1`] = ` - @@ -3285,7 +3050,7 @@ exports[`CustomItemActions Private files can be published or deleted by requeste `; -exports[`CustomItemActions Private files can be published or deleted by requester when approved and submitted by issuer 1`] = ` +exports[`CustomItemActions Private files can be published by requester when approved and submitted by issuer 1`] = ` - - + /> + @@ -5717,7 +5379,7 @@ exports[`CustomItemActions Public data can be acknowledged by owner when publish `; -exports[`CustomItemActions Public data can be published or deleted by requester when approved 1`] = ` +exports[`CustomItemActions Public data can be published by requester when approved 1`] = ` - @@ -6039,7 +5598,7 @@ exports[`CustomItemActions Public data can be published or deleted by requester `; -exports[`CustomItemActions Public data can be published or deleted by requester when approved and submitted by issuer 1`] = ` +exports[`CustomItemActions Public data can be published by requester when approved and submitted by issuer 1`] = ` - diff --git a/src/loc/__snapshots__/TemplateItemActions.test.tsx.snap b/src/loc/__snapshots__/TemplateItemActions.test.tsx.snap index 82fb5407..94fad7b1 100644 --- a/src/loc/__snapshots__/TemplateItemActions.test.tsx.snap +++ b/src/loc/__snapshots__/TemplateItemActions.test.tsx.snap @@ -794,7 +794,7 @@ exports[`TemplateItemActions Links can be acknowledged by owner when published 1 `; -exports[`TemplateItemActions Links can be published or cleared by requester when approved 1`] = ` +exports[`TemplateItemActions Links can be published by requester when approved 1`] = ` @@ -871,75 +871,6 @@ exports[`TemplateItemActions Links can be published or cleared by requester when } /> - @@ -1016,7 +947,7 @@ exports[`TemplateItemActions Links can be published or cleared by requester when `; -exports[`TemplateItemActions Links can be published or cleared by requester when approved and submitted by issuer 1`] = ` +exports[`TemplateItemActions Links can be published by requester when approved and submitted by issuer 1`] = ` @@ -1093,75 +1024,6 @@ exports[`TemplateItemActions Links can be published or cleared by requester when } /> - @@ -3159,7 +3021,7 @@ exports[`TemplateItemActions Private files can be acknowledged by owner when pub `; -exports[`TemplateItemActions Private files can be published or cleared by requester when approved 1`] = ` +exports[`TemplateItemActions Private files can be published by requester when approved 1`] = ` @@ -3273,112 +3135,6 @@ exports[`TemplateItemActions Private files can be published or cleared by reques } /> - @@ -3492,7 +3248,7 @@ exports[`TemplateItemActions Private files can be published or cleared by reques `; -exports[`TemplateItemActions Private files can be published or cleared by requester when approved and submitted by issuer 1`] = ` +exports[`TemplateItemActions Private files can be published by requester when approved and submitted by issuer 1`] = ` @@ -3580,138 +3336,32 @@ exports[`TemplateItemActions Private files can be published or cleared by reques "value": "Some public description", }, "size": 4n, - "storageFeePaidBy": "", - }, - "commonData": Object { - "acknowledgedByOwner": false, - "acknowledgedByVerifiedIssuer": false, - "defaultTitle": "Some public description", - "fees": undefined, - "isSet": true, - "newItem": false, - "rejectReason": undefined, - "reviewedOn": undefined, - "status": "REVIEW_ACCEPTED", - "submitter": Object { - "address": "5EBxoSssqNo23FvsDeUxjyQScnfEiGxJaNwuwqBH2Twe35BX", - "equals": [Function], - "toKey": [Function], - "type": "Polkadot", - }, - "template": true, - "timestamp": null, - "type": "Document", - }, - } - } - /> - - + /> + @@ -6079,7 +5729,7 @@ exports[`TemplateItemActions Public data can be acknowledged by owner when publi `; -exports[`TemplateItemActions Public data can be published or cleared by requester when approved 1`] = ` +exports[`TemplateItemActions Public data can be published by requester when approved 1`] = ` @@ -6193,112 +5843,6 @@ exports[`TemplateItemActions Public data can be published or cleared by requeste } /> - @@ -6412,7 +5956,7 @@ exports[`TemplateItemActions Public data can be published or cleared by requeste `; -exports[`TemplateItemActions Public data can be published or cleared by requester when approved and submitted by issuer 1`] = ` +exports[`TemplateItemActions Public data can be published by requester when approved and submitted by issuer 1`] = ` @@ -6526,112 +6070,6 @@ exports[`TemplateItemActions Public data can be published or cleared by requeste } /> -