feat: editor write path
This commit is contained in:
1 parent
d9158025d4
commit
a0b3c58c52
88 files changed
+5738
-263
No files matched your search
@@ -1,6 +1,8 @@
|
||||
Feature: An authenticated user can publish and unpublish an article
|
||||
Superseded in part by roles_permissions_content_scope: the article routes are gated by the content.* permissions of the caller's role (content.create, content.update, content.delete and content.publish; a refusal is 403 "missing_permission" with the header X-Missing-Permission), and content.read decides which drafts show: every draft at all, only the caller's own drafts at own, none otherwise. A draft the caller may not read answers 404 "Article not found", and a role that cannot be resolved is treated as holding no permission.
|
||||
|
||||
Extended by article_story_lifecycle: publishing a version in a disabled language answers 422 language_disabled.
|
||||
|
||||
As an authenticated RenewCMS user managing the CMS
|
||||
I want to flip an article's is_online flag from an HTTP endpoint
|
||||
So that a draft can be published to the public site and a published article can be
|
||||
@@ -25,6 +27,7 @@ Feature: An authenticated user can publish and unpublish an article
|
||||
And an id absent from the article repository answers 404 with body
|
||||
apperr.ArticleNotFoundErrorMessage, backed by errors.Is(err, article.ErrArticleNotFound),
|
||||
the same as DeleteArticle already does per features/write_not_found_errors.feature
|
||||
And publishing and unpublishing act on one article id, one language version; sibling versions are untouched
|
||||
And GET /v1/article/ with no jwt cookie only returns online articles, per
|
||||
features/public_article_listing.feature; this slice does not change that behavior,
|
||||
only feeds it
|
||||
@@ -93,6 +96,32 @@ Feature: An authenticated user can publish and unpublish an article
|
||||
| publish |
|
||||
| unpublish |
|
||||
|
||||
Scenario: Publishing a draft in a disabled language is refused
|
||||
Given a valid jwt cookie for a user holding content.publish
|
||||
And article 15 is offline in language "es", which is disabled on its site
|
||||
When the client sends PATCH /v1/article/15/publish with that cookie
|
||||
Then the response status is 422
|
||||
And the response body is the text "language_disabled"
|
||||
And article 15 stays offline
|
||||
|
||||
Scenario: An online version in a disabled language can still be unpublished, and publish is idempotent
|
||||
Given a valid jwt cookie for a user holding content.publish
|
||||
And article 16 is online in language "es", which is disabled on its site
|
||||
When the client sends PATCH /v1/article/16/unpublish with that cookie
|
||||
Then the response status is 200
|
||||
And the response body is the article with id 16 and "is_online": false
|
||||
When article 16 is online again and the client sends PATCH /v1/article/16/publish with that cookie
|
||||
Then the response status is 200
|
||||
And the response body is the article with id 16 and "is_online": true
|
||||
|
||||
Scenario: Publishing one language leaves the other versions alone
|
||||
Given a valid jwt cookie for a user holding content.publish
|
||||
And story 5 holds article 10 (en, online) and article 12 (fr, offline)
|
||||
When the client sends PATCH /v1/article/12/publish with that cookie
|
||||
Then the response status is 200
|
||||
And article 12 is online
|
||||
And the publication and updated_at of article 10 are unchanged
|
||||
|
||||
Scenario: Publishing an article makes it appear in the public online-only list
|
||||
Given a valid jwt cookie for a user with id 1
|
||||
And the article repository contains an offline article titled "Draft: Kitchen Remodel" with id 2
|
||||
|
||||
Reference in new issue
Block a user