govuk_content_models 22.2.0 → 23.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG.md +6 -0
- data/app/models/action.rb +2 -0
- data/app/models/edition.rb +0 -1
- data/app/models/workflow.rb +5 -0
- data/app/models/workflow_actor.rb +6 -2
- data/lib/govuk_content_models/version.rb +1 -1
- data/test/models/edition_test.rb +0 -28
- data/test/models/workflow_test.rb +11 -0
- metadata +4 -4
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
## 23.0.0
|
|
2
|
+
|
|
3
|
+
* Remove important_notes field from Edition
|
|
4
|
+
* Add IMPORTANT_NOTE and IMPORTANT_NOTE_RESOLVED request_types to Action
|
|
5
|
+
* Add methods to find, create and resolve important note actions to Workflow and WorkflowActor.
|
|
6
|
+
|
|
1
7
|
## 22.2.0
|
|
2
8
|
|
|
3
9
|
* Allow new formats for raib_report for Artefacts
|
data/app/models/action.rb
CHANGED
data/app/models/edition.rb
CHANGED
data/app/models/workflow.rb
CHANGED
|
@@ -216,6 +216,11 @@ module Workflow
|
|
|
216
216
|
save(validate: false)
|
|
217
217
|
end
|
|
218
218
|
|
|
219
|
+
def important_note
|
|
220
|
+
action = actions.where(:request_type.in => [Action::IMPORTANT_NOTE, Action::IMPORTANT_NOTE_RESOLVED]).last
|
|
221
|
+
action if action.try(:request_type) == Action::IMPORTANT_NOTE
|
|
222
|
+
end
|
|
223
|
+
|
|
219
224
|
private
|
|
220
225
|
|
|
221
226
|
def publish_at_is_in_the_future
|
|
@@ -54,8 +54,12 @@ module WorkflowActor
|
|
|
54
54
|
edition.save if edition
|
|
55
55
|
end
|
|
56
56
|
|
|
57
|
-
def record_note(edition, comment)
|
|
58
|
-
edition.new_action(self,
|
|
57
|
+
def record_note(edition, comment, type = Action::NOTE)
|
|
58
|
+
edition.new_action(self, type, comment: comment)
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def resolve_important_note(edition)
|
|
62
|
+
record_note(edition, nil, Action::IMPORTANT_NOTE_RESOLVED)
|
|
59
63
|
end
|
|
60
64
|
|
|
61
65
|
def create_edition(format, attributes = {})
|
data/test/models/edition_test.rb
CHANGED
|
@@ -1001,34 +1001,6 @@ class EditionTest < ActiveSupport::TestCase
|
|
|
1001
1001
|
end
|
|
1002
1002
|
end
|
|
1003
1003
|
|
|
1004
|
-
context "Important note" do
|
|
1005
|
-
def set_note(edition, note)
|
|
1006
|
-
edition.important_note = note
|
|
1007
|
-
edition.save
|
|
1008
|
-
edition.reload
|
|
1009
|
-
end
|
|
1010
|
-
|
|
1011
|
-
setup do
|
|
1012
|
-
@edition = FactoryGirl.create(:guide_edition, panopticon_id: @artefact.id, state: "ready")
|
|
1013
|
-
set_note(@edition, "This is an important note.")
|
|
1014
|
-
end
|
|
1015
|
-
|
|
1016
|
-
should "be able to add a important note to an edition" do
|
|
1017
|
-
assert_equal "This is an important note.", @edition.important_note
|
|
1018
|
-
end
|
|
1019
|
-
|
|
1020
|
-
should "be able to update an existing important note" do
|
|
1021
|
-
set_note(@edition, "New note.")
|
|
1022
|
-
assert_equal "New note.", @edition.important_note
|
|
1023
|
-
end
|
|
1024
|
-
|
|
1025
|
-
should "should not exist when creating new editions" do
|
|
1026
|
-
Edition.subclasses.each do |klass|
|
|
1027
|
-
refute klass.fields_to_clone.include?(:important_note), "Important note is cloned in a #{klass}"
|
|
1028
|
-
end
|
|
1029
|
-
end
|
|
1030
|
-
end
|
|
1031
|
-
|
|
1032
1004
|
context "Tagging to collections" do
|
|
1033
1005
|
setup do
|
|
1034
1006
|
@edition = FactoryGirl.create(:guide_edition)
|
|
@@ -347,4 +347,15 @@ class WorkflowTest < ActiveSupport::TestCase
|
|
|
347
347
|
user_2.request_amendments(edition, {comment: "More work needed"})
|
|
348
348
|
assert edition.amends_needed?
|
|
349
349
|
end
|
|
350
|
+
|
|
351
|
+
test "important_note returns last non-resolved important note" do
|
|
352
|
+
user = User.create(name: "Ben")
|
|
353
|
+
edition = template_guide
|
|
354
|
+
user.record_note(edition, 'this is an important note', Action::IMPORTANT_NOTE)
|
|
355
|
+
user.record_action(edition, 'request_review')
|
|
356
|
+
assert_equal edition.important_note.comment, 'this is an important note'
|
|
357
|
+
|
|
358
|
+
user.record_note(edition, nil, Action::IMPORTANT_NOTE_RESOLVED)
|
|
359
|
+
assert_nil edition.important_note
|
|
360
|
+
end
|
|
350
361
|
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:
|
|
4
|
+
version: 23.0.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-
|
|
12
|
+
date: 2014-11-06 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: bson_ext
|
|
@@ -464,7 +464,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
464
464
|
version: '0'
|
|
465
465
|
segments:
|
|
466
466
|
- 0
|
|
467
|
-
hash: -
|
|
467
|
+
hash: -3179151873791569033
|
|
468
468
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
469
469
|
none: false
|
|
470
470
|
requirements:
|
|
@@ -473,7 +473,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
473
473
|
version: '0'
|
|
474
474
|
segments:
|
|
475
475
|
- 0
|
|
476
|
-
hash: -
|
|
476
|
+
hash: -3179151873791569033
|
|
477
477
|
requirements: []
|
|
478
478
|
rubyforge_project:
|
|
479
479
|
rubygems_version: 1.8.23
|