FEATURE: Shared Drafts

This feature can be enabled by choosing a destination for the
`shared drafts category` site setting.

* Staff members can create shared drafts, choosing a destination
category for the topic when it is published.

* Shared Drafts can be viewed in their category, or above the
topic list for the destination category where it will end up.

* When the shared draft is ready, it can be published to the
appropriate category by clicking a button on the topic view.

* When published, Drafts change their timestamps to the current
time, and any edits to the original post are removed.
This commit is contained in:
Robin Ward
2018-03-13 15:59:12 -04:00
parent dcbd9635f4
commit b9abd7dc9e
59 changed files with 851 additions and 260 deletions
@@ -91,6 +91,22 @@ QUnit.test('replying to post - reply_as_new_topic', assert => {
});
});
QUnit.test('shared draft', assert => {
let composerActions = selectKit('.composer-actions');
visit("/");
click('#create-topic');
andThen(() => {
composerActions.expand().selectRowByValue('shared_draft');
});
andThen(() => {
assert.equal(
find('#reply-control .btn-primary.create .d-button-label').text(),
I18n.t('composer.create_shared_draft')
);
assert.ok(find('#reply-control.composing-shared-draft').length === 1);
});
});
QUnit.test('interactions', assert => {
const composerActions = selectKit('.composer-actions');
@@ -137,7 +153,7 @@ QUnit.test('interactions', assert => {
assert.equal(composerActions.rowByIndex(0).value(), 'reply_to_post');
assert.equal(composerActions.rowByIndex(1).value(), 'reply_as_private_message');
assert.equal(composerActions.rowByIndex(2).value(), 'reply_to_topic');
assert.equal(composerActions.rowByIndex(3).value(), undefined);
assert.equal(composerActions.rowByIndex(3).value(), 'shared_draft');
});
composerActions.selectRowByValue('reply_as_private_message').expand();
@@ -0,0 +1,19 @@
import { acceptance } from "helpers/qunit-helpers";
acceptance("Shared Drafts", { loggedIn: true });
QUnit.test('Viewing', assert => {
visit("/t/some-topic/9");
andThen(() => {
assert.ok(find('.shared-draft-controls').length === 1);
let categoryChooser = selectKit('.shared-draft-controls .category-chooser');
assert.equal(categoryChooser.header().value(), '3');
});
click('.publish-shared-draft');
click('.bootbox .btn-primary');
andThen(() => {
assert.ok(find('.shared-draft-controls').length === 0);
});
});
@@ -6,6 +6,7 @@ QUnit.test("Enter a Topic", assert => {
andThen(() => {
assert.ok(exists("#topic"), "The topic was rendered");
assert.ok(exists("#topic .cooked"), "The topic has cooked posts");
assert.ok(find('.shared-draft-notice').length === 0, "no shared draft unless there's a dest category id");
});
});
@@ -38,4 +39,4 @@ QUnit.test("Enter with 500 errors", assert => {
assert.ok(!exists("#topic"), "The topic was not rendered");
assert.ok(exists(".topic-error"), "An error message is displayed");
});
});
});