Skip to content

Commit

Permalink
Allow drafts to be transferred
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffdaley committed Mar 12, 2024
1 parent 70368ac commit 66f0195
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 20 deletions.
3 changes: 2 additions & 1 deletion web/app/components/document/sidebar.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -408,12 +408,13 @@
{{/each-in}}

{{! Transfer ownership }}
{{#if (and this.isOwner (not this.isDraft))}}
{{#if this.isOwner}}
<div class="pt-5">
<div class="border-t border-color-border-faint pt-7">
<Action
data-test-transfer-document-ownership-button
{{on "click" this.showTransferOwnershipModal}}
disabled={{this.editingIsDisabled}}
class="flex gap-2 text-body-100 text-color-foreground-disabled hover:text-color-foreground-faint focus:text-color-foreground-faint"
>
<FlightIcon @name="swap-horizontal" />
Expand Down
21 changes: 2 additions & 19 deletions web/tests/acceptance/authenticated/document-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1596,7 +1596,7 @@ module("Acceptance | authenticated/document", function (hooks) {
assert.dom(DISABLED_FOOTER_H5).hasText("Document is locked");
});

test("owners can transfer ownership of their published docs", async function (this: AuthenticatedDocumentRouteTestContext, assert) {
test("owners can transfer ownership of their docs", async function (this: AuthenticatedDocumentRouteTestContext, assert) {
this.server.create("document", {
id: 1,
objectID: 1,
Expand All @@ -1612,23 +1612,6 @@ module("Acceptance | authenticated/document", function (hooks) {

await visit("/document/1");

assert
.dom(TRANSFER_OWNERSHIP_BUTTON)
.doesNotExist("drafts cannot be transferred");

this.server.create("document", {
id: 2,
objectID: 2,
isDraft: false,
status: "In-review",
});

await visit("/document/2");

assert
.dom(TRANSFER_OWNERSHIP_BUTTON)
.exists('the "transfer ownership" button is shown for published docs');

await click(TRANSFER_OWNERSHIP_BUTTON);

assert.dom(TRANSFER_OWNERSHIP_MODAL).exists();
Expand Down Expand Up @@ -1695,7 +1678,7 @@ module("Acceptance | authenticated/document", function (hooks) {

assert.dom(OWNERSHIP_TRANSFERRED_MODAL).doesNotExist();

const doc = this.server.schema.document.find(2);
const doc = this.server.schema.document.find(1);
const docOwner = doc.attrs.owners[0];

assert.equal(
Expand Down

0 comments on commit 66f0195

Please sign in to comment.