govuk_content_models 31.2.0 → 31.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d6c4b37f1704591fe5ac808a9bebf9ba0f46f556
4
- data.tar.gz: 92b2f993c3593f86ce2456e6cd2d368425487c86
3
+ metadata.gz: 976fcc12ec04b0a7730a917068999749e33235c4
4
+ data.tar.gz: 04559780e24de5c5ef77f2df19b0c5a1dbac2d62
5
5
  SHA512:
6
- metadata.gz: ea3806b6bf44597b7cac2ca62d4ae70e0c9c2115f62e8d2f1fb9174c30e9554ceae5c988a4ba93befb4f2eb9521cdb4237ff67cd93ede953e1a4f97852de9190
7
- data.tar.gz: 0745c269617bbbb331f3ef841d6d1df8d02fc48420eb9491fb27d9c18dd6536af8b430d646a1d4b43195344a8d9b51961ec65ba04a74b7c1e857d50e288adaf0
6
+ metadata.gz: d3cc2e23eca5a70c5acab04bc125d762813683f1442250dad71ef6d782a9b575f232b8f3cc5663cf4c242603fdc42bdce55691d7584ce54779224257d09cf79a
7
+ data.tar.gz: c645c2dfd2cbf17f8a8f49dad61462b03845a2f588a08d498a7a8e757e011da49c2879bb8def4f891337335c7e5b39c317e59536f16b2a79a5c9b2d9e2e47455
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 31.2.1
4
+
5
+ - Bugfix: don't run validations on editions when archiving an artefact
6
+
3
7
  ## 31.2.0
4
8
 
5
9
  - Add `content_id` to `Tag` model
@@ -294,7 +294,7 @@ class Artefact
294
294
  if state == 'archived'
295
295
  Edition.where(panopticon_id: self.id, :state.nin => ["archived"]).each do |edition|
296
296
  edition.new_action(self, "note", comment: "Artefact has been archived. Archiving this edition.")
297
- edition.archive!
297
+ edition.perform_event_without_validations(:archive!)
298
298
  end
299
299
  end
300
300
  end
@@ -313,7 +313,7 @@ class Artefact
313
313
  def save_as(user, options={})
314
314
  default_action = new_record? ? "create" : "update"
315
315
  action_type = options.delete(:action_type) || default_action
316
- record_action action_type, user: user
316
+ record_action(action_type, user: user)
317
317
  save(options)
318
318
  end
319
319
 
@@ -1,4 +1,4 @@
1
1
  module GovukContentModels
2
2
  # Changing this causes Jenkins to tag and release the gem into the wild
3
- VERSION = "31.2.0"
3
+ VERSION = "31.2.1"
4
4
  end
@@ -460,6 +460,21 @@ class ArtefactTest < ActiveSupport::TestCase
460
460
  end
461
461
  end
462
462
 
463
+ test "should not run validations on editions when archiving" do
464
+ artefact = FactoryGirl.create(:artefact, state: "live")
465
+ edition = FactoryGirl.create(:help_page_edition, panopticon_id: artefact.id, state: 'published')
466
+ user1 = FactoryGirl.create(:user)
467
+
468
+ # Make the edition invalid, check that it persisted the invalid state
469
+ edition.update_attribute(:title, nil)
470
+ assert_equal(nil, edition.reload.title)
471
+
472
+ artefact.update_attributes_as(user1, state: "archived")
473
+ artefact.save!
474
+
475
+ assert_equal("archived", edition.reload.state)
476
+ end
477
+
463
478
  test "should restrict what attributes can be updated on an edition that has an archived artefact" do
464
479
  artefact = FactoryGirl.create(:artefact, state: "live")
465
480
  edition = FactoryGirl.create(:programme_edition, panopticon_id: artefact.id, state: "published")
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: govuk_content_models
3
3
  version: !ruby/object:Gem::Version
4
- version: 31.2.0
4
+ version: 31.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paul Battley
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-18 00:00:00.000000000 Z
11
+ date: 2015-10-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bson_ext