Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix setting the article password from the Admin
The password field was present in the form, but not accepted by the
controller. This change adds password to the list of accepted fields.
  • Loading branch information
mvz committed Feb 7, 2022
1 parent 451ce62 commit 16fceec
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions publify_core/app/controllers/admin/content_controller.rb
Expand Up @@ -180,6 +180,7 @@ def update_params
:body_and_extended,
:draft,
:extended,
:password,
:permalink,
:published_at,
:text_filter_name,
Expand Down
15 changes: 15 additions & 0 deletions publify_core/spec/controllers/admin/content_controller_spec.rb
Expand Up @@ -160,6 +160,12 @@ def base_article(options = {})
assert_equal 2, new_article.tags.size
end

it "creates an article with a password" do
post :create, params: { "article" => base_article(password: "foobar") }
new_article = Article.last
expect(new_article.password).to eq("foobar")
end

it "creates an article with a unique Tag instance named lang:FR" do
post :create, params: { "article" => base_article(keywords: "lang:FR") }
new_article = Article.last
Expand Down Expand Up @@ -392,6 +398,15 @@ def base_article(options = {})
expect(article.extended).to eq("bar<!--more-->baz")
end

it "allows updating password" do
put :update, params: { "id" => article.id, "article" => {
"password" => "foobar",
} }
assert_response :redirect
article.reload
expect(article.password).to eq("foobar")
end

context "when a published article has drafts" do
let(:original_published_at) { 2.days.ago.to_date }
let!(:original) { create(:article, published_at: original_published_at) }
Expand Down

0 comments on commit 16fceec

Please sign in to comment.