mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FEATURE: Support for publishing topics as pages (#9364)
If the feature is enabled, staff members can construct a URL and publish a topic for others to browse without the regular Discourse chrome. This is useful if you want to use Discourse like a CMS and publish topics as articles, which can then be embedded into other systems.
This commit is contained in:
40
test/javascripts/acceptance/page-publishing-test.js
Normal file
40
test/javascripts/acceptance/page-publishing-test.js
Normal file
@@ -0,0 +1,40 @@
|
||||
import { acceptance } from "helpers/qunit-helpers";
|
||||
|
||||
acceptance("Page Publishing", {
|
||||
loggedIn: true,
|
||||
pretend(server, helper) {
|
||||
const validSlug = helper.response({ valid_slug: true });
|
||||
|
||||
server.put("/pub/by-topic/280", () => {
|
||||
return helper.response({});
|
||||
});
|
||||
server.get("/pub/by-topic/280", () => {
|
||||
return helper.response({});
|
||||
});
|
||||
server.get("/pub/check-slug", req => {
|
||||
if (req.queryParams.slug === "internationalization-localization") {
|
||||
return validSlug;
|
||||
}
|
||||
return helper.response({
|
||||
valid_slug: false,
|
||||
reason: "i don't need a reason"
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
QUnit.test("can publish a page via modal", async assert => {
|
||||
await visit("/t/internationalization-localization/280");
|
||||
await click(".topic-post:eq(0) button.show-more-actions");
|
||||
await click(".topic-post:eq(0) button.show-post-admin-menu");
|
||||
await click(".topic-post:eq(0) .publish-page");
|
||||
|
||||
await fillIn(".publish-slug", "bad-slug");
|
||||
assert.ok(!exists(".valid-slug"));
|
||||
assert.ok(exists(".invalid-slug"));
|
||||
await fillIn(".publish-slug", "internationalization-localization");
|
||||
assert.ok(exists(".valid-slug"));
|
||||
assert.ok(!exists(".invalid-slug"));
|
||||
|
||||
await click(".publish-page");
|
||||
assert.ok(exists(".current-url"));
|
||||
});
|
||||
@@ -1977,6 +1977,7 @@ export default {
|
||||
pinned: false,
|
||||
pinned_at: null,
|
||||
details: {
|
||||
can_publish_page: true,
|
||||
can_invite_via_email: true,
|
||||
auto_close_at: null,
|
||||
auto_close_hours: null,
|
||||
|
||||
Reference in New Issue
Block a user