govuk_content_models 13.1.0 → 13.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## 13.2.0
2
+
3
+ * Denormalising users doesn't require the entire edition
4
+ to be validated and saved. Hence replacing it with a
5
+ set operation.
6
+
1
7
  ## 13.1.0
2
8
 
3
9
  * Perform link validation everytime an edition is saved,
@@ -11,7 +11,7 @@ module Workflow
11
11
  before_destroy :check_can_delete_and_notify
12
12
  after_destroy :notify_siblings_of_published_edition
13
13
 
14
- before_save :denormalise_users
14
+ before_save :denormalise_users!
15
15
  after_create :notify_siblings_of_new_edition
16
16
 
17
17
  field :state, type: String, default: "draft"
@@ -113,13 +113,13 @@ module Workflow
113
113
  # collections, but share a model and relationships with eg actions.
114
114
  # Therefore, Panopticon might not find a user for an action.
115
115
  if action.requester
116
- self[property] = action.requester.name
116
+ set(property, action.requester.name)
117
117
  end
118
118
  end
119
119
  end
120
120
 
121
- def denormalise_users
122
- self.assignee = assigned_to.name if assigned_to
121
+ def denormalise_users!
122
+ set(:assignee, assigned_to.name) if assigned_to
123
123
  update_user_action("creator", [Action::CREATE, Action::NEW_VERSION])
124
124
  update_user_action("publisher", [Action::PUBLISH])
125
125
  update_user_action("archiver", [Action::ARCHIVE])
@@ -18,14 +18,14 @@ module WorkflowActor
18
18
  def record_action(edition, type, options={})
19
19
  type = Action.const_get(type.to_s.upcase)
20
20
  action = edition.new_action(self, type, options)
21
- edition.save! # force callbacks for denormalisation
21
+ edition.denormalise_users!
22
22
  action
23
23
  end
24
24
 
25
25
  def record_action_without_validation(edition, type, options={})
26
26
  type = Action.const_get(type.to_s.upcase)
27
27
  action = edition.new_action_without_validation(self, type, options)
28
- edition.save! # force callbacks for denormalisation
28
+ edition.denormalise_users!
29
29
  action
30
30
  end
31
31
 
@@ -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 = "13.1.0"
3
+ VERSION = "13.2.0"
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: govuk_content_models
3
3
  version: !ruby/object:Gem::Version
4
- version: 13.1.0
4
+ version: 13.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-06-30 00:00:00.000000000 Z
12
+ date: 2014-07-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bson_ext
@@ -468,7 +468,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
468
468
  version: '0'
469
469
  segments:
470
470
  - 0
471
- hash: 3968322493535116070
471
+ hash: -3600422238156997598
472
472
  required_rubygems_version: !ruby/object:Gem::Requirement
473
473
  none: false
474
474
  requirements:
@@ -477,7 +477,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
477
477
  version: '0'
478
478
  segments:
479
479
  - 0
480
- hash: 3968322493535116070
480
+ hash: -3600422238156997598
481
481
  requirements: []
482
482
  rubyforge_project:
483
483
  rubygems_version: 1.8.23